package Ġcom . j pp . mp about Ċ Ċ import Ġandroid . content . Activity NotFoundException Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . browser . custom tabs . Custom Tabs Intent Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . j pp . mp . common . extensions . clean View Ċ import Ġcom . j pp . mp . common . extensions . observe Handled Event Ċ import Ġcom . j pp . mp . common . extensions . observe Value Ċ import Ġcom . j pp . mp . common . extensions . send Ċ import Ġcom . j pp . mp . common . extensions . set Screen Title Ċ import Ġcom . j pp . mp . common . extensions . web Ċ import Ġcom . j pp . mp . common . view model . MP Generic Saved State ViewModel Factory Ċ import Ġcom . j pp . mp about . databinding . Fragment About Binding Ċ import Ġcom . j pp . mp design . ext . getColor Ċ import Ġdagger . android . support . Android Support Injection Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠFragment Ġused Ġto Ġshow Ġthe Ġabout Ġsection Ġo of Ġthe Ġapplication . Ċ Ġ* Ċ Ġ* ĠWhen Ġinstantiated , Ġthis Ġfragment Ġinvokes Ġthe Ġ[ About ViewModel ] Ġmethods Ġin Ġorder Ġto Ġretrieve Ċ Ġ* Ġand Ġshow Ġthe Ġabout Ġdata . ĠThe ĠVM Ġwill Ġperform Ġthe Ġfetch Ġand Ġwill Ġupdate Ġthe ĠUI Ġstates Ċ Ġ* Ġrepresented Ġby Ġ[ About ViewState ] Ġand Ġthis ĠFragment Ġwill Ġrender Ġthose Ġupdates . Ċ Ġ*/ Ċ class ĠAbout Fragment Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory : ĠAbout ViewModel Factory ĊĊĠĠĠ Ġprivate Ġvar Ġview Binding : ĠFragment About Binding ? Ġ= Ġnull ĊĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠAbout ViewModel Ġby Ġview Models Ġ{ ĊĠĠĠĠĠĠĠ ĠMP Generic Saved State ViewModel Factory ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel Factory , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthis ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġvar Ġabout Rv : ĠRecyclerView ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun Ġon Attach ( context : ĠContext ) Ġ{ ĊĠĠĠĠĠĠĠ ĠAndroid Support Injection . inject ( this ) ĊĠĠĠĠĠĠĠ Ġsuper . on Attach ( context ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġview Binding Ġ= ĠData Binding Util . inflate ( in flater , ĠR . layout . fragment _ about , Ġcontainer , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġreturn Ġview Binding ?. root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġabout Rv Ġ= Ġview . findViewById ( R . id . about Rv ) ĊĠĠĠĠĠĠĠ ĠviewModel . view State . observe Value ( view Lifecycle Owner , Ġ:: render ViewState ) ĊĠĠĠĠĠĠĠ ĠviewModel . nav Events . observe Handled Event ( view Lifecycle Owner , Ġ:: handle Nav Event ) ĊĠĠĠĠĠĠĠ ĠviewModel . on Init () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Destroy View () Ġ{ ĊĠĠĠĠĠĠĠ Ġview Binding Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġabout Rv Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġsuper . on Destroy View () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġrender ViewState ( view State : ĠAbout ViewState ) Ġ{ ĊĠĠĠĠĠĠĠ Ġset Screen Title ( getString ( view State . screen Title )) ĊĠĠĠĠĠĠĠ Ġview Binding ?. view State Ġ= Ġview State ĊĠĠĠĠĠĠĠ Ġabout Rv ?. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout Manager Ġ= ĠLinearLayoutManager ( context ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter Ġ= ĠAbout Items Adapter ( view State . content . about Items ) Ġ{ ĠviewModel . on User Selected About Item ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Item Decoration ( Divider Item Decoration ( context , Ġ( layout Manager Ġas ĠLinearLayoutManager ). orientation )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġhandle Nav Event ( nav Event : ĠAbout Nav Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen Ġ( nav Event ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠAbout Nav Event . Inner Navigation Ġ-> Ġnavigate Inner Browser ( nav Event . url ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠAbout Nav Event . Open Google Play Ġ-> Ġgo To Rate App Screen ( nav Event . url ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠAbout Nav Event . Open Sharing Ġ-> Ġgo To Share App Screen ( nav Event . url ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠAbout Nav Event . Outer Navigation Ġ-> Ġgo To Web Browser ( nav Event . url ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgo To Rate App Screen ( uri String : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent (). clean View ( uri String )) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠActivity NotFoundException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . on Failed To Open Play Store () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgo To Share App Screen ( uri String : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ ĠstartActivity ( Intent (). send ( getString ( R . string . share _ app _ text , Ġuri String ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgo To Web Browser ( url : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ ĠstartActivity ( Intent (). web ( url )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate Inner Browser ( uri String : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCustom Tabs Intent . Builder (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Toolbar Color ( getColor ( R . color . primary Color )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Start Animations ( it , ĠR . anim . activity _ enter _ transition , ĠR . anim . activity _ exit _ transition ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Exit Animations ( it , ĠR . anim . activity _ enter _ transition , ĠR . anim . activity _ exit _ transition ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}. build (). launch Url ( it , ĠUri . parse ( uri String )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