Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.84 KB | None | 0 0
  1.         Observable.fromIterable(predictions)
  2.                 .flatMap {
  3.                     Observable.zip(
  4.                             Observable.just(it.prediction),
  5.                             MainApplication.mApiInterface.getWeather(it.prediction.terms!![0]!!.value!!, WEATHER_APP_KEY),//Здесь делаю запрос
  6.                             BiFunction<PredictionItem, WeatherResponse, WeatherModel> { t1, t2 ->
  7.                                 WeatherModel(t2, t1)
  8.                             })
  9.                 }
  10.                 .toList()
  11.                 .subscribeOn(Schedulers.io())
  12.                 .observeOn(AndroidSchedulers.mainThread())
  13.                 .subscribe({ result ->
  14.                     mAdapter.onUpdateItems(result)
  15.                 }, { error ->
  16.                     Log.d("TAG", "Error: $error")
  17.                 })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement