提交 b84d0c66 编写于 作者: J jessyan

Improve BasePresenter and UserPresenter

上级 b1af36f4
......@@ -52,25 +52,23 @@ import me.jessyan.rxerrorhandler.handler.RetryWithDelay;
*/
@ActivityScope
public class UserPresenter extends BasePresenter<UserContract.Model, UserContract.View> {
private RxErrorHandler mErrorHandler;
private AppManager mAppManager;
private Application mApplication;
private List<User> mUsers;
private RecyclerView.Adapter mAdapter;
@Inject
RxErrorHandler mErrorHandler;
@Inject
AppManager mAppManager;
@Inject
Application mApplication;
@Inject
List<User> mUsers;
@Inject
RecyclerView.Adapter mAdapter;
private int lastUserId = 1;
private boolean isFirst = true;
private int preEndIndex;
@Inject
public UserPresenter(UserContract.Model model, UserContract.View rootView, RxErrorHandler handler
, AppManager appManager, Application application, List<User> list, RecyclerView.Adapter adapter) {
super(model, rootView);
this.mApplication = application;
this.mErrorHandler = handler;
this.mAppManager = appManager;
this.mUsers = list;
this.mAdapter = adapter;
public UserPresenter() {
}
/**
......
......@@ -30,6 +30,9 @@ import com.trello.rxlifecycle2.RxLifecycle;
import org.simple.eventbus.EventBus;
import javax.inject.Inject;
import io.reactivex.annotations.Nullable;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
......@@ -47,8 +50,11 @@ import io.reactivex.functions.Action;
public class BasePresenter<M extends IModel, V extends IView> implements IPresenter, LifecycleObserver {
protected final String TAG = this.getClass().getSimpleName();
protected CompositeDisposable mCompositeDisposable;
protected M mModel;
@Inject
@Nullable
protected M mModel;//如果当前 Presenter 不需要处理数据, Model 可以为 null
@Inject
@Nullable
protected V mRootView;
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册