package Ġio . github . well ing ton cost a . android work dev talk . app . list contacts Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . recyclerview . widget . Divider Item Decoration Ċ import Ġandroidx . recyclerview . widget . Linear LayoutManager Ċ import Ġio . github . well ing ton cost a . android work dev talk . R Ċ import Ġio . github . well ing ton cost a . android work dev talk . app . contact registration . Contact Registration Activity Ċ import Ġorg . k oin . android x . view model . ext . android . viewModel Ċ import Ġio . github . well ing ton cost a . android work dev talk . databinding . Activity List Contacts Binding Ġas ĠBinding Ċ Ċ class ĠList Contacts Activity Ġ: ĠHand lers , ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġbinding Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠData Binding Util . set ContentView < Binding >( this , ĠR . layout . activity _ list _ contacts ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby ĠviewModel < List Contacts ViewModel >() ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġthis ĊĠĠĠĠĠĠĠ Ġbinding . viewModel Ġ= ĠviewModel ĊĠĠĠĠĠĠĠ Ġbinding . handlers Ġ= Ġthis ĊĊĠĠĠĠĠĠĠ Ġsetup RecyclerView () ĊĠĠĠĠĠĠĠ Ġobserve Contacts () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Resume () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on Resume () ĊĠĠĠĠĠĠĠ ĠviewModel . load All () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup RecyclerView () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdivider Item Decoration Ġ= ĠDiv ider Item Decoration ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbinding . re cyclerView . context , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( binding . re cyclerView . layout Manager Ġas ĠLinearLayoutManager ). orientation ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġbinding . re cyclerView . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Item Decoration ( divider Item Decoration ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter Ġ= ĠList Contacts Adapter () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġobserve Contacts () Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel . contacts . observe ( this , ĠObserver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( binding . re cyclerView . adapter Ġas ĠList Contacts Adapter ). update List ( it ) ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġgo To Contact Registration Screen () Ġ{ ĊĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( this , ĠContact Registration Activity :: class . java )) ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ internal Ġinterface ĠHand lers Ġ{ ĊĊĠĠĠ Ġfun Ġgo To Contact Registration Screen () Ċ Ċ } Ċ