Commit ece5e4f5 by luofan

280网络请求增加可选择释放功能

parent 97a01628
......@@ -40,7 +40,6 @@ public abstract class BasePresenter<V> {
* @param consumer
* @return
*/
public <M> Observer<M> baseObserver(final Consumer<? super M> consumer) {
return new Observer<M>() {
@Override
......@@ -72,6 +71,41 @@ public abstract class BasePresenter<V> {
}
/**
* 创建观察者
*
* @param consumer
* @return
*/
public <M> Observer<M> baseObserverNotDisposable(final Consumer<? super M> consumer) {
return new Observer<M>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(M o) {
ProgressUtil.stopLoad();
try {
consumer.accept(o);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable e) {
ProgressUtil.stopLoad();
processException(e);
LogUtils.e("requestError: "+e.toString());
}
@Override
public void onComplete() {
}
};
}
/**
* 创建带错误的观察者
*
* @param consumer
......
......@@ -355,12 +355,13 @@ public class SopLocalActivity extends BaseActivity<SImplePresenter, ActivitySopL
/**
* 更新水印.
*
* @param bean
*/
private void waterMark(SopAddress bean) {
LogUtil.d("waterMark","走了");
Api.getService(OrderService.class).waterMark(bean).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(aBoolean -> LogUtil.d("waterMark","更新了")));
.subscribe(mPresenter.baseObserverNotDisposable(aBoolean -> {
}));
}
private void getLocation() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment