Created
September 18, 2018 07:02
-
-
Save markchristopherng/0f74eba14ac0dde1241e006dd98e8228 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PayBillActivity : BaseActivity() { | |
lateinit var payBillViewModel : PayBillViewModel | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_pay_bill) | |
payBillViewModel = getViewModel() | |
payBillViewModel.loadBills() | |
//Display bills | |
payBillViewModel.bills.observeNonNull { | |
displayBills(it) | |
} | |
//Display error & spinner | |
payBillViewModel.bills.state.observeEvent { | |
if ( it is StateLiveData.State.Error) { | |
displayError() | |
} | |
displaySpinner( it is StateLiveData.State.Loading) | |
} | |
} | |
fun displayBills(bills : List<SavedBill>) { | |
bills_textview.text = bills.toString() | |
} | |
fun displayError() { | |
} | |
fun displaySpinner(show : Boolean) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment