补齐直播间列表标签

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

View File

@ -154,7 +154,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
} else {
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());
Picasso.with(mContext)
@ -165,7 +165,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
Picasso.with(mContext)
.load(bean.getContent_pic_size_three())
.into(live_type);
}*/
}
live_info_view.setVisibility(View.GONE);
@ -204,7 +204,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
mNum.setText(formatBigNum.formatBigNum(bean.getHot_num()));
views.setVisibility(View.GONE);
if ("1".equals(bean.getIslive())) {
//views.setVisibility(View.VISIBLE);
views.setVisibility(View.VISIBLE);
//直播中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType()));
mType.setVisibility(View.VISIBLE);
@ -213,7 +213,7 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter<LiveBean> {
live_type.setVisibility(View.VISIBLE);
mLiveState.setText(mContext.getString(R.string.lives_state));
} else {
//views.setVisibility(View.VISIBLE);
views.setVisibility(View.VISIBLE);
//休息中
mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING));
mType.setVisibility(View.GONE);

View File

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

View File

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

View File

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