From 96f158b029850b2b16fac43786bb215f5055cea5 Mon Sep 17 00:00:00 2001 From: ningwenqiang Date: Tue, 5 Nov 2024 18:25:25 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9Baner=E5=B0=BA=E5=AF=B8=20?= =?UTF-8?q?=20=E4=B9=8B=E5=89=8D=E6=9C=89=E4=BB=A3=E7=A0=81=E5=BC=BA?= =?UTF-8?q?=E8=A1=8C=E9=99=90=E5=88=B6=E4=BA=86=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/adapter/MainHomeLiveAdapter.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 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 c62131fa4..3d96cd566 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java @@ -55,10 +55,10 @@ public class MainHomeLiveAdapter extends RefreshAdapter { private Context context; private int Height; private int getWeekIntIndex = 0; - private boolean showBaner =true; + private boolean showBaner = true; public void setShowBaner(boolean showBaner) { - // this.showBaner = showBaner; + // this.showBaner = showBaner; } public MainHomeLiveAdapter(Context context, int h) { @@ -66,7 +66,6 @@ public class MainHomeLiveAdapter extends RefreshAdapter { this.context = context; this.Height = h; mHeadView = mInflater.inflate(R.layout.item_main_home_live_head, null, false); - mHeadView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DpUtil.dp2px(85))); } public View getHeadView() { @@ -75,23 +74,23 @@ public class MainHomeLiveAdapter extends RefreshAdapter { @Override public int getItemViewType(int position) { - if (!showBaner){ + if (!showBaner) { if (position % 2 == 1) { return RIGHT; - }else { + } else { return LEFT; } } if (position == 4) { return HEAD; - } else{ + } else { LiveBean mode; - if(mList.size()<4){ - if(position>=mList.size()){ + if (mList.size() < 4) { + if (position >= mList.size()) { return HEAD; } - mode= mList.get(position); - }else { + mode = mList.get(position); + } else { mode = mList.get(position > 4 ? position - 1 : position); } if (TextUtils.equals(mode.getIs_week(), "1")) { @@ -143,7 +142,7 @@ public class MainHomeLiveAdapter extends RefreshAdapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) { - int nowPosition = position>4?position-1:position; + int nowPosition = position > 4 ? position - 1 : position; if (vh instanceof MainHomeLiveWeekItemViewHolder) { ((MainHomeLiveWeekItemViewHolder) vh).loadViewDate(mList.get(nowPosition), nowPosition, Height, new MainHomeLiveWeekItemViewHolder.OnItemClickListener() { @Override @@ -169,10 +168,10 @@ public class MainHomeLiveAdapter extends RefreshAdapter { public int getItemCount() { if (!showBaner) return super.getItemCount(); - if(mList.isEmpty()){ + if (mList.isEmpty()) { return 0; } - return super.getItemCount()+1; + return super.getItemCount() + 1; } class HeadVh extends RecyclerView.ViewHolder {