2025-10-28 16:56:13 +08:00
|
|
|
package com.xscm.modulemain.adapter;
|
2025-10-20 10:16:44 +08:00
|
|
|
|
|
|
|
|
import static android.view.View.GONE;
|
|
|
|
|
|
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
|
|
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
2025-10-28 16:56:13 +08:00
|
|
|
import com.xscm.modulemain.R;
|
2025-10-20 10:16:44 +08:00
|
|
|
import com.xscm.moduleutil.bean.RoomSearchResp;
|
|
|
|
|
import com.xscm.moduleutil.utils.ImageUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 搜索房间结果
|
|
|
|
|
*/
|
|
|
|
|
public class SearchRoomResultAdapter extends BaseQuickAdapter<RoomSearchResp, BaseViewHolder> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SearchRoomResultAdapter() {
|
|
|
|
|
super(R.layout.index_item_search_room_result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void convert(BaseViewHolder helper,RoomSearchResp item) {
|
2025-10-24 17:52:11 +08:00
|
|
|
ImageUtils.loadHeadCC(item.getRoom_cover(), helper.getView(R.id.iv_follow_bg));
|
|
|
|
|
helper.setText(R.id.tv_name, item.getRoom_name());
|
2025-10-20 10:16:44 +08:00
|
|
|
ImageView iv = helper.getView(R.id.iv_play);
|
|
|
|
|
// if (item.getIcon()!=null && item.getIcon().size() > 0) {
|
|
|
|
|
// iv.setVisibility(View.VISIBLE);
|
|
|
|
|
// ImageUtils.loadRes(com.qxcm.moduleutil.R.drawable.voice_play, iv);
|
|
|
|
|
// }else {
|
|
|
|
|
iv.setVisibility(GONE);
|
|
|
|
|
// }
|
2025-10-24 17:52:11 +08:00
|
|
|
helper.setText(R.id.tv_num, formatHotValue(Integer.parseInt(item.getHot_value()!=null ? item.getHot_value() : "0")));
|
2025-10-20 10:16:44 +08:00
|
|
|
ImageUtils.loadHeadCC(item.getLabel_icon(), helper.getView(R.id.iv_type));
|
|
|
|
|
|
2025-10-24 17:52:11 +08:00
|
|
|
// helper.setOnClickListener(R.id.iv_play,new View.OnClickListener() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onClick(View v) {
|
|
|
|
|
// RoomManager.getInstance().fetchRoomDataAndEnter(mContext.getApplicationContext(), item.getRoom_id() ,"");
|
|
|
|
|
//
|
|
|
|
|
//// ARouter.getInstance().build(ARouteConstants.LIVE_ROOM).withString("form","首页热门列表").withString("roomId", item.getId()).navigation();
|
|
|
|
|
//// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getId()).navigation();
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// });
|
2025-10-20 10:16:44 +08:00
|
|
|
}
|
|
|
|
|
private String formatHotValue(int hotValue) {
|
|
|
|
|
if (hotValue > 10000) {
|
|
|
|
|
return String.format("%.1fw", hotValue / 10000.0);
|
|
|
|
|
} else {
|
|
|
|
|
return String.valueOf(hotValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|