Browse Source

feat:私聊背景图

tongmengxiao 6 months ago
parent
commit
fd36dceac8

+ 1 - 0
baseswago/src/main/java/com/swago/baseswago/model/im/RoomChatMsgBean.java

@@ -15,6 +15,7 @@ public class RoomChatMsgBean implements IRoomChat {
     public String sendName="";
     public String sendName="";
     public String content="";
     public String content="";
     public String roomId="";
     public String roomId="";
+    public String chat_special="";
     public int senderLevel;
     public int senderLevel;
     public int isBenefit;
     public int isBenefit;
     public int isPrettyAccount;
     public int isPrettyAccount;

+ 3 - 0
room/src/main/java/com/swago/room/adapter/AudienceAdapter.kt

@@ -36,6 +36,7 @@ class AudienceAdapter : BaseQuickAdapter<RoomUserModel.ListBean, BaseViewHolder>
             itemView.findViewById<SwagoLevelView>(R.id.tvLevel).setUserLevel(item.user_wealth_level)
             itemView.findViewById<SwagoLevelView>(R.id.tvLevel).setUserLevel(item.user_wealth_level)
 
 
             if (!item.head_special.isNullOrEmpty()){
             if (!item.head_special.isNullOrEmpty()){
+                svgAvatar.visibility = View.VISIBLE
                 svgaParser.decodeFromURL(URL(item.head_special), object :SVGAParser.ParseCompletion{
                 svgaParser.decodeFromURL(URL(item.head_special), object :SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
                         val drawable = SVGADrawable(videoItem)
@@ -46,6 +47,8 @@ class AudienceAdapter : BaseQuickAdapter<RoomUserModel.ListBean, BaseViewHolder>
                     override fun onError() {
                     override fun onError() {
                     }
                     }
                 })
                 })
+            } else {
+                svgAvatar.visibility = View.INVISIBLE
             }
             }
         }
         }
     }
     }

+ 2 - 2
room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt

