package Ġcom . kin . eco system . main . view Ċ Ċ import Ġandroid . animation . Animator Set Ċ import Ġandroid . animation . Object Animator Ċ import Ġandroid . animation . Value Animator Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . annotation . Id Res Ċ import Ġandroid . support . constraint . Constraint Layout Ċ import Ġandroid . support . constraint . Guide line Ċ import Ġandroid . support . v 4 . app . Fragment Ċ import Ġcom . kin . eco system . R Ċ import Ġcom . kin . eco system . base .* Ċ import Ġcom . kin . eco system . base . widget . on Pre Draw Ċ import Ġcom . kin . eco system . base . widget . with End Action Ċ import Ġcom . kin . eco system . core . bi . Event Logger Impl Ċ import Ġcom . kin . eco system . core . data . auth . Auth Repository Ċ import Ġcom . kin . eco system . core . data . blockchain . Blockchain Source Impl Ċ import Ġcom . kin . eco system . core . data . settings . Settings DataSource Impl Ċ import Ġcom . kin . eco system . core . data . settings . Settings DataSource Local Ċ import Ġcom . kin . eco system . core . util . Device Utils Ċ import Ġcom . kin . eco system . history . view . Order History Fragment Ċ import Ġcom . kin . eco system . main . Screen Id Ċ import Ġcom . kin . eco system . main . Screen Id .* Ċ import Ġcom . kin . eco system . main . presenter . E co system Presenter Ċ import Ġcom . kin . eco system . main . presenter . IE co system Presenter Ċ import Ġcom . kin . eco system . marketplace . view . Market place Fragment Ċ import Ġcom . kin . eco system . marketplace . view . Not En ough Kin Fragment Ċ import Ġcom . kin . eco system . on boarding . view . On boarding Fragment Ċ import Ġcom . kin . eco system . settings . view . Settings Fragment Ċ Ċ class ĠE co system Activity Ġ: ĠKin E co system Base Activity (), ĠIE co system View Ġ{ ĊĊ ĉ override Ġval Ġlayout Res : ĠInt Ċĉ ĉ get () Ġ= ĠR . layout . k ine co system _ activity _ main ĊĊ ĉ private Ġvar Ġecosystem Presenter : ĠIE co system Presenter ? Ġ= Ġnull ĊĊ ĉ private Ġlateinit Ġvar Ġcontainer Frame : ĠConstraint Layout Ċ ĉ private Ġlateinit Ġvar Ġcontent Frame : ĠConstraint Layout Ċ ĉ private Ġlateinit Ġvar Ġce iling Guide line : ĠGuide line Ċ ĉ private Ġvar Ġis Closing Ġ= Ġfalse Ċ ĉ private Ġvar Ġend Guide line Anim Value : ĠFloat Ġ= Ġ- 1 F ĊĊ ĉ private Ġval Ġsaved Market place Fragment : ĠMarketplace Fragment ? Ċĉ ĉ get () Ġ= Ġsupport FragmentManager Ċĉĉĉ ĉ . find Fragment By Tag ( E CO SYSTEM _ MARK ET PLACE _ FRAGMENT _ TAG ) Ġas ĠMarketplace Fragment ? ĊĊ ĉ private Ġval Ġorder History Fragment : ĠOrder History Fragment ? Ċĉ ĉ get () Ġ= Ġsupport FragmentManager Ċĉĉĉ ĉ . find Fragment By Tag ( E CO SYSTEM _ ORDER _ HISTORY _ FRAGMENT _ TAG ) Ġas ĠOrder History Fragment ? ĊĊ ĉ override Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ Ċĉ ĉ super . onCreate ( savedInstanceState ) Ċĉ ĉ init Views () Ċĉ ĉ eco system Presenter Ġ= ĠE co system Presenter ( Auth Repository . getInstance (), Ċĉĉĉ ĉ Settings DataSource Impl ( Settings DataSource Local ( application Context )), Ċĉĉĉ ĉ Blockchain Source Impl . getInstance (), Ċĉĉĉ ĉ Event Logger Impl . getInstance (), Ċĉĉĉ ĉ this , ĠsavedInstanceState , Ġintent . extras ) Ċĉ ĉ eco system Presenter ?. on Attach ( this @ E co system Activity ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġinit Views () Ġ{ Ċĉ ĉ container Frame Ġ= ĠfindViewById < Constraint Layout >( R . id . container ). apply Ġ{ Ċĉĉ ĉ setOnClickListener Ġ{ Ċĉĉĉ ĉ eco system Presenter ?. touched Outside () Ċĉĉ ĉ } Ċĉĉ ĉ on Pre Draw Ġ{ Ċĉĉĉ ĉ run Enter Animation () Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ content Frame Ġ= ĠfindViewById < Constraint Layout >( R . id . screen _ content ). apply Ġ{ Ċĉĉ ĉ setOnClickListener Ġ{ Ġ} Ċĉ ĉ } Ċĉ ĉ ce iling Guide line Ġ= ĠfindViewById ( R . id . guide line ) Ċ ĉ } ĊĊ ĉ override Ġfun ĠonStart () Ġ{ Ċĉ ĉ super . onStart () Ċĉ ĉ eco system Presenter ?. onStart () Ċĉ ĉ getCurrent Fragment ()?. let Ġ{ Ċĉĉ ĉ if Ġ( it Ġis ĠKin E co system Base Fragment < *, Ġ* >) Ġ{ Ċĉĉĉ ĉ it . navigator Ġ= Ġthis Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ Ċĉ ĉ eco system Presenter ?. on Save InstanceState ( out State ) Ċĉ ĉ super . on Save InstanceState ( out State ) Ċ ĉ } ĊĊ ĉ private Ġfun Ġreplace Fragment (@ Id Res Ġcontainer Id : ĠInt , Ġfragment : ĠFragment , Ġtag : ĠString , Ċĉ ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcustom Animation : ĠCustom Animation Ġ= ĠCustom Animation (), Ċĉ ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġback Stack Name : ĠString ? Ġ= Ġnull , Ġallow State Loss : ĠBoolean Ġ= Ġfalse , Ċĉ ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġce iling Guide line : ĠFloat Ġ= ĠGUID EL INE _ PERCENT AGE _ DEFAULT ) Ġ{ ĊĊĉ ĉ val Ġtransaction Ġ= Ġsupport FragmentManager . beginTransaction () Ċĉĉĉ ĉ . set Custom Animations ( custom Animation . enter , Ċĉĉĉĉĉ ĉ custom Animation . exit , Ċĉĉĉĉĉ ĉ custom Animation . pop Enter , Ċĉĉĉĉĉ ĉ custom Animation . pop Exit ) ĊĊĉ ĉ if Ġ( back Stack Name Ġ!= Ġnull Ġ&& Ġ! back Stack Name . isEmpty ()) Ġ{ Ċĉĉ ĉ transaction . addTo Back Stack ( back Stack Name ) Ċĉ ĉ } ĊĊĉ ĉ transaction . replace ( container Id , Ġfragment , Ġtag ) ĊĊĉ ĉ if Ġ( allow State Loss ) Ġtransaction . commit Allow ing State Loss () Ġelse Ġtransaction . commit () ĊĊĊĉ ĉ if Ġ( end Guide line Anim Value Ġ!= Ġce iling Guide line ) Ġ{ Ċĉĉ ĉ animate Guide line Percentage ( from Ġ= ĠgetCurrent Guide line Percentage (), Ġto Ġ= Ġce iling Guide line ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġanimate Guide line Percentage ( from : ĠFloat , Ġto : ĠFloat Ġ= ĠGUID EL INE _ PERCENT AGE _ DEFAULT , Ġhalf Way Action : Ġ() Ġ-> ĠUnit Ġ= Ġ{ Ġ}) Ġ{ Ċĉ ĉ var Ġis Transition Started Ġ= Ġfalse Ċĉ ĉ end Guide line Anim Value Ġ= Ġto Ċĉ ĉ Value Animator . of Float ( from , Ġto ). apply Ġ{ Ċĉĉ ĉ duration Ġ= ĠD URATION _ GUID EL INE _ PERCENT AGE _ ANIM Ċĉĉ ĉ // Ġset Ġduration Ċĉĉ ĉ interpol ator Ġ= ĠAnim Consts . Interpolator . AC CELER ATE _ DE CELER ATE Ċĉĉ ĉ // Ġset Ġinterpol ator Ġand Ġ Ġupdate Listener Ġto Ġget Ġthe Ġanimated Ġvalue Ċĉĉ ĉ add Update Listener Ġ{ Ċĉĉĉ ĉ val Ġrunning Value Ġ= Ġanimated Value Ġas ĠFloat Ċĉĉĉ ĉ val Ġnew LayoutParams Ġ= Ġce iling Guide line . layout Params Ġas ĠConstraint Layout . LayoutParams Ċĉĉĉ ĉ new LayoutParams . guide Percent Ġ= Ġrunning Value Ċĉĉĉ ĉ ce iling Guide line . layout Params Ġ= Ġnew LayoutParams Ċĉĉĉ ĉ if Ġ(! is Transition Started Ġ&& Ġcurrent Play Time Ġ>= Ġduration Ġ/ Ġ 2 ) Ġ{ Ċĉĉĉĉ ĉ is Transition Started Ġ= Ġtrue Ċĉĉĉĉ ĉ half Way Action . invoke () Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉĉ ĉ with End Action Ġ{ Ċĉĉĉ ĉ end Guide line Anim Value Ġ= Ġ- 1 F Ċĉĉ ĉ } Ċĉĉ ĉ start () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġshow Not En ough Kin ( with Animation : ĠBoolean ) Ġ{ Ċĉ ĉ if Ġ( with Animation ) Ġ{ Ċĉĉ ĉ animate Guide line Percentage ( getCurrent Guide line Percentage (), ĠGUID EL INE _ PERCENT AGE _ NOT _ EN OU GH _ K IN ) Ġ{ Ċĉĉĉ ĉ show Not En ough Kin Fragment () Ċĉĉ ĉ } Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ val Ġnew LayoutParams Ġ= Ġce iling Guide line . layout Params Ġas ĠConstraint Layout . LayoutParams Ċĉĉ ĉ new LayoutParams . guide Percent Ġ= ĠGUID EL INE _ PERCENT AGE _ NOT _ EN OU GH _ K IN Ċĉĉ ĉ ce iling Guide line . layout Params Ġ= Ġnew LayoutParams Ċĉĉ ĉ show Not En ough Kin Fragment () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġshow Not En ough Kin Fragment () Ġ{ Ċĉ ĉ Not En ough Kin Fragment . newInstance ( this @ E co system Activity ). apply Ġ{ Ċĉĉ ĉ replace Fragment ( R . id . fragment _ frame , Ġthis , Ċĉĉĉĉ ĉ tag Ġ= ĠE CO SYSTEM _ NOT _ EN OU GH _ K IN _ FRAGMENT _ TAG , Ċĉĉĉĉ ĉ custom Animation Ġ= Ġcustom Animation Ġ{ Ċĉĉĉĉĉ ĉ enter Ġ= ĠR . anim . k ine co system _ fade _ in Ċĉĉĉĉĉ ĉ exit Ġ= ĠR . anim . k ine co system _ fade _ out Ċĉĉĉĉĉ ĉ pop Exit Ġ= ĠR . anim . k ine co system _ fade _ out Ċĉĉĉĉĉ ĉ pop Enter Ġ= ĠR . anim . k ine co system _ fade _ in Ċĉĉĉĉ ĉ }, Ġce iling Guide line Ġ= ĠGUID EL INE _ PERCENT AGE _ NOT _ EN OU GH _ K IN ) Ċĉĉ ĉ setVisible Screen ( NOT _ EN OU GH _ K IN ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġnavigate To On boarding () Ġ{ Ċĉ ĉ On boarding Fragment . getInstance ( intent . extras , Ġthis ). apply Ġ{ Ċĉĉ ĉ replace Fragment ( R . id . fragment _ frame , Ġthis , ĠE CO SYSTEM _ ON BOARD ING _ FRAGMENT _ TAG ) Ċĉĉ ĉ setVisible Screen ( ON BOARD ING ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġnavigate To Market place ( custom Animation : ĠCustom Animation ) Ġ{ Ċĉ ĉ saved Market place Fragment Ġ?: ĠMarketplace Fragment . newInstance ( this ). apply Ġ{ Ċĉĉ ĉ replace Fragment ( R . id . fragment _ frame , Ġthis , Ċĉĉĉĉ ĉ tag Ġ= ĠE CO SYSTEM _ MARK ET PLACE _ FRAGMENT _ TAG , Ċĉĉĉĉ ĉ custom Animation Ġ= Ġcustom Animation ) Ċĉĉ ĉ setVisible Screen ( MARK ET PLACE ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġset Visible Screen ( id : ĠScreen Id ) Ġ{ Ċĉ ĉ eco system Presenter ?. visible Screen ( id ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġnavigate To Order History ( custom Animation : ĠCustom Animation , ĠaddTo Back Stack : ĠBoolean ) Ġ{ Ċĉ ĉ order History Fragment Ġ?: ĠOrder History Fragment . newInstance ( this ). apply Ġ{ Ċĉĉ ĉ replace Fragment ( R . id . fragment _ frame , Ġthis , Ċĉĉĉĉ ĉ tag Ġ= ĠE CO SYSTEM _ ORDER _ HISTORY _ FRAGMENT _ TAG , Ċĉĉĉĉ ĉ custom Animation Ġ= Ġcustom Animation , Ċĉĉĉĉ ĉ back Stack Name Ġ= Ġif Ġ( addTo Back Stack ) ĠMARK ET PLACE _ TO _ ORDER _ HISTORY Ġelse Ġnull , Ċĉĉĉĉ ĉ allow State Loss Ġ= Ġtrue ) Ċĉĉ ĉ setVisible Screen ( ORDER _ HISTORY ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġnavigate To Settings () Ġ{ Ċĉ ĉ val Ġsettings Fragment : ĠSettings Fragment Ġ= Ġsupport FragmentManager Ċĉĉĉ ĉ . find Fragment By Tag ( E CO SYSTEM _ SETTINGS _ FRAGMENT _ TAG ) Ġas ĠSettings Fragment ? Ċĉĉĉ ĉ ?: ĠSettings Fragment . newInstance ( this ) ĊĊĉ ĉ replace Fragment ( R . id . fragment _ frame , Ġsettings Fragment , Ċĉĉĉ ĉ tag Ġ= ĠE CO SYSTEM _ SETTINGS _ FRAGMENT _ TAG , Ċĉĉĉ ĉ custom Animation Ġ= Ġcustom Animation Ġ{ Ċĉĉĉĉ ĉ enter Ġ= ĠR . anim . k ine co system _ slide _ in _ right Ċĉĉĉĉ ĉ exit Ġ= ĠR . anim . k ine co system _ slide _ out _ left Ċĉĉĉĉ ĉ pop Enter Ġ= ĠR . anim . kin recovery _ slide _ in _ left Ċĉĉĉĉ ĉ pop Exit Ġ= ĠR . anim . k ine co system _ slide _ out _ right Ċĉĉĉ ĉ }, Ċĉĉĉ ĉ back Stack Name Ġ= ĠORDER _ HISTORY _ TO _ SETTINGS , Ċĉĉĉ ĉ allow State Loss Ġ= Ġtrue ) Ċĉ ĉ setVisible Screen ( SETTINGS ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġclose () Ġ{ Ċĉ ĉ if Ġ(! is Closing ) Ġ{ Ċĉĉ ĉ is Closing Ġ= Ġtrue Ċĉĉ ĉ run Exit Animation () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġrun Enter Animation () Ġ{ Ċĉ ĉ val Ġanim ator Set Ġ= ĠAn imator Set () Ċĉ ĉ var Ġcontent Slide : ĠValue Animator ? Ġ= Ġnull Ċĉ ĉ var ĠbackgroundColor Fade : ĠObject Animator ? Ġ= Ġnull Ċĉ ĉ container Frame . apply Ġ{ Ċĉĉ ĉ backgroundColor Fade Ġ= ĠObject Animator . of Int ( background , ĠAnim Consts . Property . ALPHA , ĠAnim Consts . Value . BG _ COLOR _ ALPHA _ 0 , ĠAnim Consts . Value . BG _ COLOR _ ALPHA _ 2 5 5 ). apply Ġ{ Ċĉĉĉ ĉ duration Ġ= ĠAnim Consts . Duration . CLOSE _ ANIM Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ content Frame . let Ġ{ Ċĉĉ ĉ content Slide Ġ= ĠValue Animator . of Int ( Device Utils . get Screen Height (), Ġit . top ). apply Ġ{ Ċĉĉĉ ĉ duration Ġ= ĠAnim Consts . Duration . SL IDE _ ANIM Ċĉĉĉ ĉ interpol ator Ġ= ĠAnim Consts . Interpolator . DE CELER ATE Ċĉĉĉ ĉ add Update Listener Ġ{ Ġvalue Animator Ġ-> Ċĉĉĉĉ ĉ it . y Ġ= Ġ( value Animator . animated Value Ġas ĠInt ). toFloat () Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ if Ġ( content Slide Ġ!= Ġnull Ġ&& ĠbackgroundColor Fade Ġ!= Ġnull ) Ġ{ Ċĉĉ ĉ anim ator Set . play To gether ( content Slide , ĠbackgroundColor Fade ) Ċĉĉ ĉ anim ator Set . duration Ġ= ĠAnim Consts . Duration . CLOSE _ ANIM Ċĉĉ ĉ anim ator Set . start () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġrun Exit Animation () Ġ{ Ċĉ ĉ val Ġanim ator Set Ġ= ĠAn imator Set () Ċĉ ĉ var Ġcontent Slide : ĠValue Animator ? Ġ= Ġnull Ċĉ ĉ var ĠbackgroundColor Fade : ĠObject Animator ? Ġ= Ġnull Ċĉ ĉ content Frame . let Ġ{ Ċĉĉ ĉ content Slide Ġ= ĠValue Animator . of Int ( it . top , ĠDevice Utils . get Screen Height ()). apply Ġ{ Ċĉĉĉ ĉ add Update Listener Ġ{ Ġvalue Animator Ġ-> Ċĉĉĉĉ ĉ it . y Ġ= Ġ( value Animator . animated Value Ġas ĠInt ). toFloat () Ċĉĉĉ ĉ } Ċĉĉĉ ĉ duration Ġ= ĠAnim Consts . Duration . SL IDE _ ANIM Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ container Frame . apply Ġ{ Ċĉĉ ĉ backgroundColor Fade Ġ= ĠObject Animator . of Int ( background , ĠAnim Consts . Property . ALPHA , ĠAnim Consts . Value . BG _ COLOR _ ALPHA _ 2 5 5 , ĠAnim Consts . Value . BG _ COLOR _ ALPHA _ 0 ). apply Ġ{ Ċĉĉĉ ĉ duration Ġ= ĠAnim Consts . Duration . CLOSE _ ANIM Ċĉĉĉ ĉ interpol ator Ġ= ĠAnim Consts . Interpolator . DE CELER ATE Ċĉĉĉ ĉ with End Action Ġ{ Ċĉĉĉĉ ĉ finish () Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ if Ġ( content Slide Ġ!= Ġnull Ġ&& ĠbackgroundColor Fade Ġ!= Ġnull ) Ġ{ Ċĉĉ ĉ anim ator Set . play To gether ( content Slide , ĠbackgroundColor Fade ) Ċĉĉ ĉ anim ator Set . duration Ġ= ĠAnim Consts . Duration . CLOSE _ ANIM Ċĉĉ ĉ anim ator Set . start () Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Back Pressed () Ġ{ Ċĉ ĉ eco system Presenter ?. back Button Pressed () Ċ ĉ } ĊĊ ĉ override Ġfun Ġnavigate Back () Ġ{ Ċĉ ĉ val Ġcount Ġ= Ġsupport FragmentManager . back Stack Entry Count Ċĉ ĉ if Ġ( count Ġ== Ġ 0 ) Ġ{ Ċĉĉ ĉ val Ġcurrent Fragment Ġ= ĠgetCurrent Fragment () Ċĉĉ ĉ when Ġ( current Fragment ) Ġ{ Ċĉĉĉ ĉ is ĠOrder History Fragment Ġ-> Ġ{ Ċĉĉĉĉ ĉ navigate To Market place ( custom Animation Ġ{ Ċĉĉĉĉĉ ĉ enter Ġ= ĠR . anim . k ine co system _ slide _ in _ left Ċĉĉĉĉĉ ĉ exit Ġ= ĠR . anim . k ine co system _ slide _ out _ right Ċĉĉĉĉ ĉ }) Ċĉĉĉ ĉ } Ċĉĉĉ ĉ is ĠMarketplace Fragment Ġ-> Ġ{ Ċĉĉĉĉ ĉ close () Ċĉĉĉ ĉ } Ċĉĉĉ ĉ else Ġ-> Ġclose () Ċĉĉ ĉ } Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ val Ġentry Ġ= Ġsupport FragmentManager . get Back Stack Entry At ( count Ġ- Ġ 1 ) Ċĉĉ ĉ when Ġ( entry . name ) Ġ{ Ċĉĉĉ ĉ MARK ET PLACE _ TO _ ORDER _ HISTORY Ġ-> Ġ{ Ċĉĉĉĉ ĉ // ĠAfter Ġpressing Ġback Ġfrom ĠOrder History , Ġshould Ġput Ġthe Ġattrs Ġagain . Ċĉĉĉĉ ĉ // ĠThis Ġis Ġthe Ġonly Ġfragment Ġthat Ġshould Ġset Ġpresenter Ġagain Ġon Ġback . Ċĉĉĉĉ ĉ saved Market place Fragment ?. let Ġ{ Ġit . navigator Ġ= Ġthis Ġ} Ċĉĉĉĉĉĉ ĉ ?: Ġnavigate To Market place ( custom Animation Ġ{ Ċĉĉĉĉĉĉĉ ĉ enter Ġ= ĠR . anim . k ine co system _ slide _ in _ left Ċĉĉĉĉĉĉĉ ĉ exit Ġ= ĠR . anim . k ine co system _ slide _ out _ right Ċĉĉĉĉĉĉ ĉ }) Ċĉĉĉĉ ĉ support FragmentManager . pop Back Stack Immediate () Ċĉĉĉĉ ĉ setVisible Screen ( MARK ET PLACE ) Ċĉĉĉ ĉ } Ċĉĉĉ ĉ ORDER _ HISTORY _ TO _ SETTINGS Ġ-> Ġ{ Ċĉĉĉĉ ĉ // ĠAfter Ġpressing Ġback Ġfrom ĠSettings , Ġshould Ġput Ġthe Ġattrs Ġagain . Ċĉĉĉĉ ĉ // ĠThis Ġis Ġthe Ġonly Ġfragment Ġthat Ġshould Ġset Ġpresenter Ġagain Ġon Ġback . Ċĉĉĉĉ ĉ order History Fragment ?. let Ġ{ Ġit . navigator Ġ= Ġthis Ġ} Ċĉĉĉĉĉĉ ĉ ?: Ġnavigate To Order History ( custom Animation Ġ{ Ċĉĉĉĉĉĉĉ ĉ enter Ġ= ĠR . anim . k ine co system _ slide _ in _ left Ċĉĉĉĉĉĉĉ ĉ exit Ġ= ĠR . anim . k ine co system _ slide _ out _ right Ċĉĉĉĉĉĉ ĉ }, ĠaddTo Back Stack Ġ= Ġfalse ) Ċĉĉĉĉ ĉ support FragmentManager . pop Back Stack Immediate () Ċĉĉĉĉ ĉ setVisible Screen ( ORDER _ HISTORY ) Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun ĠgetCurrent Fragment () Ġ= Ġsupport FragmentManager . find Fragment ById ( R . id . fragment _ frame ) ĊĊ ĉ override Ġfun Ġon Destroy () Ġ{ Ċĉ ĉ eco system Presenter ?. on Detach () Ċĉ ĉ super . on Destroy () Ċ ĉ } ĊĊ ĉ override Ġfun Ġfinish () Ġ{ Ċĉ ĉ super . finish () Ċĉ ĉ override Pending Transition ( 0 , Ġ 0 ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Activity Result ( request Code : ĠInt , ĠresultCode : ĠInt , Ġdata : ĠIntent ?) Ġ{ Ċĉ ĉ super . on Activity Result ( request Code , ĠresultCode , Ġdata ) Ċĉ ĉ get Visible Fragment ()?. on Activity Result ( request Code , ĠresultCode , Ġdata ) Ċ ĉ } ĊĊ ĉ private Ġfun Ġget Visible Fragment (): ĠFragment ? Ġ{ Ċĉ ĉ support FragmentManager . fragments ?. let Ġ{ Ġfragments Ġ-> Ċĉĉ ĉ fragments . forEach Ġ{ Ġfragment Ġ-> Ċĉĉĉ ĉ if Ġ( fragment . isVisible ) Ċĉĉĉĉ ĉ return Ġfragment Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ return Ġnull Ċ ĉ } ĊĊ ĉ private Ġfun ĠgetCurrent Guide line Percentage () Ġ= Ġ( ce iling Guide line . layout Params Ġas ĠConstraint Layout . LayoutParams ). guide Percent ĊĊ ĉ comp anion Ġobject Ġ{ Ċĉ ĉ private Ġconst Ġval ĠGUID EL INE _ PERCENT AGE _ DEFAULT Ġ= Ġ 0 . 2 F Ċĉ ĉ private Ġconst Ġval ĠGUID EL INE _ PERCENT AGE _ NOT _ EN OU GH _ K IN Ġ= Ġ 0 . 3 5 F Ċĉ ĉ private Ġconst Ġval ĠD URATION _ GUID EL INE _ PERCENT AGE _ ANIM Ġ= Ġ 4 0 0 L ĊĊĉ ĉ // ĠF rag ments Ġtags Ċĉ ĉ private Ġconst Ġval ĠE CO SYSTEM _ ON BOARD ING _ FRAGMENT _ TAG Ġ= Ġ" eco system _ on boarding _ fragment _ tag " Ċĉ ĉ private Ġconst Ġval ĠE CO SYSTEM _ MARK ET PLACE _ FRAGMENT _ TAG Ġ= Ġ" eco system _ marketplace _ fragment _ tag " Ċĉ ĉ private Ġconst Ġval ĠE CO SYSTEM _ ORDER _ HISTORY _ FRAGMENT _ TAG Ġ= Ġ" eco system _ order _ history _ fragment _ tag " Ċĉ ĉ private Ġconst Ġval ĠE CO SYSTEM _ SETTINGS _ FRAGMENT _ TAG Ġ= Ġ" eco system _ settings _ fragment _ tag " Ċĉ ĉ private Ġconst Ġval ĠE CO SYSTEM _ NOT _ EN OU GH _ K IN _ FRAGMENT _ TAG Ġ= Ġ" eco system _ not _ en ough _ kin _ fragment _ tag " ĊĊĉ ĉ // ĠBack Ġstack Ġname Ċĉ ĉ private Ġconst Ġval ĠMARK ET PLACE _ TO _ ORDER _ HISTORY Ġ= Ġ" marketplace _ to _ order _ history " Ċĉ ĉ private Ġconst Ġval ĠORDER _ HISTORY _ TO _ SETTINGS Ġ= Ġ" order _ history _ to _ settings " Ċ ĉ } Ċ } Ċ