From d80bc3bd27bab550eb5a80752c389c442e405bec Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 23 Mar 2023 17:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=B0=94=E6=B3=A1=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/CommonHttpUtil.java | 2 ++ .../com/yunbao/common/manager/IMLoginManager.java | 9 +++++++++ .../com/yunbao/live/adapter/LiveChatAdapter.java | 4 ++-- .../com/yunbao/live/utils/LoadDian9TuUtil.java | 14 +++++++++++--- .../com/yunbao/live/views/LiveRoomViewHolder.java | 4 ++-- live/src/main/res/drawable/chat_message_bg.xml | 2 +- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 88af69746..b216485f4 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -217,6 +217,8 @@ public class CommonHttpUtil { } if (obj.containsKey("clarity")) { IMLoginManager.get(context).setClarity(obj.getString("clarity")); + } if (obj.containsKey("defaultBubbleUrl")) { + IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl")); } } catch (Exception e) { String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index bede5737f..71781ef36 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -42,6 +42,15 @@ public class IMLoginManager extends BaseCacheManager { private final String SELECT_CLARITY = "selectClarity"; private final String CLARITY = "clarity"; private final String xiaJBG = "xiaJBG"; + private final String keyDefaultBubbleUrl = "defaultBubbleUrl"; + + public void setDefaultBubbleUrl(String defaultBubbleUrl) { + put(keyDefaultBubbleUrl, defaultBubbleUrl); + } + + public String getKeyDefaultBubbleUrl() { + return getString(keyDefaultBubbleUrl); + } public void setXiaJBG(boolean xjbg) { put(xiaJBG, xjbg); 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 0dc495d09..2182a1364 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -211,7 +211,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { itemView.setTag(bean); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.setMargins(0, 0, DpUtil.dp2px(95), 0); + params.setMargins(0, 0, DpUtil.dp2px(110), 0); params.gravity = Gravity.CENTER_VERTICAL; mBg.setLayoutParams(params); if (bean.getType() == 6) {//大作战活动 @@ -364,7 +364,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { // } else if (bean.getType() == -2) {//自动消息,点击发言 LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params3.setMargins(0, 8, DpUtil.dp2px(95), 8); + params3.setMargins(0, 8, DpUtil.dp2px(110), 8); params3.gravity = Gravity.CENTER_VERTICAL; mBg.setLayoutParams(params3); mBg.setBackground(null); diff --git a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java index 3d6100d25..634f805c9 100644 --- a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java +++ b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java @@ -9,6 +9,7 @@ import android.graphics.NinePatch; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.os.Build; +import android.text.TextUtils; import android.view.View; import androidx.annotation.NonNull; @@ -17,6 +18,7 @@ import androidx.annotation.Nullable; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.live.activity.LiveActivity; import java.io.File; @@ -65,9 +67,15 @@ public class LoadDian9TuUtil { } public void loadDian9TuAssets(Context context, View imageView, int position) { - Bitmap bitmap = getImageFromAssetsFile(context, "chat_message_bg.png"); - BITMAP_CACHE.add(bitmap); - setNinePathImage(context, imageView, bitmap, position); + if (TextUtils.isEmpty(IMLoginManager.get(context).getKeyDefaultBubbleUrl())) { + Bitmap bitmap = getImageFromAssetsFile(context, "chat_message_bg.png"); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + } else { + String url = IMLoginManager.get(context).getKeyDefaultBubbleUrl(); + loadDian9Tu(context, imageView,url, 1); + } + } public void loadDian9TuAssets2(Context context, View imageView, String fileName, int position) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index f25e3752f..f82402c29 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -4212,10 +4212,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); if (landscape == 2) { - params1.height = DpUtil.dp2px(180); + params1.height = DpUtil.dp2px(200); } else { - params1.height = DpUtil.dp2px(300); + params1.height = DpUtil.dp2px(310); } mChatRecyclerView.setLayoutParams(params1); diff --git a/live/src/main/res/drawable/chat_message_bg.xml b/live/src/main/res/drawable/chat_message_bg.xml index debf06ab0..c63169e27 100644 --- a/live/src/main/res/drawable/chat_message_bg.xml +++ b/live/src/main/res/drawable/chat_message_bg.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file