package Ġorg . simple . clin ic . registration . name Ċ Ċ import Ġandroid . animation . Layout Transition Ċ import Ġandroid . content . Context Ċ import Ġandroid . util . Attribute Set Ċ import Ġandroid . view . View Ċ import Ġandroid . view . input method . Editor Info Ċ import Ġandroid . widget . Relative Layout Ċ import Ġcom . jak ew h art on . r xb ind ing 2 . view . Rx View Ċ import Ġcom . jak ew h art on . r xb ind ing 2 . widget . Rx TextView Ċ import Ġio . reactivex . Observable Ċ import Ġkotlinx . android . synt hetic . main . screen _ registration _ name . view .* Ċ import Ġorg . simple . clin ic . R Ċ import Ġorg . simple . clin ic . main . The Activity Ċ import Ġorg . simple . clin ic . bind Ui To Controller Ċ import Ġorg . simple . clin ic . registration . pin . Registration Pin Screen Key Ċ import Ġorg . simple . clin ic . router . screen . Screen Router Ċ import Ġorg . simple . clin ic . user . O ngo ing Registration Entry Ċ import Ġorg . simple . clin ic . widgets . Screen Destroyed Ċ import Ġorg . simple . clin ic . widgets . setText And Cursor Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠRegistration FullName Screen ( context : ĠContext , Ġattrs : ĠAttributeSet ) Ġ: ĠRelative Layout ( context , Ġattrs ) Ġ{ ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġscreen Router : ĠScreen Router ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġcontroller : ĠRegistration FullName Screen Controller ĊĊĠ Ġoverride Ġfun Ġon Finish Inf late () Ġ{ ĊĠĠĠ Ġsuper . on Finish Inf late () ĊĠĠĠ Ġif Ġ( isIn Edit Mode ) Ġ{ ĊĠĠĠĠĠ Ġreturn ĊĠĠĠ Ġ} ĊĠĠĠ ĠThe Activity . component . inject ( this ) ĊĊĠĠĠ Ġback Button . setOnClickListener Ġ{ ĊĠĠĠĠĠ Ġscreen Router . pop () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġbind Ui To Controller ( ĊĠĠĠĠĠĠĠ Ġui Ġ= Ġthis , ĊĠĠĠĠĠĠĠ Ġevents Ġ= ĠObservable . merge ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġscreen Creates (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Text Changes (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdone Click s () ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġcontroller Ġ= Ġcontroller , ĊĠĠĠĠĠĠĠ Ġscreen Dest ro ys Ġ= ĠRx View . det aches ( this ). map Ġ{ ĠScreen Destroyed () Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġcard View Content Layout . layout Transition . set Duration ( 2 0 0 ) ĊĠĠĠ Ġcard View Content Layout . layout Transition . set St agger ( Layout Transition . CHANGE _ AP PE AR ING , Ġ 0 ) ĊĠĠĠ Ġcard View Content Layout . layout Transition . set St agger ( Layout Transition . CHANGE _ DIS AP PE AR ING , Ġ 0 ) ĊĠĠĠ Ġcard View Content Layout . layout Transition . set St agger ( Layout Transition . CHANG ING , Ġ 0 ) ĊĊĠĠĠ Ġpost Ġ{ ĠfullName EditText . request Focus () Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġscreen Creates () Ġ= ĠObservable . just ( Registration FullName Screen Created ()) ĊĊĠ Ġprivate Ġfun Ġname Text Changes () Ġ= ĊĠĠĠĠĠ ĠRx TextView . text Changes ( fullName EditText ) ĊĠĠĠĠĠĠĠĠĠ Ġ. map ( CharSequence :: toString ) ĊĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . trim () Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ. map (:: Registration FullName TextChanged ) ĊĊĠ Ġprivate Ġfun Ġdone Click s () Ġ= ĊĠĠĠĠĠ ĠRx TextView ĊĠĠĠĠĠĠĠĠĠ Ġ. editor Actions ( fullName EditText ) Ġ{ Ġit Ġ== ĠEditor Info . IME _ ACTION _ DONE Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ ĠRegistration FullName Done Clicked () Ġ} ĊĊĠ Ġfun Ġpre Fill UserDetails ( ongo ing Entry : ĠO ngo ing Registration Entry ) Ġ{ ĊĠĠĠ ĠfullName EditText . setText And Cursor ( ongo ing Entry . fullName ) ĊĠ Ġ} ĊĊĠ Ġfun Ġshow Empty Name ValidationError () Ġ{ ĊĠĠĠ Ġvalidation Error TextView . visibility Ġ= ĠView . VISIBLE ĊĠĠĠ Ġvalidation Error TextView . text Ġ= Ġresources . getString ( R . string . registration name _ error _ empty _ name ) ĊĠ Ġ} ĊĊĠ Ġfun Ġhide ValidationError () Ġ{ ĊĠĠĠ Ġvalidation Error TextView . visibility Ġ= ĠView . GONE ĊĠ Ġ} ĊĊĠ Ġfun Ġopen Registration Pin Entry Screen () Ġ{ ĊĠĠĠ Ġscreen Router . push ( Registration Pin Screen Key ()) ĊĠ Ġ} Ċ } Ċ