package Ġorg . mj studio . gg ong gang . ui . information Ċ Ċ import Ġandroid . os . Build Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . navigation . fragment . nav Args Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . transition . Change Bounds Ċ import Ġandroidx . transition . Change Clip Bounds Ċ import Ġandroidx . transition . Transition Inflater Ċ import Ġdagger . android . Android Injection Ċ import Ġdagger . android . Android Injector Ċ import Ġdagger . android . support . Android Support Injection Ċ import Ġdagger . android . support . D agger Fragment Ċ import Ġorg . mj studio . g free . domain . common . debug E Ċ import Ġorg . mj studio . g free . domain . entity . Class Data Ċ import Ġorg . mj studio . gg ong gang . R Ċ import Ġorg . mj studio . gg ong gang . common . Auto Cle ared Value Ċ import Ġorg . mj studio . gg ong gang . common . observe Once Ċ import Ġorg . mj studio . gg ong gang . common . show Snackbar Ċ import Ġorg . mj studio . gg ong gang . common . toast Ċ import Ġorg . mj studio . gg ong gang . databinding . Fragment Information Binding Ċ import Ġorg . mj studio . gg ong gang . di . ViewModel Factory Ċ import Ġorg . mj studio . gg ong gang . ui . Main ViewModel Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠInformation Fragment Ġ: ĠFragment () Ġ Ġ{ ĊĠĠĠ Ġprivate Ġval ĠTAG Ġ= ĠInformation Fragment :: class . java . simple Name ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠKEY Ġ= Ġ" CLAS SD ATA " ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġargs : ĠInformation Fragment Args Ġby Ġnav Args () ĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory Ġ: ĠInformation ViewModel Factory ĊĊĠĠĠ Ġprivate Ġvar Ġm Binding : ĠFragment Information Binding Ġby ĠAuto Cle ared Value () ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm ViewModel Ġ: ĠInformation ViewModel ĊĠĠĠ Ġlateinit Ġvar Ġclass Data : ĠClass Data ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĊĠĠĠĠĠĠĠ Ġpost p one Enter Transition (); ĊĠĠĠĠĠĠĠ Ġshared Element Enter Transition = Transition Inflater . from ( getContext ()). inflate Transition ( android . R . transition . move ) ĊĠĠĠĠĠĠĠ Ġshared Element Return Transition Ġ= Ġnull ĊĊĊĠĠĠĠĠĠĠ Ġif Ġ( savedInstanceState Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclass Data Ġ= Ġargs . class Data ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclass Data Ġ= ĠsavedInstanceState . get Parcelable ( KEY ) !! ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠAndroid Support Injection . inject ( this ) ĊĠĠĠĠĠĠĠ Ġm ViewModel Ġ= ĠViewModel Provider ( this , viewModel Factory )[ Information ViewModel :: class . java ] ĊĊĠĠĠĠĠĠĠ Ġm Binding Ġ= ĠFragment Information Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġm Binding . lifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠĠĠĠĠ Ġm Binding . vm Ġ= Ġm ViewModel ĊĊĠĠĠĠĠĠĠ Ġinit Re cy lc er View () ĊĠĠĠĠĠĠĠ Ġlisten ViewModel () ĊĊĊĠĠĠĠĠĠĠ Ġstart Post p oned Enter Transition () ĊĊĊĠĠĠĠĠĠĠ Ġreturn Ġm Binding . root ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Save InstanceState ( out State ) ĊĠĠĠĠĠĠĠ Ġout State . put Parcelable ( KEY , Ġclass Data ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġlisten ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġm ViewModel . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclick Back . observe Once ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). pop Back Stack () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmsg . observe Once ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthis @ Information Fragment . toast ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsn ack Msg . observe Once ( view Lifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm Binding . root . show Snackbar ( it . msg ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġfun Ġinit Re cy lc er View () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġlayout Manager Ġ= ĠLinearLayoutManager ( context !! ) ĊĠĠĠĠĠĠĠ Ġval Ġdecorator Ġ= ĠDiv ider Item Decoration ( context !! , ĠLinearLayoutManager . VERTICAL ) ĊĊĠĠĠĠĠĠĠ Ġm Binding . re cyclerView Review . adapter Ġ= ĠInformation Adapter ( m ViewModel ) ĊĠĠĠĠĠĠĠ Ġm Binding . re cyclerView Review . layout Manager Ġ= Ġlayout Manager ĊĠĠĠĠĠĠĠ Ġm Binding . re cyclerView Review . addItem Decoration ( decorator ) ĊĠĠĠ Ġ} Ċ }