wzgiceman / RxjavaRetrofitDemo-master

Retrofit+Rxjava+okhttp终极封装(Gson方案)
http://blog.csdn.net/column/details/13297.html
MIT License
1.06k stars 290 forks source link

ProgressSubscriber添加取消监听 #13

Closed yezizaiqiutian closed 7 years ago

yezizaiqiutian commented 7 years ago

ProgressSubscriber类中ProgressDialog取消监听中是否需要增加回调,这样在监听中就可以监听到取消事件


 private void initProgressDialog(boolean cancel) {
        Context context = mActivity.get();
        if (pd == null && context != null) {
            pd = new ProgressDialog(context);
            pd.setCancelable(cancel);
            if (cancel) {
                pd.setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialogInterface) {
                        if (mSubscriberOnNextListener.get() != null) {
                            mSubscriberOnNextListener.get().onCancel();
                        }
                        onCancleProgress();
                    }
                });
            }
        }
    }
wzgiceman commented 7 years ago

恩,是的,马上加上

yezizaiqiutian commented 7 years ago

嗯嗯,写的非常好,很受教~~