@@ -145,11 +145,12 @@ public class CheckRunningWaterStep3Activity extends AppActivity implements OnRef | |||
@Override | |||
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) { | |||
if (!hasMore) { | |||
binding.rlStatusRefresh.finishLoadMore(); | |||
return; | |||
} | |||
postDelayed(() -> { | |||
if (!hasMore) { | |||
binding.rlStatusRefresh.finishLoadMore(); | |||
return; | |||
} | |||
page = page + 1; | |||
loadData(); | |||
binding.rlStatusRefresh.finishLoadMore(); |
@@ -18,6 +18,7 @@ import com.huntersun.vkyes.etcopencard.project.api.bean.EnumBean; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.IFCode; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.ResultBean; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.SendTheVerificationCodeBean; | |||
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; | |||
import com.huntersun.vkyes.etcopencard.src.action.StatusAction; | |||
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick; | |||
import com.huntersun.vkyes.etcopencard.src.app.AppActivity; | |||
@@ -38,6 +39,7 @@ import retrofit2.Response; | |||
public class ListDeliveryActivity extends AppActivity implements OnRefreshLoadMoreListener, StatusAction { | |||
private ActivityListDeliveryBinding binding; | |||
private int Page = 1; | |||
private boolean hasMore; | |||
@Override | |||
protected View getLayoutView() { | |||
@@ -59,6 +61,7 @@ public class ListDeliveryActivity extends AppActivity implements OnRefreshLoadMo | |||
@Override | |||
protected void initData() { | |||
if (Page == 1) hasMore = true; | |||
SendTheVerificationCodeBean bizContent = new SendTheVerificationCodeBean(); | |||
bizContent.setPageNo(Page); | |||
RequestParameters parameters = | |||
@@ -67,30 +70,25 @@ public class ListDeliveryActivity extends AppActivity implements OnRefreshLoadMo | |||
.enqueue(new Converter<Result>(this, "列表数据加载中...") { | |||
@Override | |||
protected void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { | |||
showComplete(); | |||
if (bizContent.getData() == null) { | |||
showEmpty(); | |||
return; | |||
} | |||
int pageSize = 10; // 每页的数据条数 | |||
int totalSize = Integer.parseInt(bizContent.getTotalCount()); // 获取总的数据条数 | |||
int pageCount = totalSize / pageSize; // 计算总页数 | |||
List<ResultBean.BizContent> list = bizContent.getData(); | |||
if (Page == 1) { | |||
adapter.replaceData(list); | |||
adapter.replaceData(bizContent.getData()); | |||
} else { | |||
if (totalSize % pageSize == 0) { | |||
adapter.addData(list); | |||
} else { | |||
toast("没有更多数据了!"); | |||
if (!FunHelper.isEmpty(bizContent.getData())){ | |||
adapter.addData(bizContent.getData()); | |||
} | |||
} | |||
if (list.size() == 0 && Page == 1) { | |||
if (FunHelper.isEmpty(bizContent.getData()) && Page == 1) { | |||
showEmpty(); | |||
} else { | |||
showComplete(); | |||
} | |||
if (adapter.getData().size() >= totalSize){ | |||
hasMore = false; | |||
}else{ | |||
hasMore = true; | |||
} | |||
} | |||
@Override | |||
@@ -138,6 +136,11 @@ public class ListDeliveryActivity extends AppActivity implements OnRefreshLoadMo | |||
@Override | |||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) { | |||
if (!hasMore) { | |||
binding.rlStatusRefresh.finishLoadMore(); | |||
return; | |||
} | |||
postDelayed(() -> { | |||
Page++; | |||
initData(); |
@@ -27,6 +27,7 @@ import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderDetailsAct | |||
import com.huntersun.vkyes.etcopencard.project.ui.activity.MainActivity; | |||
import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderUtils; | |||
import com.huntersun.vkyes.etcopencard.project.utils.Constants; | |||
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; | |||
import com.huntersun.vkyes.etcopencard.src.action.StatusAction; | |||
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick; | |||
import com.huntersun.vkyes.etcopencard.src.app.AppFragment; | |||
@@ -53,6 +54,7 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
private int page = 1; | |||
private int orderStep = 0; | |||
private String licensePlate; | |||
private boolean hasMore; | |||
public static AppFragment<MainActivity> newInstance(int start) { | |||
return new FragmentSonOne(start); | |||
@@ -132,6 +134,8 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
} | |||
public void LoadData() { | |||
if (page == 1 ) hasMore = true; | |||
List<String> list = null; | |||
Parameters parameters = new Parameters(); | |||
//0 - 全部 1 - 申办中 2 - 待发货 3 - 待激活 4 - 已完成 | |||
@@ -153,29 +157,25 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
@SuppressLint("NotifyDataSetChanged") | |||
@Override | |||
protected void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent1) { | |||
if (bizContent1.getData() == null) { | |||
postDelayed(FragmentSonOne.this::showEmpty, 300); | |||
return; | |||
} | |||
int pageSize = 10; // 每页的数据条数 | |||
int totalSize = Integer.parseInt(bizContent1.getTotalCount()); // 获取总的数据条数 | |||
int pageCount = totalSize / pageSize; // 计算总页数 | |||
List<ResultBean.BizContent> list = bizContent1.getData(); | |||
if (page == 1) { | |||
adapter.replaceData(list); | |||
adapter.replaceData(bizContent1.getData()); | |||
} else { | |||
if (totalSize % pageSize == 0) { | |||
adapter.addData(list); | |||
} else { | |||
toast("没有更多数据了!"); | |||
if (!FunHelper.isEmpty(bizContent1.getData())){ | |||
adapter.addData(bizContent1.getData()); | |||
} | |||
} | |||
if (list.size() == 0 && page == 1) { | |||
if (FunHelper.isEmpty(bizContent1.getData()) && page == 1) { | |||
showEmpty(); | |||
} else { | |||
showComplete(); | |||
} | |||
if (adapter.getData().size() >= totalSize){ | |||
hasMore = false; | |||
}else{ | |||
hasMore = true; | |||
} | |||
} | |||
@Override | |||
@@ -235,6 +235,11 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
@Override | |||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) { | |||
if (!hasMore) { | |||
binding.rlStatusRefresh.finishLoadMore(); | |||
return; | |||
} | |||
postDelayed(() -> { | |||
page = page + 1; | |||
LoadData(); |