标签:mvp network ide 页面 isa networker bin shp activity
七的核心公用基类
BaseActivity
public abstract class BaseActivity extends RxAppCompatActivity implements BaseView {
...
}
1
2
3
BaseMvpActivity
public abstract class BaseMvpActivity<M extends BaseModel,V,P extends BasePresenter<M,V>> extends BaseActivity {
...
}
1
2
3
BaseRefreshActivity
public abstract class BaseRefreshActivity<M extends BaseModel, V extends BaseRefreshView<T>, P extends BaseRefreshPresenter<M, V, T>, T> extends BaseMvpActivity<M, V, P> implements BaseRefreshView<T> {
}
1
2
BaseFragment
BaseMvpFragment
BaseRefreshFragment
BaseAdapter
功能特色:
支持是否使用ToolBar
public boolean enableToolbar() {
return true;
}
1
2
3
支持自定义ToolBar
public int onBindToolbarLayout() {
return R.layout.common_toolbar;
}
1
2
3
支持loading加载数据
public void showInitLoadView() {
showInitLoadView(true);
}
public void hideInitLoadView() {
showInitLoadView(false);
}
1
2
3
4
5
6
7
支持透明loading的加载数据
@Override
public void showTransLoadingView() {
showTransLoadingView(true);
}
@Override
public void hideTransLoadingView() {
showTransLoadingView(false);
}
1
2
3
4
5
6
7
8
9
支持显示无数据
public void showNoDataView() {
showNoDataView(true);
}
public void showNoDataView(int resid) {
showNoDataView(true, resid);
}
public void hideNoDataView() {
showNoDataView(false);
}
1
2
3
4
5
6
7
8
9
10
11
支持网络网络错误显示
public void hideNetWorkErrView() {
showNetWorkErrView(false);
}
public void showNetWorkErrView() {
showNetWorkErrView(true);
}
1
2
3
4
5
6
7
8
支持Fragment的懒加载
private void lazyLoad() {
//这里进行双重标记判断,必须确保onCreateView加载完毕且页面可见,才加载数据
if (isViewCreated && isViewVisable) {
initData();
//数据加载完毕,恢复标记,防止重复加载
isViewCreated = false;
isViewVisable = false;
}
}
//默认不启用懒加载
public boolean enableLazyData() {
return false;
}
标签:mvp network ide 页面 isa networker bin shp activity
原文地址:https://www.cnblogs.com/liyanyan665/p/11369971.html