Search in sources :

Example 16 with MutableLiveData

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

Example 17 with MutableLiveData

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

Example 18 with MutableLiveData

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

Example 19 with MutableLiveData

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

Example 20 with MutableLiveData

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

Aggregations

MutableLiveData (androidx.lifecycle.MutableLiveData)25 Disposable (io.reactivex.disposables.Disposable)14 Test (org.junit.Test)6 GankIoDataBean (com.example.jingbin.cloudreader.bean.GankIoDataBean)3 AudioButton (org.odk.collect.android.audio.AudioButton)3 AudioVideoImageTextLabel (org.odk.collect.android.formentry.questions.AudioVideoImageTextLabel)3 RecordingSession (org.odk.collect.audiorecorder.recording.RecordingSession)3 Handler (android.os.Handler)2 Pair (android.util.Pair)2 CoinBean (com.example.jingbin.cloudreader.bean.CoinBean)2 BaseResultBean (com.example.jingbin.cloudreader.bean.wanandroid.BaseResultBean)2 HomeListBean (com.example.jingbin.cloudreader.bean.wanandroid.HomeListBean)2 RequestImpl (com.example.jingbin.cloudreader.http.RequestImpl)2 File (java.io.File)2 FormEntryPrompt (org.javarosa.form.api.FormEntryPrompt)2 Intent (android.content.Intent)1 ServiceInfo (android.content.pm.ServiceInfo)1 Drawable (android.graphics.drawable.Drawable)1 AutofillServiceInfo (android.service.autofill.AutofillServiceInfo)1 AppPreference (com.android.settingslib.widget.AppPreference)1