package Ġles . k asa . android . rest client sample Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġkotlinx . android . synt hetic . main . activity _ main .* Ċ import Ġles . k asa . android . rest client sample . databinding . Activity Main Binding Ċ import Ġles . k asa . android . rest client sample . model . Log Data Ċ import Ġorg . k oin . android x . view model . ext . android . viewModel Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby ĠviewModel < Main ViewModel >() ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġval Ġbinding : ĠActivity Main Binding Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġbinding . lifecycle Owner Ġ= Ġthis ĊĠĠĠĠĠĠĠ Ġbinding . view model Ġ= ĠviewModel ĊĊĠĠĠĠĠĠĠ Ġget Button . setOnClickListener Ġ{ ĠviewModel . get (" 2 0 2 0 0 2 2 2 "); Ġ} ĊĠĠĠĠĠĠĠ ĠgetAll Button . setOnClickListener Ġ{ ĠviewModel . getAll (); Ġ} ĊĠĠĠĠĠĠĠ Ġpost Button . setOnClickListener Ġ{ ĠviewModel . post ( Log Data (" 2 0 2 0 / 0 2 / 2 2 ", Ġ 1 2 , Ġfalse )); Ġ} ĊĠĠĠĠĠĠĠ Ġput Button . setOnClickListener Ġ{ ĠviewModel . put ( Log Data (" 2 0 2 0 / 0 2 / 2 2 ", Ġ 1 1 , Ġtrue )); Ġ} ĊĠĠĠĠĠĠĠ Ġdelete Button . setOnClickListener Ġ{ ĠviewModel . delete (" 2 0 2 0 0 2 2 3 ") Ġ} ĊĠĠĠ Ġ} Ċ } Ċ