在线用户列表标签显示优化。

礼物点击弹窗多次闪退修改。
This commit is contained in:
2025-11-10 11:09:06 +08:00
parent a1901a130f
commit 0aca66ce84
11 changed files with 637 additions and 616 deletions

View File

@@ -94,8 +94,6 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
}
}
}
if (diff.containsKey("comment_num")) {
helper.setText(R.id.dy_comment, diff.getString("comment_num"));
}

View File

@@ -10,6 +10,7 @@ import androidx.annotation.Nullable;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackEvent;
@@ -152,7 +153,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
// 只需要创建一次Adapter并设置循环设置没有意义
if (pageCount > 0) {
roomAdapter = new GiftRoomAdapter(getActivity(), data, 0, "0");
roomAdapter = new GiftRoomAdapter(CommonAppContext.getInstance(), data, 0, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
}

View File

@@ -17,6 +17,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -178,11 +179,7 @@ public class ImageUtils {
Logger.e("Resource ID is 0 or invalid");
}
}
public static void loadHeadCC(String path, ImageView mImageView) {
public static void loadSetErrorImg(String path, ImageView mImageView,int errorRes) {
if (mImageView == null) {
return;
}
@@ -194,10 +191,63 @@ public class ImageUtils {
return;
}
}
Glide.with(mImageView).load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
Glide.with(mImageView).load(path).error(errorRes).placeholder(errorRes).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
}
public static void loadHeadCC(String path, ImageView mImageView) {
if (mImageView == null) {
return;
}
Context context = mImageView.getContext();
if (context instanceof android.app.Activity) {
android.app.Activity activity = (android.app.Activity) context;
if (activity.isFinishing() || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())) {
return;
}
}
Glide.with(mImageView).load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
}
public static void loadHeadCC(String path, ImageView mImageView, LinearLayout.LayoutParams params) {
if (mImageView == null) {
return;
}
Context context = mImageView.getContext();
if (context instanceof android.app.Activity) {
android.app.Activity activity = (android.app.Activity) context;
if (activity.isFinishing() || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())) {
return;
}
}
Glide.with(mImageView).asBitmap().load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar)
.diskCacheStrategy(DiskCacheStrategy.ALL)
// 添加加载监听
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
// 加载失败(显示默认图),可处理异常
Log.e("Glide", "图片加载失败", e);
return false; // 返回 falseGlide 会继续执行默认的错误处理(显示 error 图)
}
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
// 加载成功resource 就是最终的 Bitmap 对象
int imageWidth = resource.getWidth(); // 图片原始宽度
int imageHeight = resource.getHeight(); // 图片原始高度
params.width = (int)(imageWidth * 1.3);
// 这里可以使用宽高(如打印、适配布局等)
Log.d("GlideImageSize", "宽度:" + imageWidth + ",高度:" + imageHeight);
return false; // 返回 falseGlide 会继续执行默认的图片设置(显示到 mImageView
}
})
.into(mImageView);
}
public static void loadCompressImg(String path, ImageView mImageView, int width, int height) {
Glide.with(mImageView)
.load(path)

View File

@@ -142,15 +142,6 @@ public class DynamicListActivity extends BaseMvpActivity<CirclePresenter, Activi
public void getCircleList(List<CircleListBean> list) {
if (list == null || list.isEmpty())
return;
// if (page == 1){
// circleList.clear();
// }
//
// List<CircleListBean> oldList = new ArrayList<>(cirleListAdapter.getData());
// circleList.addAll(list);
//
// DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new CircleListDiffCallback(oldList, circleList), false);
// cirleListAdapter.setNewDiffData(diffResult,circleList);
circleList.addAll(list);
cirleListAdapter.setNewData(circleList);
}

View File

@@ -179,7 +179,6 @@ import java.nio.charset.StandardCharsets
import java.util.Arrays
import java.util.Date
import java.util.stream.Collectors
import kotlin.math.E
@Route(path = ARouteConstants.ROOM_DETAILS)
class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
@@ -1601,11 +1600,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
private fun handleMsgType1013(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomUserBean == null) return
val userId2 = SpUtil.getUserId()
val userId = SpUtil.getUserId()
if (text.action == 1 && mRoomUserBean!!.user_id == userId2 && mRoomUserBean!!.pit_number == 9) {
if (text.action == 1 && mRoomUserBean!!.user_id == userId && mRoomUserBean!!.pit_number == 9) {
queren(text.fromUserInfo.nickname)
} else if (text.action == 4 && text.fromUserInfo.user_id == userId2) {
} else if (text.action == 4 && text.fromUserInfo.user_id == userId) {
queren1(text.fromUserInfo.nickname)
} else {
roomFragment?.handleRoomMessage(messageEvent)
@@ -1681,35 +1680,41 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
switchMic(2)
}
val typeId = mRoomInfoResp!!.room_info.type_id
if ("2" == typeId) {
if ("9" == pitNumber) {
mRoomInfoResp!!.room_info.pit_list[pitNumber.toInt() - 1] =
getPitBean(messageEvent, 1)
if (mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.pit_number = pitNumber.toInt()
val typeId = RoomType.fromTypeId(mRoomInfoResp?.room_info?.type_id)
when (typeId) {
RoomType.AUCTION -> {
if ("9" == pitNumber) {
mRoomInfoResp!!.room_info.pit_list[0] = getPitBean(messageEvent,1)
if (mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.pit_number = pitNumber.toInt()
}
}
}
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
val labelId = mRoomInfoResp!!.room_info.label_id
if ("2" == labelId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("1" == labelId) {
mRoomInfoResp!!.room_info.pit_list[pitNumber.toInt() - 1] =
getPitBean(messageEvent, 1)
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
}
} else if ("7" == typeId) {
mBinding!!.rlMore.visibility = View.GONE
mBinding!!.rlMisc.visibility = View.GONE
RoomType.DATING -> {
val labelId = mRoomInfoResp!!.room_info.label_id
if ("2" == labelId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("1" == labelId) {
mRoomInfoResp!!.room_info.pit_list[pitNumber.toInt() - 1] =
getPitBean(messageEvent, 1)
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
}
}
RoomType.MUTUAL_ENTERTAINMENT -> {
mBinding!!.rlMore.visibility = View.GONE
mBinding!!.rlMisc.visibility = View.GONE
roomFragment!!.handleRoomMessage(messageEvent)
}
else ->{
roomFragment!!.updateSeatViewExchangedWithPitArray(mRoomInfoResp)
}
}
roomFragment!!.handleRoomMessage(messageEvent)
} else {
roomFragment!!.updateSeatViewExchangedWithPitArray(mRoomInfoResp)
}
}
private fun handleMsgType1004(messageEvent: RoomMessageEvent, text: T?) {

View File

@@ -106,20 +106,22 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
String typeId = mRoomInfoResp.getRoom_info().getType_id();
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
CommonAppContext.getInstance().lable_id = typeId;
if ("7".equals(typeId)) {
qxRoomSeatViewType = QXRoomSeatViewType.FRIEND;
} else if ("2".equals(typeId)) {
RoomType roomType = RoomType.Companion.fromTypeId(typeId);
if (roomType == RoomType.AUCTION){
qxRoomSeatViewType = QXRoomSeatViewType.AUCTION;
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId) || "8".equals(typeId)) {
}else if (roomType == RoomType.DATING){
if ("2".equals(labelId)) {
qxRoomSeatViewType = QXRoomSeatViewType.KTV;
} else if ("1".equals(labelId)) {
qxRoomSeatViewType = QXRoomSeatViewType.NORMAL;
}
} else if ("6".equals(typeId)) {
}else if (roomType == RoomType.MUTUAL_ENTERTAINMENT){
qxRoomSeatViewType = QXRoomSeatViewType.FRIEND;
}else if (roomType == RoomType.BLACK_ROOM){
qxRoomSeatViewType = QXRoomSeatViewType.CABIN;
}
}
@Override
@@ -507,16 +509,19 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) {
mRoomInfoResp = roomInfoResp;
setRoomSeatViewType();
loadSubFragment(qxRoomSeatViewType);
updateChildFragmentViews();
}
public void upRoomInfoData(RoomInfoResp roomInfoResp) {
this.mRoomInfoResp = roomInfoResp;
setRoomSeatViewType();
}
public void upRoomInfo(RoomInfoResp roomInfoResp) {
mRoomInfoResp = roomInfoResp;
setRoomSeatViewType();
loadSubFragment(qxRoomSeatViewType);
}
@@ -622,11 +627,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
wheatFeedingDialogFragment.show(getChildFragmentManager(), "WheatFeedingDialogFragment");
}
public void updateWheatFeedingDisplayMode(int newDisplayMode) {
if (wheatFeedingDialogFragment != null && wheatFeedingDialogFragment.isVisible()) {
wheatFeedingDialogFragment.updateDisplayMode(newDisplayMode);
}
}
@Override
protected int getLayoutId() {
@@ -636,7 +636,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
@Override
public void roomInfo(RoomInfoResp resp) {
mRoomInfoResp = resp;
setRoomSeatViewType();
}
@Override

View File

@@ -95,25 +95,6 @@ public class DailyTasksActivity extends BaseMvpActivity<DailyTasksPresenter, Act
MvpPre.dailyTasksOpenBox(item.getId());
});
// taskDataAdapter = new TaskDataAdapter();
// taskDataAdapter.setItemClickLitener(new TaskDataAdapter.ItemClickLitener() {
// @Override
// public void onItemClick(View view, int position, GiftBoxBean.TaskDataBean.DailyTasksBean item) {
// if (view.getId() == R.id.task_type){
// MvpPre.dailyTasksOpenBox(item.getTask_id()+"");
// }
// }
// });
// mTaskBoxAdapter.setOnItemChildClickListener((adapter, view, position) -> {
// if (view.getId() == R.id.task_type){
// TextView tv = (TextView) view;
// if (tv.getText().toString().equals("领取金币")){
// GiftBoxBean.TaskDataBean taskDataBean = (GiftBoxBean.TaskDataBean) adapter.getItem(position);
// MvpPre.dailyTasksOpenBox(taskDataBean.getDaily_tasks().get(position).getTask_id()+"");
// }
// }
// });
}
@Override

View File

@@ -98,15 +98,16 @@ public class RoomOnlineAdapter extends BaseMultiItemQuickAdapter<RoomOnlineBean,
if (url.contains("http")) {
ImageView imageView1 = new ImageView(helper.itemView.getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_56),
LinearLayout.LayoutParams.WRAP_CONTENT,
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_20)
);
params.setMargins(0, 0, helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
imageView1.setLayoutParams(params);
imageView1.setScaleType(ImageView.ScaleType.FIT_START);
// 使用 Glide 加载图片
ImageUtils.loadHeadCC(url, imageView1);
ImageUtils.loadHeadCC(url, imageView1,params);
llContainer.addView(imageView1);
}
}

