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 {