package Ġcom . k em al at li . tech challenge . features . login Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġcom . air bnb . mv rx . Base Mv Rx Fragment Ċ import Ġcom . air bnb . mv rx . activity ViewModel Ċ import Ġcom . air bnb . mv rx . with State Ċ import Ġcom . k em al at li . tech challenge . databinding . Fragment Login Binding Ċ Ċ class ĠLogin Fragment : ĠBase Mv Rx Fragment () Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġbinding : Fragment Login Binding ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval ĠviewModel : Login ViewModel Ġby Ġactivity ViewModel () ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠFragment Login Binding . inflate ( layout Inflater ) ĊĠĠĠĠĠĠĠ Ġbinding ?. lifecycle Owner Ġ= Ġview Lifecycle Owner ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding ?. root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġ// ĠSet Ġinitial Ġbinding Ġdata ĊĠĠĠĠĠĠĠ Ġbinding ?. view model Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ Ġbinding ?. execute Pending Bindings () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġinvalidate (): Unit Ġ= Ġwith State ( viewModel ){ ĊĠĠĠĠĠĠĠ Ġ// ĠChange Ġbound Ġdata Ġwhenever Ġview model Ġstate Ġchanges ĊĠĠĠĠĠĠĠ Ġbinding ?. state Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġbinding ?. execute Pending Bindings () ĊĠĠĠ Ġ} Ċ Ċ }