View File

@@ -38,19 +38,16 @@ public class TaskBoxAdapter extends BaseQuickAdapter<GiftBoxBean.GiftBean, BaseV
TextView giftTitle = helper.getView(R.id.tv_title);
giftName.setText(item.getName());
giftTitle.setText(item.getTitle());
ImageUtils.loadHeadCC(item.getIcon(), helper.getView(R.id.task_box));
if (position == 0) {
itemView.setBackgroundColor(mContext.getResources().getColor(com.xscm.moduleutil.R.color.color_FCE4ED)); // 红色
giftName.setTextColor(mContext.getResources().getColor(com.xscm.moduleutil.R.color.color_E24171));
setSpannableText(giftTitle, "最高可获得%d金币", Integer.parseInt(item.getHighest_gain()),com.xscm.moduleutil.R.color.color_E24171);
// helper.setImageDrawable(R.id.task_box, mContext.getResources().getDrawable(com.qxcm.moduleutil.R.mipmap.task_cj));
ImageUtils.loadSetErrorImg(item.getIcon(), helper.getView(R.id.task_box), com.xscm.moduleutil.R.mipmap.task_cj);
} else if (position == 1) {
ImageUtils.loadSetErrorImg(item.getIcon(), helper.getView(R.id.task_box), com.xscm.moduleutil.R.mipmap.task_gj);
itemView.setBackgroundColor(mContext.getResources().getColor(com.xscm.moduleutil.R.color.color_FDE8AE)); // 黄色
giftName.setTextColor(mContext.getResources().getColor(com.xscm.moduleutil.R.color.color_F35F07));
setSpannableText(giftTitle, "最高可获得%d金币", Integer.parseInt(item.getHighest_gain()),com.xscm.moduleutil.R.color.color_F35F07);
// helper.setImageDrawable(R.id.task_box, mContext.getResources().getDrawable(com.qxcm.moduleutil.R.mipmap.task_gj));
} else {
// 其他 item 恢复默认背景(可选)

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
android:id="@+id/item"
android:layout_height="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_16">
<com.xscm.moduleutil.widget.GifAvatarOvalView