package Ġcom . de pro meet . zer ow aste . feature . main Ċ Ċ import Ġandroidx . activity . add Callback Ċ import Ġandroidx . core . content . res . Resources Compat Ċ import Ġandroidx . fragment . app . activity ViewModels Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . navigation . ui . setup With Nav Controller Ċ import Ġcom . de pro meet . zer ow aste . R Ċ import Ġcom . de pro meet . zer ow aste . comm . Base Fragment Ċ import Ġcom . de pro meet . zer ow aste . comm . Keep State Navigator Ċ import Ġcom . de pro meet . zer ow aste . databinding . Fragment Main Binding Ċ import Ġcom . de pro meet . zer ow aste . feature . mission . certificate . Mission Cert Fragment Ċ Ċ class ĠMain Fragment : ĠBase Fragment < Fragment Main Binding >( R . layout . fragment _ main ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠMain ViewModel Ġby Ġactivity ViewModels () ĊĊĠĠĠ Ġoverride Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġchild FragmentManager . find Fragment ById ( R . id . main _ home _ navigation _ view ) Ġas ĠNav Host Fragment ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĠĠĠĠĠĠĠ Ġval Ġkeep State Navigator Ġ= ĠKeep State Navigator ( require Context (), Ġchild FragmentManager , ĠR . id . main _ home _ navigation _ view ) ĊĠĠĠĠĠĠĠ Ġnav Controller . navigator Provider . add Navigator ( keep State Navigator ) ĊĠĠĠĠĠĠĠ Ġnav Controller . set Graph ( R . navigation . navigation _ graph _ home ) ĊĠĠĠĠĠĠĠ Ġbinding . main Bottom Navigation . setup With Nav Controller ( nav Controller ) ĊĠĠĠĠĠĠĠ Ġbinding . main Bottom Navigation . item Icon Tint List Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġbinding . main Bottom Navigation . item TextColor Ġ= ĠResources Compat . getColor State List ( resources , ĠR . color . selector _ main _ bottom _ text _ color , Ġnull ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . nav Direction . observe ( this ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠviewModel . cert Mission Id . observe ( this ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMis sion Cert Fragment . start Mission Cert ( this , ĠMain Fragment Directions . action Main Fragment To Mission Cert Fragment ( it )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġvar Ġlast Pressed Time Ġ= Ġ 0 L ĊĊĠĠĠĠĠĠĠ Ġrequire Activity (). on Back Pressed Dispatcher . add Callback ( this ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠcurrentTime Ġ= ĠSystem . currentTimeMillis () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif ( last Pressed Time Ġ+ Ġ 2 0 0 0 Ġ> ĠcurrentTime ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequire Activity (). finish () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlast Pressed Time Ġ= ĠcurrentTime ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġshow Toast ( resources . getString ( R . string . finish _ toast )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }