package Ġcom . ef ed an iel . blood finder . blood finder . home . dashboard Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view .* Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . lifecycle . ViewModel Providers Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġcom . ef ed an iel . blood finder . App Ċ import Ġcom . ef ed an iel . blood finder . R Ċ Ċ import Ġcom . ef ed an iel . blood finder . base . Base Fragment Ċ import Ġcom . ef ed an iel . blood finder . base . Base ViewModel Ċ import Ġcom . ef ed an iel . blood finder . databinding . Fragment Dashboard Binding Ċ import Ġcom . ef ed an iel . blood finder . extensions . on Scroll Changed Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠDashboard Fragment Ġ: ĠBase Fragment () Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory : ĠViewModel Provider . Factory ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠFragment Dashboard Binding ĊĠĠĠ Ġprivate Ġlateinit Ġvar ĠviewModel : ĠDashboard ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠFragment Dashboard Binding . inflate ( in flater ) ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġthis ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetUp Toolbar () ĊĠĠĠĠĠĠĠ Ġ( main Activity . application Context Ġas ĠApp ). component . inject ( this ) ĊĠĠĠĠĠĠĠ ĠviewModel Ġ= ĠViewModel Providers . of ( this , ĠviewModel Factory ). get ( Dashboard ViewModel :: class . java ) ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ Ġset Has Options Menu ( true ) ĊĠĠĠĠĠĠĠ Ġbinding . actions RecyclerView . adapter Ġ= ĠDashboard Adapter Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( it ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Logout " Ġ-> Ġlogout () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Upload ĠB lood ĠAvailability " Ġ-> Ġnavigate To Blood Availability () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Request ĠFor ĠB lood " Ġ-> Ġnavigate To Blood Request () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" View ĠProfile " Ġ-> Ġnavigate To View Profile () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" View ĠRequest ĠHistory " Ġ-> Ġnavigate To Request History () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" View ĠDon ation ĠHistory " Ġ-> Ġnavigate To Don ation History () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġshow Snackbar ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġbinding . parent Nested ScrollView . on Scroll Changed Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmain Activity . invalidate Toolbar Elevation ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠviewModel . subscribe LoggedIn User To Notification () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate Options Menu ( menu : ĠMenu , Ġinflater : ĠMenu Inflater ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate Options Menu ( menu , Ġinflater ) ĊĠĠĠĠĠĠĠ Ġinflater . inflate ( R . menu . dashboard _ menu , Ġmenu ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Options ItemSelected ( item : ĠMenuItem ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( item . itemId ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . id . action _ logout Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlogout () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġsuper . on Options ItemSelected ( item ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġlogout () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To SignIn Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To Blood Availability () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To Blood Availability Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To Blood Request () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To Blood Request Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To View Profile () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To View Profile Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To Request History () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To Request History Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate To Don ation History () Ġ= Ġfind Nav Controller (). navigate ( Dashboard Fragment Directions . action Dashboard Fragment To Don ation History Fragment ()) ĊĊĠĠĠ Ġprivate Ġfun ĠsetUp Toolbar () Ġ= Ġmain Activity . run Ġ{ ĊĠĠĠĠĠĠĠ ĠsetUp ToolBar ( getString ( R . string . dashboard ), Ġfalse ) ĊĠĠĠĠĠĠĠ Ġinvalidate Toolbar Elevation ( 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget ViewModel (): ĠBase ViewModel Ġ= ĠviewModel Ċ } Ċ