修复首页数据过少时可能的闪退问题

This commit is contained in:
zlzw 2024-10-25 10:02:46 +08:00
parent 6aefceae32
commit 4fd14c5cbd
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,9 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
} else{
LiveBean mode;
if(mList.size()<4){
if(position>=mList.size()){
return HEAD;
}
mode= mList.get(position);
}else {
mode = mList.get(position > 4 ? position - 1 : position);

View File

@ -167,6 +167,8 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
public int getSpanSize(int position) {
if (position == 4) {
return 2;
}else if(mAdapter.getList().size()<4&&position==mAdapter.getList().size()){
return 2;
}
return 1;
}