侧边栏数据请求前移

This commit is contained in:
18401019693
2022-11-30 15:46:38 +08:00
parent cb55c09624
commit 8e7de87c6b
2 changed files with 45 additions and 19 deletions

View File

@@ -59,7 +59,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
Bus.getOn(this);
super.onCreate();
initView();
initData();
}
@@ -148,19 +148,24 @@ public class CustomDrawerPopupView extends DrawerPopupView {
});
}
private void initData() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
adapter.updateData(data);
}
public void initData(List<CustomSidebarInfoModel> data) {
if (data != null) {
adapter.updateData(data);
} else {
LiveNetManager.get(mContext)
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
adapter.updateData(data);
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
private CustomDrawerPopupCallBack callBack;
@@ -226,7 +231,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
}
if (event.isRefresh()) {
initData();
initData(null);
}
}