Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.oende.futbolapps.main
- import com.oende.futbolapps.api.TheSportDBApi
- import com.oende.futbolapps.api.ApiRepository
- import com.google.gson.Gson
- import com.oende.futbolapps.model.NextMatchResponse
- import org.jetbrains.anko.doAsync
- import org.jetbrains.anko.uiThread
- class NextMatchPresenter(private val view: NextMatchView,
- private val apiRepository: ApiRepository,
- private val gson: Gson) {
- fun getNextMatchList() {
- view.showLoading()
- doAsync {
- val data = gson.fromJson(apiRepository
- .doRequest(TheSportDBApi.getUpcomingMatch()),
- NextMatchResponse::class.java
- )
- uiThread {
- view.hideLoading()
- view.showNextMatchList(data.events)
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment