use of com.example.jingbin.cloudreader.bean.CoinBean in project CloudReader by youlookwhat.
the class CoinListViewModel method getCoinRank.
/**
* 积分排行榜
*/
public MutableLiveData<CoinBean> getCoinRank() {
final MutableLiveData<CoinBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getWanAndroidServer().getCoinRank(mPage).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<BaseResultBean<CoinBean>>() {
@Override
public void accept(BaseResultBean<CoinBean> bean) throws Exception {
if (bean != null && bean.getData() != null) {
data.setValue(bean.getData());
} else {
data.setValue(null);
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (mPage > 1) {
mPage--;
}
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
use of com.example.jingbin.cloudreader.bean.CoinBean in project CloudReader by youlookwhat.
the class CoinListViewModel method getCoinLog.
/**
* 我的积分
*/
public MutableLiveData<CoinBean> getCoinLog() {
final MutableLiveData<CoinBean> data = new MutableLiveData<>();
Disposable subscribe = HttpClient.Builder.getWanAndroidServer().getCoinLog(mPage).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<BaseResultBean<CoinBean>>() {
@Override
public void accept(BaseResultBean<CoinBean> bean) throws Exception {
if (bean != null && bean.getData() != null) {
data.setValue(bean.getData());
} else {
data.setValue(null);
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (mPage > 1) {
mPage--;
}
data.setValue(null);
}
});
addDisposable(subscribe);
return data;
}
Aggregations