use of androidx.lifecycle.MutableLiveData in project CloudReader by youlookwhat.
the class FilmViewModel method getComingFilm.
public MutableLiveData<ComingFilmBean> getComingFilm() {
final MutableLiveData<ComingFilmBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getMtimeTicketServer().getComingFilm().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<ComingFilmBean>() {
@Override
public void accept(ComingFilmBean bookBean) throws Exception {
data.setValue(bookBean);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
use of androidx.lifecycle.MutableLiveData in project CloudReader by youlookwhat.
the class FilmViewModel method getHotFilm.
public MutableLiveData<MtimeFilmeBean> getHotFilm() {
final MutableLiveData<MtimeFilmeBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getMtimeTicketServer().getHotFilm().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<MtimeFilmeBean>() {
@Override
public void accept(MtimeFilmeBean bookBean) throws Exception {
data.setValue(bookBean);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
use of androidx.lifecycle.MutableLiveData in project CloudReader by youlookwhat.
the class OneViewModel method getComingSoon.
public MutableLiveData<HotMovieBean> getComingSoon() {
final MutableLiveData<HotMovieBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getDouBanService().getComingSoon(mStart, mCount).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<HotMovieBean>() {
@Override
public void accept(HotMovieBean hotMovieBean) throws Exception {
data.setValue(hotMovieBean);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
use of androidx.lifecycle.MutableLiveData in project CloudReader by youlookwhat.
the class GankViewModel method loadGankData.
public MutableLiveData<GankIoDataBean> loadGankData() {
final MutableLiveData<GankIoDataBean> data = new MutableLiveData<>();
mModel.setData("GanHuo", mType, mPage, 20);
mModel.getGankIoData(new RequestImpl() {
@Override
public void loadSuccess(Object object) {
data.setValue(DataUtil.getTrueData((GankIoDataBean) object));
}
@Override
public void loadFailed() {
if (mPage > 1) {
mPage--;
}
data.setValue(null);
}
@Override
public void addSubscription(Disposable disposable) {
addDisposable(disposable);
}
});
return data;
}
use of androidx.lifecycle.MutableLiveData in project CloudReader by youlookwhat.
the class ArticleListViewModel method getCollectList.
/**
* ζηζΆθ
*/
public MutableLiveData<HomeListBean> getCollectList() {
final MutableLiveData<HomeListBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getWanAndroidServer().getCollectList(mPage).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<HomeListBean>() {
@Override
public void accept(HomeListBean bean) throws Exception {
data.setValue(bean);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (mPage > 0) {
mPage--;
}
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
Aggregations