Search in sources :

Example 1 with MtimeFilmeBean

use of com.example.jingbin.cloudreader.bean.MtimeFilmeBean 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;
}
Also used : Disposable(io.reactivex.disposables.Disposable) MutableLiveData(androidx.lifecycle.MutableLiveData) MtimeFilmeBean(com.example.jingbin.cloudreader.bean.MtimeFilmeBean)

Aggregations

MutableLiveData (androidx.lifecycle.MutableLiveData)1 MtimeFilmeBean (com.example.jingbin.cloudreader.bean.MtimeFilmeBean)1 Disposable (io.reactivex.disposables.Disposable)1