@@ -211,8 +211,8 @@ class RoomChatAdapter :
                         setBackgroundRes(R.id.tvContent, R.drawable.shape_20000000_14)
                         setBackgroundRes(R.id.tvContent, R.drawable.shape_20000000_14)
                     }
                     }
                     mContext?.let {
                     mContext?.let {
-                        UserInfo.getUserInfo()?.chat_special?.let {chatUrl ->
-                            DianJiuUtil.loadDian9Tu(it ,chatUrl ){ drawable ->
+                        if (item is RoomChatMsgBean&&!item.chat_special.isNullOrEmpty()){
+                            DianJiuUtil.loadDian9Tu(it ,item.chat_special ){ drawable ->
                                 drawable?.let { drawable ->
                                 drawable?.let { drawable ->
                                     tvContent.background = drawable
                                     tvContent.background = drawable
                                 }
                                 }

+ 2 - 0
room/src/main/java/com/swago/room/dialog/SendMsgDialog.kt

@@ -157,6 +157,7 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
                             roomChatMsgBean.isCup = it.is_cup
                             roomChatMsgBean.isCup = it.is_cup
                             roomChatMsgBean.isAdmin = SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0
                             roomChatMsgBean.isAdmin = SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0
                             roomChatMsgBean.isFans = SwagoRoomManager.iRoomInfo?.getIsFans()?:0
                             roomChatMsgBean.isFans = SwagoRoomManager.iRoomInfo?.getIsFans()?:0
+                            roomChatMsgBean.chat_special = it.chat_special
 
 
                             val jsonObject = JSONObject()
                             val jsonObject = JSONObject()
                             jsonObject.put("senderId", it.id)
                             jsonObject.put("senderId", it.id)
@@ -172,6 +173,7 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
                             jsonObject.put("isCup", it.is_cup)
                             jsonObject.put("isCup", it.is_cup)
                             jsonObject.put("isAdmin", SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0)
                             jsonObject.put("isAdmin", SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0)
                             jsonObject.put("isFans", SwagoRoomManager.iRoomInfo?.getIsFans()?:0)
                             jsonObject.put("isFans", SwagoRoomManager.iRoomInfo?.getIsFans()?:0)
+                            jsonObject.put("chat_special", it.chat_special)
 
 
                             val jsonObjectType = JSONObject()
                             val jsonObjectType = JSONObject()
                             jsonObjectType.put("type", room_chat_text)
                             jsonObjectType.put("type", room_chat_text)

+ 2 - 0
room/src/main/java/com/swago/room/hongbao/RedEnvelopResultDialog.kt

@@ -107,6 +107,7 @@ class RedEnvelopResultDialog : BaseXDFragment<DialogRedEnvelopeResultBinding>()
                 roomChatMsgBean.isCup = it.is_cup
                 roomChatMsgBean.isCup = it.is_cup
                 roomChatMsgBean.isAdmin = SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0
                 roomChatMsgBean.isAdmin = SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0
                 roomChatMsgBean.isFans = SwagoRoomManager.iRoomInfo?.getIsFans()?:0
                 roomChatMsgBean.isFans = SwagoRoomManager.iRoomInfo?.getIsFans()?:0
+                roomChatMsgBean.chat_special = it.chat_special
                 addSenderMsgToRoomChatList?.invoke(roomChatMsgBean)
                 addSenderMsgToRoomChatList?.invoke(roomChatMsgBean)
 
 
                 val jsonObject = JSONObject()
                 val jsonObject = JSONObject()
@@ -123,6 +124,7 @@ class RedEnvelopResultDialog : BaseXDFragment<DialogRedEnvelopeResultBinding>()
                 jsonObject.put("isCup", it.is_cup)
                 jsonObject.put("isCup", it.is_cup)
                 jsonObject.put("isAdmin", SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0)
                 jsonObject.put("isAdmin", SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0)
                 jsonObject.put("isFans", SwagoRoomManager.iRoomInfo?.getIsFans()?:0)
                 jsonObject.put("isFans", SwagoRoomManager.iRoomInfo?.getIsFans()?:0)
+                jsonObject.put("chat_special", it.chat_special)
 
 
                 val jsonObjectType = JSONObject()
                 val jsonObjectType = JSONObject()
                 jsonObjectType.put("type", ImConstant.room_chat_text)
                 jsonObjectType.put("type", ImConstant.room_chat_text)

+ 22 - 33
room/src/main/res/layout/view_user_join_room.xml

@@ -76,49 +76,38 @@
             android:layout_width="260dp"
             android:layout_width="260dp"
             android:layout_height="60dp">
             android:layout_height="60dp">
 
 
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:id="@+id/clAvatar"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintBottom_toBottomOf="parent"
-                android:layout_marginStart="8dp">
-                <de.hdodenhof.circleimageview.CircleImageView
-                    android:id="@+id/ivAvatar"
-                    app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintEnd_toEndOf="parent"
-                    android:layout_width="36dp"
-                    android:layout_height="36dp"/>
-                <com.opensource.svgaplayer.SVGAImageView
-                    android:id="@+id/svgAvatar"
-                    android:layout_width="44dp"
-                    android:layout_height="44dp"
-                    android:visibility="visible"
-                    app:autoPlay="true"
-                    app:loopCount="0"
-                    app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:layout_constraintEnd_toEndOf="parent"
-                    app:layout_constraintBottom_toBottomOf="parent"/>
-            </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-
+                android:layout_marginStart="12dp"
+                android:layout_width="36dp"
+                android:layout_height="36dp"/>
+
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="44dp"
+                android:layout_height="44dp"
+                android:visibility="visible"
+                app:autoPlay="true"
+                app:loopCount="0"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                android:layout_marginStart="8dp"/>
             <com.swago.baseswago.cusview.SwagoLevelView
             <com.swago.baseswago.cusview.SwagoLevelView
                 android:id="@+id/swagoLevel"
                 android:id="@+id/swagoLevel"
                 android:layout_marginStart="5dp"
                 android:layout_marginStart="5dp"
-                app:layout_constraintStart_toEndOf="@+id/clAvatar"
-                app:layout_constraintTop_toTopOf="@+id/clAvatar"
+                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintTop_toTopOf="@+id/ivAvatar"
                 android:layout_width="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"/>
                 android:layout_height="wrap_content"/>
 
 
             <TextView
             <TextView
                 android:id="@+id/tvName"
                 android:id="@+id/tvName"
                 app:layout_constraintStart_toEndOf="@+id/swagoLevel"
                 app:layout_constraintStart_toEndOf="@+id/swagoLevel"
-                app:layout_constraintTop_toTopOf="@+id/clAvatar"
+                app:layout_constraintTop_toTopOf="@+id/ivAvatar"
                 android:layout_marginStart="5dp"
                 android:layout_marginStart="5dp"
                 android:layout_marginEnd="20dp"
                 android:layout_marginEnd="20dp"
                 android:textSize="12dp"
                 android:textSize="12dp"
@@ -131,8 +120,8 @@
 
 
             <TextView
             <TextView
                 android:id="@+id/tvJoin"
                 android:id="@+id/tvJoin"
-                app:layout_constraintStart_toEndOf="@+id/clAvatar"
-                app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
                 android:layout_marginEnd="20dp"
                 android:layout_marginEnd="20dp"
                 android:layout_marginStart="5dp"
                 android:layout_marginStart="5dp"
                 android:textSize="10dp"
                 android:textSize="10dp"

+ 1 - 1
tuikit/src/main/res/layout/message_adapter_content_text.xml

@@ -3,7 +3,7 @@
     android:layout_width="wrap_content"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_height="wrap_content"
     android:gravity="center_vertical"
     android:gravity="center_vertical"
-    android:minHeight="31dp"
+    android:minHeight="36dp"
     android:orientation="horizontal">
     android:orientation="horizontal">
 
 
     <TextView
     <TextView

+ 37 - 59
tuikit/src/main/res/layout/message_adapter_item_content.xml

@@ -38,70 +38,48 @@
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
         android:layout_width="match_parent">
         android:layout_width="match_parent">
 
 
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/cl_left"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+
+        <de.hdodenhof.circleimageview.CircleImageView
+            android:id="@+id/left_user_icon_view"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:layout_alignParentLeft="true"
+            android:layout_marginRight="6.23dp"
+            android:visibility="gone"
+            android:scaleType="centerCrop"/>
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_left"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="visible"
+            app:autoPlay="true"
+            app:loopCount="0"
             android:layout_alignParentLeft="true"
             android:layout_alignParentLeft="true"
-            android:layout_marginRight="6.23dp">
-            <de.hdodenhof.circleimageview.CircleImageView
-                android:id="@+id/left_user_icon_view"
-                android:layout_width="41dp"
-                android:layout_height="41dp"
-                android:visibility="gone"
-                android:scaleType="centerCrop"
-                app:layout_constraintTop_toTopOf="parent"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"/>
-            <com.opensource.svgaplayer.SVGAImageView
-                android:id="@+id/svgAvatar_left"
-                android:layout_width="41dp"
-                android:layout_height="41dp"
-                android:visibility="visible"
-                app:autoPlay="true"
-                app:loopCount="0"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintBottom_toBottomOf="parent"/>
-        </androidx.constraintlayout.widget.ConstraintLayout>
+            android:layout_marginRight="6.23dp"/>
 
 
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/cl_right"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+        <de.hdodenhof.circleimageview.CircleImageView
+            android:id="@+id/right_user_icon_view"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
             android:layout_alignParentRight="true"
             android:layout_alignParentRight="true"
-            android:layout_marginLeft="6.23dp">
-            <de.hdodenhof.circleimageview.CircleImageView
-                android:id="@+id/right_user_icon_view"
-                android:layout_width="41dp"
-                android:layout_height="41dp"
-                android:scaleType="centerCrop"
-                android:visibility="gone"
-                app:layout_constraintTop_toTopOf="parent"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"/>
-            <com.opensource.svgaplayer.SVGAImageView
-                android:id="@+id/svgAvatar_right"
-                android:layout_width="41dp"
-                android:layout_height="41dp"
-                android:visibility="visible"
-                app:autoPlay="true"
-                app:loopCount="0"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintBottom_toBottomOf="parent"/>
-        </androidx.constraintlayout.widget.ConstraintLayout>
-
+            android:layout_marginLeft="6.23dp"
+            android:scaleType="centerCrop"
+            android:visibility="gone"/>
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_right"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="visible"
+            app:autoPlay="true"
+            app:loopCount="0"
+            android:layout_alignParentRight="true"
+            android:layout_marginLeft="6.23dp"/>
         <TextView
         <TextView
             android:id="@+id/user_name_tv"
             android:id="@+id/user_name_tv"
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_toLeftOf="@+id/cl_right"
-            android:layout_toRightOf="@+id/cl_left"
+            android:layout_toLeftOf="@+id/right_user_icon_view"
+            android:layout_toRightOf="@+id/left_user_icon_view"
             android:layout_marginBottom="3.68dp"
             android:layout_marginBottom="3.68dp"
             android:textColor="@color/text_tips_color"
             android:textColor="@color/text_tips_color"
             android:layout_marginLeft="6.67dp"
             android:layout_marginLeft="6.67dp"
@@ -113,8 +91,8 @@
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@+id/user_name_tv"
             android:layout_below="@+id/user_name_tv"
-            android:layout_toLeftOf="@+id/cl_right"
-            android:layout_toRightOf="@+id/cl_left"
+            android:layout_toLeftOf="@+id/right_user_icon_view"
+            android:layout_toRightOf="@+id/left_user_icon_view"
             android:orientation="horizontal">
             android:orientation="horizontal">
 
 
             <com.tencent.qcloud.tim.uikit.component.UnreadCountTextView
             <com.tencent.qcloud.tim.uikit.component.UnreadCountTextView