1
誰もが! 私はいくつか問題があります。私はRxJava/RxKotlin/RxAndroidの初心者ですが、いくつかの機能を理解していません。例:RxAndroidを使用してKotlin言語で観測可能なものをいくつかジップする方法
import rus.pifpaf.client.data.catalog.models.Category
import rus.pifpaf.client.data.main.MainRepository
import rus.pifpaf.client.data.main.models.FrontDataModel
import rus.pifpaf.client.data.product.models.Product
import rx.Observable
import rx.Single
import rx.lang.kotlin.observable
import java.util.*
class MainInteractor {
private var repository: MainRepository = MainRepository()
fun getFrontData() {
val cats = getCategories()
val day = getDayProduct()
val top = getTopProducts()
return Observable.zip(cats, day, top, MainInteractor::convert)
}
private fun getTopProducts(): Observable<List<Product>> {
return repository.getTop()
.toObservable()
.onErrorReturn{throwable -> ArrayList() }
}
private fun getDayProduct(): Observable<Product> {
return repository.getSingleProduct()
.toObservable()
.onErrorReturn{throwable -> Product()}
}
private fun getCategories(): Observable<List<Category>> {
return repository.getCategories()
.toObservable()
.onErrorReturn{throwable -> ArrayList() }
}
private fun convert(cats: List<Category>, product: Product, top: List<Product>): FrontDataModel {
}
}
その後、私が使用がMainInteractor :: Androidのスタジオが
![enter image description here](https://i.stack.imgur.com/Caoua.jpg)
次の私はバリアントの多くを試み、それが欲しいんか理解しようとした私に教えて変換するんです、成功はない。私を助けてください...最高の挨拶。