1.修改Baner尺寸 之前有代码强行限制了高度
This commit is contained in:
parent
64ef9b27ae
commit
96f158b029
@ -55,10 +55,10 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
|||||||
private Context context;
|
private Context context;
|
||||||
private int Height;
|
private int Height;
|
||||||
private int getWeekIntIndex = 0;
|
private int getWeekIntIndex = 0;
|
||||||
private boolean showBaner =true;
|
private boolean showBaner = true;
|
||||||
|
|
||||||
public void setShowBaner(boolean showBaner) {
|
public void setShowBaner(boolean showBaner) {
|
||||||
// this.showBaner = showBaner;
|
// this.showBaner = showBaner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainHomeLiveAdapter(Context context, int h) {
|
public MainHomeLiveAdapter(Context context, int h) {
|
||||||
@ -66,7 +66,6 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
this.Height = h;
|
this.Height = h;
|
||||||
mHeadView = mInflater.inflate(R.layout.item_main_home_live_head, null, false);
|
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() {
|
public View getHeadView() {
|
||||||
@ -75,23 +74,23 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
if (!showBaner){
|
if (!showBaner) {
|
||||||
if (position % 2 == 1) {
|
if (position % 2 == 1) {
|
||||||
return RIGHT;
|
return RIGHT;
|
||||||
}else {
|
} else {
|
||||||
return LEFT;
|
return LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (position == 4) {
|
if (position == 4) {
|
||||||
return HEAD;
|
return HEAD;
|
||||||
} else{
|
} else {
|
||||||
LiveBean mode;
|
LiveBean mode;
|
||||||
if(mList.size()<4){
|
if (mList.size() < 4) {
|
||||||
if(position>=mList.size()){
|
if (position >= mList.size()) {
|
||||||
return HEAD;
|
return HEAD;
|
||||||
}
|
}
|
||||||
mode= mList.get(position);
|
mode = mList.get(position);
|
||||||
}else {
|
} else {
|
||||||
mode = mList.get(position > 4 ? position - 1 : position);
|
mode = mList.get(position > 4 ? position - 1 : position);
|
||||||
}
|
}
|
||||||
if (TextUtils.equals(mode.getIs_week(), "1")) {
|
if (TextUtils.equals(mode.getIs_week(), "1")) {
|
||||||
@ -143,7 +142,7 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
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) {
|
if (vh instanceof MainHomeLiveWeekItemViewHolder) {
|
||||||
((MainHomeLiveWeekItemViewHolder) vh).loadViewDate(mList.get(nowPosition), nowPosition, Height, new MainHomeLiveWeekItemViewHolder.OnItemClickListener() {
|
((MainHomeLiveWeekItemViewHolder) vh).loadViewDate(mList.get(nowPosition), nowPosition, Height, new MainHomeLiveWeekItemViewHolder.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -169,10 +168,10 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
|||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
if (!showBaner)
|
if (!showBaner)
|
||||||
return super.getItemCount();
|
return super.getItemCount();
|
||||||
if(mList.isEmpty()){
|
if (mList.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return super.getItemCount()+1;
|
return super.getItemCount() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HeadVh extends RecyclerView.ViewHolder {
|
class HeadVh extends RecyclerView.ViewHolder {
|
||||||
|
Loading…
Reference in New Issue
Block a user