Guest User

Untitled

a guest
Jan 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. data class Contact(val name:String, val phoneNum:String)
  2.  
  3. interface ContactsListsApi{
  4. fetchContacts(): Single<List<Contact>>
  5. }
  6. interface ContactsListsContract{
  7. interface View{
  8. fun showProgress()
  9. fun hideProgress()
  10. fun setData(contacts: List<Contact>)
  11. }
  12. interface Presenter{
  13. fun fetchContacts()
  14. }
  15. }
  16.  
  17. class ContactsListPresenter(val view: ContactsListsContract.View, val api:ContactsListsApi): ContactsListsContract.Presenter {
  18. override fun fetchContacts(){
  19. view.showProgress()
  20. fetchContacts()
  21. .subscribe{
  22. view.hideProgress()
  23. view.setData(it)
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment