直播间聊天信息问题

This commit is contained in:
18401019693 2022-08-23 13:47:29 +08:00
parent 234877fabc
commit 25e3e86230
2 changed files with 45 additions and 36 deletions

View File

@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/
public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符
// public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境
public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -3,12 +3,9 @@ package com.yunbao.live.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
@ -17,6 +14,11 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
@ -278,23 +280,46 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mTextView.setText(builder);
} else if (bean.getType() == -10) {
mBg.setBackground(null);
// mTextView.setVisibility(View.GONE);
} else if (bean.getType() == LiveChatBean.SYSTEM) {
boolean isContains = false;
for (LiveChatBean model : mList) {
if (!TextUtils.isEmpty(model.getContent())&&model.getContent().contains("堅決維護青少年群體精神文明健康")) {
isContains = true;
}
}
if (isContains) {
mTextView.setTextColor(0xffffffff);
mBg.setBackground(null);
mTextView.setText(bean.getContent());
}
} else if (bean.getType() == -1) {//自动消息关注
boolean isContains = false;
for (LiveChatBean model : mList) {
if (bean.getType() == -1) {
isContains = true;
}
}
if (isContains) {
mBg.setBackground(null);
mTextView.setVisibility(View.GONE);
view_follow.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getId(), avatar);
bean.setHeart(position);
}
} else if (bean.getType() == -2) {//自动消息点击发言
boolean isContains = false;
for (LiveChatBean model : mList) {
if (bean.getType() == -2) {
isContains = true;
}
}
if (isContains) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(R.string.automatic_chat);
bean.setHeart(position);
}
} else {
// LoadDian9TuUtil.loadDian9Tu(mContext, mBg, "https://qny.shayucm.com/huangdi-new-qipao.png");
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
@ -306,23 +331,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} else {
mTextView.setTextColor(0xffffffff);
}
// Log.e("tag",bean.getContent().length()+"");
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams.height = RecyclerView.LayoutParams.WRAP_CONTENT;
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
// if(bean.getContent().length()<=7) {
// RecyclerView.LayoutParams linearParams1 = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams1.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat1);
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams1); //使设置好的布局参数应用到控件
// }
// else if(bean.getContent().length()<=20){
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat2);
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
// }
LiveTextRender.render(mContext, mTextView, bean);
}
}