补齐直播间列表标签

This commit is contained in:
Martin 2024-10-10 15:17:36 +08:00
parent 5a7950da75
commit 6a78563d32
5 changed files with 45 additions and 39 deletions

View File

@ -32,6 +32,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.views.MainHomeLiveItemViewHolder; import com.yunbao.main.views.MainHomeLiveItemViewHolder;
import com.yunbao.main.views.MainHomeLiveWeekItemViewHolder;
import java.util.List; import java.util.List;
@ -66,12 +67,16 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
LiveBean mode = mList.get(position); if (position == 4) {
if (TextUtils.equals(mode.getIs_week(), "1")) { return HEAD;
return WEEKLAYOUT; } else{
} else { LiveBean mode = mList.get(position>4?position-1:position);
if (position % 2 == 0) { if (TextUtils.equals(mode.getIs_week(), "1")) {
return RIGHT; return WEEKLAYOUT;
} else {
if (position % 2 == 0) {
return RIGHT;
}
} }
} }
return LEFT; return LEFT;
@ -90,8 +95,8 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
HeadVh headVh = new HeadVh(mHeadView); HeadVh headVh = new HeadVh(mHeadView);
headVh.setIsRecyclable(false); headVh.setIsRecyclable(false);
return headVh; return headVh;
/* case WEEKLAYOUT: case WEEKLAYOUT:
return new MainHomeLiveWeekItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false));*/ return new MainHomeLiveWeekItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false));
default: default:
return new MainHomeLiveItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false)); return new MainHomeLiveItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false));
} }
@ -100,17 +105,18 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
@Override @Override
public void onViewDetachedFromWindow(@NonNull RecyclerView.ViewHolder holder) { public void onViewDetachedFromWindow(@NonNull RecyclerView.ViewHolder holder) {
//局部刷新周星榜svaga //局部刷新周星榜svaga
/* if (holder instanceof MainHomeLiveWeekItemViewHolder) { if (holder instanceof MainHomeLiveWeekItemViewHolder) {
((MainHomeLiveWeekItemViewHolder) holder).upSvga(); ((MainHomeLiveWeekItemViewHolder) holder).upSvga();
}*/ }
super.onViewDetachedFromWindow(holder); super.onViewDetachedFromWindow(holder);
} }
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
/* if (vh instanceof MainHomeLiveWeekItemViewHolder) { int nowPosition = position>4?position-1:position;
((MainHomeLiveWeekItemViewHolder) vh).loadViewDate(mList.get(position), position, Height, new MainHomeLiveWeekItemViewHolder.OnItemClickListener() { if (vh instanceof MainHomeLiveWeekItemViewHolder) {
((MainHomeLiveWeekItemViewHolder) vh).loadViewDate(mList.get(nowPosition), nowPosition, Height, new MainHomeLiveWeekItemViewHolder.OnItemClickListener() {
@Override @Override
public void onItemClick(LiveBean bean, int position) { public void onItemClick(LiveBean bean, int position) {
if (mOnItemClickListener != null) { if (mOnItemClickListener != null) {
@ -118,8 +124,8 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
} }
} }
}); });
} else */if (vh instanceof MainHomeLiveItemViewHolder) { } else if (vh instanceof MainHomeLiveItemViewHolder) {
((MainHomeLiveItemViewHolder) vh).loadViewDate(mList.get(position), position, Height, new MainHomeLiveItemViewHolder.OnItemClickListener() { ((MainHomeLiveItemViewHolder) vh).loadViewDate(mList.get(nowPosition), nowPosition, Height, new MainHomeLiveItemViewHolder.OnItemClickListener() {
@Override @Override
public void onItemClick(LiveBean bean, int position) { public void onItemClick(LiveBean bean, int position) {
if (mOnItemClickListener != null) { if (mOnItemClickListener != null) {

View File

@ -154,7 +154,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
} else { } else {
viewBg.setVisibility(View.GONE); viewBg.setVisibility(View.GONE);
} }
/*if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && Height <= 1920) { if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && Height <= 1920) {
Log.e("t1", position + "" + Height + "111啊" + bean.getContent_pic_size_two()); Log.e("t1", position + "" + Height + "111啊" + bean.getContent_pic_size_two());
Picasso.with(mContext) Picasso.with(mContext)
@ -165,7 +165,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
Picasso.with(mContext) Picasso.with(mContext)
.load(bean.getContent_pic_size_three()) .load(bean.getContent_pic_size_three())
.into(live_type); .into(live_type);
}*/ }
live_info_view.setVisibility(View.GONE); live_info_view.setVisibility(View.GONE);
@ -204,7 +204,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
mNum.setText(formatBigNum.formatBigNum(bean.getHot_num())); mNum.setText(formatBigNum.formatBigNum(bean.getHot_num()));
views.setVisibility(View.GONE); views.setVisibility(View.GONE);
if ("1".equals(bean.getIslive())) { if ("1".equals(bean.getIslive())) {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//直播中 //直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType())); mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType()));
mType.setVisibility(View.VISIBLE); mType.setVisibility(View.VISIBLE);
@ -213,7 +213,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
live_type.setVisibility(View.VISIBLE); live_type.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(R.string.lives_state)); mLiveState.setText(mContext.getString(R.string.lives_state));
} else { } else {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//休息中 //休息中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
mType.setVisibility(View.GONE); mType.setVisibility(View.GONE);

View File

@ -77,13 +77,13 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
viewBg.setVisibility(View.GONE); viewBg.setVisibility(View.GONE);
if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && height <= 1920) { if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && height <= 1920) {
/* Picasso.with(mContext) Picasso.with(mContext)
.load(bean.getContent_pic_size_two()) .load(bean.getContent_pic_size_two())
.into(liveType);*/ .into(liveType);
} else if (bean.getContent_pic_size_three() != null && !bean.getContent_pic_size_three().equals("") && height > 1920) { } else if (bean.getContent_pic_size_three() != null && !bean.getContent_pic_size_three().equals("") && height > 1920) {
/* Picasso.with(mContext) Picasso.with(mContext)
.load(bean.getContent_pic_size_three()) .load(bean.getContent_pic_size_three())
.into(liveType);*/ .into(liveType);
} }
ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover, 400, 400); ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover, 400, 400);
bgs.setVisibility(View.VISIBLE); bgs.setVisibility(View.VISIBLE);
@ -112,7 +112,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
mNum.setText(formatBigNum.formatBigNum(bean.getHot_num())); mNum.setText(formatBigNum.formatBigNum(bean.getHot_num()));
views.setVisibility(View.GONE); views.setVisibility(View.GONE);
if ("1".equals(bean.getIslive())) { if ("1".equals(bean.getIslive())) {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//直播中 //直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType())); mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType()));
mType.setVisibility(View.VISIBLE); mType.setVisibility(View.VISIBLE);
@ -121,7 +121,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
liveType.setVisibility(View.VISIBLE); liveType.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(R.string.lives_state)); mLiveState.setText(mContext.getString(R.string.lives_state));
} else { } else {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//休息中 //休息中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
mType.setVisibility(View.GONE); mType.setVisibility(View.GONE);
@ -157,20 +157,20 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
viewBg.setVisibility(View.GONE); viewBg.setVisibility(View.GONE);
} }
RelativeLayout.LayoutParams dragon_moneyLayoutParams = (RelativeLayout.LayoutParams) dragon_money.getLayoutParams(); RelativeLayout.LayoutParams dragon_moneyLayoutParams = (RelativeLayout.LayoutParams) dragon_money.getLayoutParams();
/* if (bean.getRedPacketStatus() == 1) { if (bean.getRedPacketStatus() == 1) {
dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(55); dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(55);
redPacket.setVisibility(View.VISIBLE); redPacket.setVisibility(View.VISIBLE);
} else { } else {
dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(25); dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(25);
redPacket.setVisibility(View.GONE); redPacket.setVisibility(View.GONE);
}*/ }
/* if (bean.getSendMoneyLongStatus() == 1) { if (bean.getSendMoneyLongStatus() == 1) {
dragon_money.setLayoutParams(dragon_moneyLayoutParams); dragon_money.setLayoutParams(dragon_moneyLayoutParams);
dragon_money.setVisibility(View.VISIBLE); dragon_money.setVisibility(View.VISIBLE);
} else { } else {
dragon_money.setVisibility(View.GONE); dragon_money.setVisibility(View.GONE);
}*/ }
RxView.clicks(itemView) RxView.clicks(itemView)
.throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件 .throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件
.subscribe(new Observer<Unit>() { .subscribe(new Observer<Unit>() {

View File

@ -163,9 +163,9 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override @Override
public int getSpanSize(int position) { public int getSpanSize(int position) {
/* if (position == 4) { if (position == 4) {
return 2; return 2;
}*/ }
return 1; return 1;
} }
}); });
@ -190,7 +190,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) { if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) {
pp = 1; pp = 1;
MainHttpUtil.getHot(p, callback); MainHttpUtil.getHot(p, callback);
/*LiveHttpUtil.getAnchorLastWeekList(new HttpCallback() { LiveHttpUtil.getAnchorLastWeekList(new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (mWeekListBean != null) { if (mWeekListBean != null) {
@ -211,10 +211,10 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
Constants.getWeekIntIndex = Constants.getWeekIntIndex + 1; Constants.getWeekIntIndex = Constants.getWeekIntIndex + 1;
MainHttpUtil.getHot(p, callback); MainHttpUtil.getHot(p, callback);
} }
});*/ });
} else { } else {
pp = 0; pp = 0;
if (select == 0) { if(select==0){
select = list.get(0).getId(); select = list.get(0).getId();
} }
MainHttpUtil.getClassLive(select, p, callback); MainHttpUtil.getClassLive(select, p, callback);

View File

@ -59,7 +59,7 @@ public class SearchRecommendBodyItemViewHolder extends RecyclerView.ViewHolder {
public void showData(AnchorRecommendItemModel model, int height) { public void showData(AnchorRecommendItemModel model, int height) {
Context mContext = itemView.getContext(); Context mContext = itemView.getContext();
liveType.setImageDrawable(null); liveType.setImageDrawable(null);
/*if (model.getContentPicSizeTwo() != null && !model.getContentPicSizeTwo().equals("") && height <= 1920) { if (model.getContentPicSizeTwo() != null && !model.getContentPicSizeTwo().equals("") && height <= 1920) {
Picasso.with(mContext) Picasso.with(mContext)
.load(model.getContentPicSizeTwo()) .load(model.getContentPicSizeTwo())
.into(liveType); .into(liveType);
@ -67,7 +67,7 @@ public class SearchRecommendBodyItemViewHolder extends RecyclerView.ViewHolder {
Picasso.with(mContext) Picasso.with(mContext)
.load(model.getContentPicSizeThree()) .load(model.getContentPicSizeThree())
.into(liveType); .into(liveType);
}*/ }
ImgLoader.display(itemView.getContext(), model.getThumb(), mCover); ImgLoader.display(itemView.getContext(), model.getThumb(), mCover);
bgs.setVisibility(View.VISIBLE); bgs.setVisibility(View.VISIBLE);
pkico.setVisibility(View.GONE); pkico.setVisibility(View.GONE);
@ -95,22 +95,22 @@ public class SearchRecommendBodyItemViewHolder extends RecyclerView.ViewHolder {
mNum.setText(formatBigNum.formatBigNum(String.valueOf(model.getHotNum()))); mNum.setText(formatBigNum.formatBigNum(String.valueOf(model.getHotNum())));
views.setVisibility(View.GONE); views.setVisibility(View.GONE);
if (TextUtils.equals("1", model.getIslive())) { if (TextUtils.equals("1", model.getIslive())) {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//直播中 //直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Integer.parseInt(model.getType()))); mType.setImageResource(MainIconUtil.getLiveTypeIcon(Integer.parseInt(model.getType())));
mType.setVisibility(View.VISIBLE); mType.setVisibility(View.VISIBLE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_work); mLiveIco.setImageResource(R.mipmap.icon_main_rest_work);
mNum.setVisibility(View.VISIBLE); mNum.setVisibility(View.VISIBLE);
//liveType.setVisibility(View.VISIBLE); liveType.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(R.string.lives_state)); mLiveState.setText(mContext.getString(R.string.lives_state));
} else { } else {
//views.setVisibility(View.VISIBLE); views.setVisibility(View.VISIBLE);
//休息中 //休息中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
mType.setVisibility(View.GONE); mType.setVisibility(View.GONE);
mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot); mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot);
mLiveState.setText(mContext.getString(R.string.rest_state)); mLiveState.setText(mContext.getString(R.string.rest_state));
//liveType.setVisibility(View.GONE); liveType.setVisibility(View.GONE);
mNum.setVisibility(View.GONE); mNum.setVisibility(View.GONE);
}//防抖 }//防抖
RxView.clicks(mCover) RxView.clicks(mCover)