diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index bf70d3ca4..06a13aee5 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -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"; diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 37bc83310..b639182f8 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -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) { - mTextView.setTextColor(0xffffffff); - mBg.setBackground(null); - mTextView.setText(bean.getContent()); + 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) {//自动消息,关注 - mBg.setBackground(null); - mTextView.setVisibility(View.GONE); - view_follow.setVisibility(View.VISIBLE); - ImgLoader.display(mContext, bean.getId(), avatar); - bean.setHeart(position); + 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) {//自动消息,点击发言 - mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); - mTextView.setText(R.string.automatic_chat); - bean.setHeart(position); + 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); } }