From dc7b00c2571371ab3941b6c66ee7b8e0e60fed42 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 22 Oct 2024 10:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=B0=91=E4=B8=80=E4=B8=AA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/main/adapter/MainHomeLiveAdapter.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java index c54acd668..44ca8502c 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java @@ -19,6 +19,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.blankj.utilcode.util.LogUtils; import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -70,7 +71,12 @@ public class MainHomeLiveAdapter extends RefreshAdapter { if (position == 4) { return HEAD; } else{ - LiveBean mode = mList.get(position>4?position-1:position); + LiveBean mode; + if(mList.size()<4){ + mode= mList.get(position); + }else { + mode = mList.get(position > 4 ? position - 1 : position); + } if (TextUtils.equals(mode.getIs_week(), "1")) { return WEEKLAYOUT; } else { @@ -138,7 +144,10 @@ public class MainHomeLiveAdapter extends RefreshAdapter { @Override public int getItemCount() { - return super.getItemCount(); + if(mList.isEmpty()){ + return 0; + } + return super.getItemCount()+1; } class HeadVh extends RecyclerView.ViewHolder {