/* Ċ Ġ* ĠCopyright Ġ 2 0 2 0 ĠAC IN Q ĠSAS Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġfr . ac in q . phoenix . init wallet Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . activity . add Callback Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . view pager 2 . adapter . Fragment State Adapter Ċ import Ġandroidx . view pager 2 . widget . ViewPager 2 Ċ import Ġfr . ac in q . phoenix . Base Fragment Ċ import Ġfr . ac in q . phoenix . R Ċ import Ġfr . ac in q . phoenix . databinding . Fragment Ft ue Backup Binding Ċ import Ġfr . ac in q . phoenix . databinding . Fragment Ft ue Binding Ċ import Ġfr . ac in q . phoenix . databinding . Fragment Ft ue Lightning Binding Ċ import Ġfr . ac in q . phoenix . databinding . Fragment Ft ue Welcome Binding Ċ import Ġfr . ac in q . phoenix . utils . Binding Helpers Ċ import Ġfr . ac in q . phoenix . utils . Constants Ċ import Ġfr . ac in q . phoenix . utils . Converter Ċ import Ġfr . ac in q . phoenix . utils . Prefs Ċ import Ġorg . slf 4 j . Logger Ċ import Ġorg . slf 4 j . LoggerFactory ĊĊ Ċ class ĠF t ue Fragment Ġ: ĠBase Fragment ( st ay IfNot Started Ġ= Ġtrue ) Ġ{ ĊĊĠ Ġprivate Ġlateinit Ġvar Ġm Binding : ĠFragment Ft ue Binding ĊĠ Ġprivate Ġlateinit Ġvar Ġadapter : ĠF t ue View Adapter ĊĊĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView Ġ{ ĊĠĠĠ Ġm Binding Ġ= ĠFragment Ft ue Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġm Binding . lifecycle Owner Ġ= Ġthis ĊĠĠĠ Ġm Binding . view Pager . is User Input Enabled Ġ= Ġfalse ĊĠĠĠ Ġm Binding . view Pager . isEnabled Ġ= Ġfalse ĊĠĠĠ Ġadapter Ġ= ĠF t ue View Adapter ( this ). apply Ġ{ ĊĠĠĠĠĠ Ġm Binding . view Pager . adapter Ġ= Ġthis ĊĠĠĠĠĠ Ġm Binding . view Pager . register On Page Change Callback ( object Ġ: ĠView Pager 2 . On Page Change Callback () Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġon Page Selected ( position : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġsuper . on Page Selected ( position ) ĊĠĠĠĠĠĠĠĠĠ Ġm Binding . indicators . text Ġ= ĠgetString ( when Ġ( position ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠ 0 Ġ-> ĠR . string . ft ue __ bullet _ 1 ĊĠĠĠĠĠĠĠĠĠĠĠĠ 1 Ġ-> ĠR . string . ft ue __ bullet _ 2 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> ĠR . string . ft ue __ bullet _ 3 ĊĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġm Binding . root ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠonStart () Ġ{ ĊĠĠĠ Ġsuper . onStart () ĊĠĠĠ Ġactivity ?. on Back Pressed Dispatcher ?. add Callback ( this ) Ġ{ ĊĠĠĠĠĠ Ġif Ġ( m Binding . view Pager . currentItem Ġ== Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlog . debug (" back Ġbutton Ġdisabled ") ĊĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġm Binding . view Pager . currentItem Ġ= Ġm Binding . view Pager . currentItem Ġ- Ġ 1 ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġgo To Page 2 () Ġ{ ĊĠĠĠ Ġm Binding . view Pager . currentItem Ġ= Ġ 1 ĊĠ Ġ} ĊĊĠ Ġfun Ġgo To Page 3 () Ġ{ ĊĠĠĠ Ġm Binding . view Pager . currentItem Ġ= Ġ 2 ĊĠ Ġ} ĊĊĠ Ġfun Ġleave () Ġ{ ĊĠĠĠ Ġcontext ?. let Ġ{ ĊĠĠĠĠĠ ĠP refs . set Show FT UE ( it , Ġfalse ) ĊĠĠĠĠĠ Ġfind Nav Controller (). navigate ( R . id . action _ ft ue _ to _ init wallet ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ private Ġclass ĠF t ue View Adapter ( fragment : ĠFragment ) Ġ: ĠFragment State Adapter ( fragment ) Ġ{ ĊĠ Ġoverride Ġfun ĠgetItem Count () Ġ= Ġ 3 ĊĊĠ Ġoverride Ġfun Ġcreate Fragment ( position : ĠInt ): ĠFragment Ġ{ ĊĠĠĠ Ġreturn Ġwhen Ġ( position ) Ġ{ ĊĠĠĠĠĠĠ 0 Ġ-> ĠF t ue Welcome Fragment () ĊĠĠĠĠĠĠ 1 Ġ-> ĠF t ue Lightning Fragment () ĊĠĠĠĠĠĠ 2 Ġ-> ĠF t ue Backup Fragment () ĊĠĠĠĠĠ Ġelse Ġ-> ĠF t ue Welcome Fragment () ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ class ĠF t ue Welcome Fragment Ġ: ĠFragment () Ġ{ ĊĠ Ġprivate Ġlateinit Ġvar Ġm Binding : ĠFragment Ft ue Welcome Binding ĊĠ Ġval Ġlog : ĠLogger Ġ= ĠLoggerFactory . getLogger ( this :: class . java ) ĊĊĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView Ġ{ ĊĠĠĠ Ġm Binding Ġ= ĠFragment Ft ue Welcome Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġm Binding . lifecycle Owner Ġ= Ġthis ĊĠĠĠ Ġreturn Ġm Binding . root ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠ Ġm Binding . next Button . setOnClickListener Ġ{ Ġ( parent Fragment Ġas ? ĠF t ue Fragment )?. goTo Page 2 () Ġ} ĊĠ Ġ} Ċ } Ċ Ċ class ĠF t ue Lightning Fragment Ġ: ĠFragment () Ġ{ ĊĠ Ġprivate Ġlateinit Ġvar Ġm Binding : ĠFragment Ft ue Lightning Binding ĊĠ Ġval Ġlog : ĠLogger Ġ= ĠLoggerFactory . getLogger ( this :: class . java ) ĊĊĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView Ġ{ ĊĠĠĠ Ġm Binding Ġ= ĠFragment Ft ue Lightning Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġm Binding . lifecycle Owner Ġ= Ġthis ĊĠĠĠ Ġreturn Ġm Binding . root ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠ Ġval Ġpay To Open Settings Ġ= Ġ( parent Fragment Ġas ? ĠF t ue Fragment )?. app Context ()?. pay To Open Settings ?. value ĊĠĠĠ Ġval Ġpretty Pay To Open Percent Fee Ġ= Ġpay To Open Settings ?. let Ġ{ ĠString . format ("% . 2 f ", Ġ 1 0 0 Ġ* Ġ( it . fee Percent )) Ġ} Ġ?: ĠgetString ( R . string . utils _ unknown ) ĊĠĠĠ Ġval Ġpretty Pay To Open Min Fee Ġ= Ġpay To Open Settings ?. let Ġ{ ĠConverter . print Amount Pretty ( it . min Fee , Ġrequire Context (), Ġwith Unit Ġ= Ġtrue ) Ġ} Ġ?: ĠgetString ( R . string . utils _ unknown ) ĊĠĠĠ Ġm Binding . body . text Ġ= ĠConverter . html ( getString ( R . string . ft ue __ pay _ to _ open __ body , Ġpretty Pay To Open Percent Fee , Ġpretty Pay To Open Min Fee )) ĊĠĠĠ Ġm Binding . next Button . setOnClickListener Ġ{ Ġ( parent Fragment Ġas ? ĠF t ue Fragment )?. goTo Page 3 () Ġ} ĊĠ Ġ} Ċ } Ċ Ċ class ĠF t ue Backup Fragment Ġ: ĠFragment () Ġ{ ĊĠ Ġprivate Ġlateinit Ġvar Ġm Binding : ĠFragment Ft ue Backup Binding ĊĠ Ġval Ġlog : ĠLogger Ġ= ĠLoggerFactory . getLogger ( this :: class . java ) ĊĊĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView Ġ{ ĊĠĠĠ Ġm Binding Ġ= ĠFragment Ft ue Backup Binding . inflate ( in flater , Ġcontainer , Ġfalse ) ĊĠĠĠ Ġm Binding . lifecycle Owner Ġ= Ġthis ĊĠĠĠ Ġreturn Ġm Binding . root ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠ Ġm Binding . finish Button . setOnClickListener Ġ{ Ġ( parent Fragment Ġas ? ĠF t ue Fragment )?. leave () Ġ} ĊĠ Ġ} Ċ } Ċ