Browse Source

feat:chat 默认背景图

tongmengxiao 9 months ago
parent
commit
6602f16e34

+ 6 - 0
baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt

@@ -43,6 +43,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var nickIcon = ""
     var account = ""
     var roomId:String = ""
+    var chatSpecial:String = ""
+    var headSpecial:String = ""
     var isAnchor = false //是否是主播点击了资料卡
     var isAdmin = false
     var isMessage = false
@@ -128,6 +130,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
                                     ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
                                         .withString("account",account)
                                         .withString("chatName",binding.tvName.text.toString())
+                                        .withString("chatSpecial" , chatSpecial)
+                                        .withString("headSpecial" , headSpecial).navigation()
                                     dismissAllowingStateLoss()
                                 } else {
                                     Toast.makeText(
@@ -175,6 +179,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             nickName = it.user_name
             nickIcon = it.user_head_img_url
             account = it.user_account
+            chatSpecial = it.android_chat_special
+            headSpecial = it.android_head_special
             binding.ivVip.visibility = if (it.is_benefit==1) View.VISIBLE else View.GONE
             Glide.with(this).load(it.user_head_img_url)
                 .placeholder(R.mipmap.default_avatar)

+ 5 - 0
baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt

@@ -7,6 +7,7 @@ import android.graphics.BitmapFactory
 import android.graphics.NinePatch
 import android.graphics.drawable.Drawable
 import android.graphics.drawable.NinePatchDrawable
+import android.text.TextUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.request.target.CustomTarget
 import com.bumptech.glide.request.transition.Transition
@@ -19,6 +20,10 @@ object DianJiuUtil {
             if (context.isDestroyed)
                 return
         }
+        if (TextUtils.isEmpty(url)){
+            drawable.invoke(null)
+            return
+        }
         Glide.with(context)
             .asFile()
             .load(url)

+ 29 - 27
home/src/main/java/com/swago/home/ChatDetailActivity.kt

@@ -47,8 +47,18 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
     @JvmField
     var chatName: String = ""
 
+    @Autowired(required = true)
+    @JvmField
+    var chatSpecial: String = ""
+
+    @Autowired(required = true)
+    @JvmField
+    var headSpecial: String = ""
+
     private var svgaParser:SVGAParser? = null
 
+    private var messageRecyclerView:MessageLayout?=null
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         ImmersionBar.with(this)
@@ -66,9 +76,6 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
         ARouter.getInstance().inject(this)
 
         svgaParser = SVGAParser(this)
-        if (!TextUtils.isEmpty(account)){
-            userVm.getOtherUserInfo(account,"")
-        }
         val chatInfo = ChatInfo()
         chatInfo.type = V2TIMConversation.V2TIM_C2C
         chatInfo.chatName = chatName
@@ -92,7 +99,7 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
             SpUtil.putString("user_info", Gson().toJson(it))
         }
 
-        val messageRecyclerView = binding.chatLayout.messageLayout
+        messageRecyclerView = binding.chatLayout.messageLayout
         messageRecyclerView?.setOnItemClickListener(object : MessageLayout.OnItemLongClickListener{
             override fun onMessageLongClick(view: View?, position: Int, messageInfo: MessageInfo?) {
 
@@ -131,40 +138,33 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
                     }
                 }
             }
-        } else {
-            messageRecyclerView?.rightBubble = ContextCompat.getDrawable(this ,R.mipmap.bg_chat_purple)
         }
 
-        userVm.otherUserInfoLiveData.observe(this){
-            if (TextUtils.isEmpty(it.android_chat_special)){
-                messageRecyclerView?.leftBubble = ContextCompat.getDrawable(this ,R.mipmap.bg_chat_white)
-            } else {
-                DianJiuUtil.loadDian9Tu(this ,it.android_chat_special ){ drawable ->
-                    drawable?.let {
-                        messageRecyclerView?.leftBubble = it
-                    }
+        if (!TextUtils.isEmpty(chatSpecial)){
+            DianJiuUtil.loadDian9Tu(this ,chatSpecial){ drawable ->
+                drawable?.let {
+                    messageRecyclerView?.leftBubble = it
                 }
             }
-            if (!TextUtils.isEmpty(it.android_head_special)){
-                svgaParser?.decodeFromURL(URL(it.android_head_special), object :SVGAParser.ParseCompletion{
-                    override fun onComplete(videoItem: SVGAVideoEntity) {
-                        val drawable = SVGADrawable(videoItem)
-                        messageRecyclerView?.leftSvgaAvatar = drawable
-                    }
+        }
 
-                    override fun onError() {
+        if (!TextUtils.isEmpty(headSpecial)){
+            svgaParser?.decodeFromURL(URL(headSpecial), object :SVGAParser.ParseCompletion{
+                override fun onComplete(videoItem: SVGAVideoEntity) {
+                    messageRecyclerView?.leftSvgaAvatar = videoItem
+                }
 
-                    }
-                })
-            }
+                override fun onError() {
+
+                }
+            })
         }
 
         if (UserInfo.getUserInfo() != null && !TextUtils.isEmpty(UserInfo.getUserInfo()?.android_head_special)){
             UserInfo.getUserInfo()?.android_head_special?.let {
                 svgaParser?.decodeFromURL(URL(it), object :SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
-                        val drawable = SVGADrawable(videoItem)
-                        messageRecyclerView?.rightSvgaAvatar = drawable
+                        messageRecyclerView?.rightSvgaAvatar = videoItem
                     }
 
                     override fun onError() {
@@ -185,7 +185,9 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
 
     override fun onDestroy() {
         super.onDestroy()
-
+        messageRecyclerView?.leftSvgaAvatar = null
+        messageRecyclerView?.rightSvgaAvatar = null
+        messageRecyclerView = null
     }
 
 }

+ 14 - 5
home/src/main/java/com/swago/home/MessageFragment.kt

@@ -25,14 +25,16 @@ import com.swago.home.official.OfficialVm
 import com.tencent.imsdk.v2.V2TIMConversation
 import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo
 import com.tencent.qcloud.tim.uikit.modules.conversation.ConversationManagerKit
+import com.tencent.qcloud.tim.uikit.modules.conversation.base.ConversationInfo
 
 /**
  *@date 2021/8/21 12:43
  *description:
  */
 class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
-
+    private val userVm by viewModels<UserVm>()
     private val officialVm by activityViewModels<OfficialVm>()
+    private var conversationInfo: ConversationInfo ?= null
 
     override fun loadData() {
         officialVm.getMsgSum()
@@ -45,10 +47,8 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
                 .permissions(Manifest.permission.RECORD_AUDIO,Manifest.permission.CAMERA)
                 .request { allGranted, grantedList, deniedList ->
                     if (allGranted) {
-                        ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
-                            .withInt("type", V2TIMConversation.V2TIM_C2C)
-                            .withString("account", messageInfo.id)
-                            .withString("chatName", messageInfo.title).navigation()
+                        conversationInfo = messageInfo
+                        userVm.getOtherUserInfo(messageInfo.id,"")
                     } else {
                         Toast.makeText(
                             AppContext.getContext(),
@@ -94,5 +94,14 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
                 binding.tvCount.visibility = View.VISIBLE
             }
         }
+        userVm.otherUserInfoLiveData.observe(this){
+            ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
+                .withInt("type", V2TIMConversation.V2TIM_C2C)
+                .withString("account", conversationInfo?.id)
+                .withString("chatName", conversationInfo?.title)
+                .withString("chatSpecial" , it.android_chat_special)
+                .withString("headSpecial" , it.android_head_special)
+                .navigation()
+        }
     }
 }

+ 4 - 0
room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt

@@ -1,6 +1,7 @@
 package com.swago.room.adapter
 
 import android.text.TextUtils
+import android.view.View
 import com.bumptech.glide.Glide
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
@@ -31,6 +32,7 @@ class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(
                 .error(R.mipmap.default_avatar).into(ivAvatar)
 
             if (!item.android_head_special.isNullOrEmpty()){
+                svgAvatar.visibility = View.VISIBLE
                 svgaParser.decodeFromURL(URL(item.android_head_special), object :SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
@@ -41,6 +43,8 @@ class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(
                     override fun onError() {
                     }
                 })
+            } else{
+                svgAvatar.visibility = View.INVISIBLE
             }
 
         }

+ 23 - 0
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -91,9 +91,13 @@ import com.swago.room.widget.ComHeaderView
 import com.swago.room.wishgift.SetWishGiftsDialog
 import com.swago.room.wishgift.WishGiftOnUserDialog
 import io.agora.rtc.IRtcEngineEventHandler
+import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.cancel
 import kotlinx.coroutines.delay
+import kotlinx.coroutines.isActive
 import kotlinx.coroutines.launch
 import java.io.File
 import java.lang.Exception
@@ -140,6 +144,8 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     abstract val iFooter: IFooter
 
     var roomConfig: RoomConfig? = null
+    val job = Job()
+    val coroutineScope = CoroutineScope(Dispatchers.Main + job)
 
     var dialog: SendMsgDialog? = null
     var gameDialog: GamePlayDialog? = null
@@ -237,6 +243,22 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
                 roomOtherVm.userDianZan()
             }
         }
+
+        coroutineScope.launch {
+            while (isActive){
+                SwagoRoomManager.iRoomInfo?.let {
+                    if (it.getRoomType() == RoomType.AUDIO.type){
+                        LogUtil.d("coroutineScope BaseComFragment ")
+                        roomVm.getAudioList(it.getAnchorId(), 2)
+                    }
+                }
+                if (SwagoRoomManager.roleType == RoleType.anchor){
+                    roomVm.loadRoomData()
+                }
+                delay(10000)
+            }
+        }
+
     }
 
     private fun initAudioRvList() {
@@ -720,6 +742,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         dialog = null
         gameDialog = null
         msgListDialog = null
+        job.cancel()
         PKStateManager.removePKListener(this)
         activity?.let {
             KeyboardUtils.unregisterSoftInputChangedListener(it.window)

+ 16 - 4
room/src/main/java/com/swago/room/dialog/MessageListDialog.kt

@@ -3,8 +3,10 @@ package com.swago.room.dialog
 import android.os.Bundle
 import android.view.Gravity
 import android.view.View
+import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.launcher.ARouter
 import com.gyf.immersionbar.ImmersionBar
+import com.swago.baseswago.UserVm
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.util.NoDoubleClickListener
@@ -12,12 +14,15 @@ import com.swago.room.databinding.DialogMessageListBinding
 import com.tencent.imsdk.v2.V2TIMConversation
 import com.tencent.qcloud.tim.uikit.modules.conversation.ConversationLayout
 import com.tencent.qcloud.tim.uikit.modules.conversation.ConversationManagerKit
+import com.tencent.qcloud.tim.uikit.modules.conversation.base.ConversationInfo
 
 /**
  *@date 2021/11/11 21:03
  *description:
  */
 class MessageListDialog : BaseXDFragment<DialogMessageListBinding>() {
+    private val userVm by viewModels<UserVm>()
+    private var conversationInfo: ConversationInfo?= null
 
     init {
         setDimAmount(0f)
@@ -38,16 +43,23 @@ class MessageListDialog : BaseXDFragment<DialogMessageListBinding>() {
         activity?.let {
             binding.conversation.initDefault()
             binding.conversation.conversationList.setOnItemClickListener { view, position, messageInfo ->
-                ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
-                    .withInt("type", V2TIMConversation.V2TIM_C2C)
-                    .withString("account",messageInfo.id)
-                    .withString("chatName",messageInfo.title).navigation()
+                conversationInfo = messageInfo
+                userVm.getOtherUserInfo(messageInfo.id,"")
             }
 
             binding.conversation.conversationList.setOnItemLongClickListener { view, position, messageInfo ->
 
             }
 
+            userVm.otherUserInfoLiveData.observe(it){
+                ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
+                    .withInt("type", V2TIMConversation.V2TIM_C2C)
+                    .withString("account", conversationInfo?.id)
+                    .withString("chatName", conversationInfo?.title)
+                    .withString("chatSpecial" , it.android_chat_special)
+                    .withString("headSpecial" , it.android_head_special)
+                    .navigation()
+            }
         }
     }
 

+ 5 - 8
room/src/main/java/com/swago/room/game/GamePlayDialog.kt

@@ -54,8 +54,6 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
 
     private val imGroupNewMsgListener = IMGroupNewMsgListener()
 
-    private var isFullScreen = false
-
     var dialogDisFun: (() -> Unit)? = null
     var openMessageFun:(()->Unit)? = null
     companion object {
@@ -85,7 +83,6 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
             if (url.startsWith("file://")){
                 localGameUrl = url
             }
-            isFullScreen = it.getBoolean(FULL_GAME,false)
             activity?.let { activity ->
 
                 webView = WebView(activity)
@@ -158,11 +155,11 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
                     params.width = DpPxUtil.getScreenWidth()
                     params.bottomToBottom = R.id.cl
 
-                    if (isFullScreen){
-                        params.height = DpPxUtil.getScreenHeight()
-                    }else{
-                        params.height = (params.width * 276 / 360f).toInt()
-                    }
+//                    if (isFullScreen){
+                    params.height = DpPxUtil.getScreenHeight()
+//                    }else{
+//                        params.height = (params.width * 276 / 360f).toInt()
+//                    }
                     this.layoutParams = params
                     binding.cl.addView(this)
                     binding.cl.addView(imageView)

+ 31 - 10
room/src/main/res/layout/view_item_gift.xml

@@ -38,17 +38,38 @@
             android:layout_width="283dp"
             android:layout_height="60dp"/>
 
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clAvatar"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:layout_marginStart="12dp"
             android:layout_marginTop="2dp"
             android:layout_marginBottom="2dp"
-            android:src="@mipmap/default_avatar"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            android:layout_width="36dp"
-            android:layout_height="36dp"/>
+            app:layout_constraintStart_toStartOf="parent">
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
+                android:src="@mipmap/default_avatar"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_width="30dp"
+                android:layout_height="30dp"/>
+
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="36dp"
+                android:layout_height="36dp"
+                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>
 
         <TextView
             android:id="@+id/tvSenderName"
@@ -60,9 +81,9 @@
             android:scrollHorizontally="true"
             android:singleLine="true"
             android:layout_marginStart="5dp"
-            app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+            app:layout_constraintStart_toEndOf="@+id/clAvatar"
             android:layout_marginTop="2dp"
-            app:layout_constraintTop_toTopOf="@+id/ivAvatar"
+            app:layout_constraintTop_toTopOf="@+id/clAvatar"
             android:layout_width="80dp"
             android:layout_height="wrap_content"/>
 
@@ -77,9 +98,9 @@
             android:scrollHorizontally="true"
             android:singleLine="true"
             android:layout_marginStart="5dp"
-            app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+            app:layout_constraintStart_toEndOf="@+id/clAvatar"
             android:layout_marginBottom="2dp"
-            app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
+            app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
             android:layout_width="80dp"
             android:layout_height="wrap_content"/>
 

+ 6 - 4
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/interfaces/IMessageProperties.java

@@ -2,6 +2,8 @@ package com.tencent.qcloud.tim.uikit.modules.chat.interfaces;
 
 import android.graphics.drawable.Drawable;
 
+import com.opensource.svgaplayer.SVGAVideoEntity;
+
 public interface IMessageProperties {
 
     /// @name 设置头像
@@ -284,26 +286,26 @@ public interface IMessageProperties {
      *
      * @return
      */
-    Drawable getRightSvgaAvatar();
+    SVGAVideoEntity getRightSvgaAvatar();
 
     /**
      * 设置右边头像框
      *
      * @param drawable
      */
-    void setRightSvgaAvatar(Drawable drawable);
+    void setRightSvgaAvatar(SVGAVideoEntity drawable);
 
     /**
      * 获取左边头像框
      *
      * @return
      */
-    Drawable getLeftSvgaAvatar();
+    SVGAVideoEntity getLeftSvgaAvatar();
 
     /**
      * 设置左边头像框
      *
      * @param drawable
      */
-    void setLeftSvgaAvatar(Drawable drawable);
+    void setLeftSvgaAvatar(SVGAVideoEntity drawable);
 }

+ 11 - 10
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/MessageLayoutUI.java

@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView;
 
 import android.util.AttributeSet;
 
+import com.opensource.svgaplayer.SVGAVideoEntity;
 import com.tencent.qcloud.tim.uikit.component.CustomLinearLayoutManager;
 import com.tencent.qcloud.tim.uikit.component.action.PopMenuAction;
 import com.tencent.qcloud.tim.uikit.modules.chat.interfaces.IMessageLayout;
@@ -105,22 +106,22 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
     }
 
     @Override
-    public Drawable getRightSvgaAvatar() {
+    public SVGAVideoEntity getRightSvgaAvatar() {
         return properties.getRightSvgaAvatar();
     }
 
     @Override
-    public void setRightSvgaAvatar(Drawable drawable) {
+    public void setRightSvgaAvatar(SVGAVideoEntity drawable) {
         properties.setRightSvgaAvatar(drawable);
     }
 
     @Override
-    public Drawable getLeftSvgaAvatar() {
+    public SVGAVideoEntity getLeftSvgaAvatar() {
         return properties.getLeftSvgaAvatar();
     }
 
     @Override
-    public void setLeftSvgaAvatar(Drawable drawable) {
+    public void setLeftSvgaAvatar(SVGAVideoEntity drawable) {
         properties.setLeftSvgaAvatar(drawable);
     }
 
@@ -305,8 +306,8 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
         private int mChatTimeFontSize;
         private int mChatTimeFontColor;
         private Drawable mChatTimeBubble;
-        private Drawable mMySvgaAvatar;
-        private Drawable mFriendSvgaAvatar;
+        private SVGAVideoEntity mMySvgaAvatar;
+        private SVGAVideoEntity mFriendSvgaAvatar;
 
         private Properties() {
 
@@ -504,22 +505,22 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
         }
 
         @Override
-        public Drawable getRightSvgaAvatar() {
+        public SVGAVideoEntity getRightSvgaAvatar() {
             return mMySvgaAvatar;
         }
 
         @Override
-        public void setRightSvgaAvatar(Drawable drawable) {
+        public void setRightSvgaAvatar(SVGAVideoEntity drawable) {
             this.mMySvgaAvatar = drawable;
         }
 
         @Override
-        public Drawable getLeftSvgaAvatar() {
+        public SVGAVideoEntity getLeftSvgaAvatar() {
             return mFriendSvgaAvatar;
         }
 
         @Override
-        public void setLeftSvgaAvatar(Drawable drawable) {
+        public void setLeftSvgaAvatar(SVGAVideoEntity drawable) {
             this.mFriendSvgaAvatar = drawable;
         }
     }

+ 14 - 4
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/holder/MessageContentHolder.java

@@ -18,6 +18,8 @@ import com.tencent.qcloud.tim.uikit.R;
 import com.tencent.qcloud.tim.uikit.config.TUIKitConfigs;
 import com.tencent.qcloud.tim.uikit.modules.message.MessageInfo;
 import com.tencent.qcloud.tim.uikit.utils.ToastUtil;
+import com.opensource.svgaplayer.SVGADrawable;
+
 
 import de.hdodenhof.circleimageview.CircleImageView;
 
@@ -125,22 +127,30 @@ public abstract class MessageContentHolder extends MessageEmptyHolder {
             if (properties.getRightBubble() != null && properties.getRightBubble().getConstantState() != null) {
                 msgContentFrame.setBackground(properties.getRightBubble().getConstantState().newDrawable());
             } else {
-                msgContentFrame.setBackgroundResource(R.drawable.chat_bubble_myself);
+                msgContentFrame.setBackgroundResource(R.drawable.bg_chat_purple);
             }
             if (properties.getRightSvgaAvatar() != null){
-                rightSvgaImage.setImageDrawable(properties.getRightSvgaAvatar());
+                SVGADrawable drawable = new SVGADrawable(properties.getRightSvgaAvatar());
+                rightSvgaImage.setVisibility(View.VISIBLE);
+                rightSvgaImage.setImageDrawable(drawable);
                 rightSvgaImage.startAnimation();
+            }else {
+                rightSvgaImage.setVisibility(View.INVISIBLE);
             }
         } else {
             if (properties.getLeftBubble() != null && properties.getLeftBubble().getConstantState() != null) {
                 msgContentFrame.setBackground(properties.getLeftBubble().getConstantState().newDrawable());
                 msgContentFrame.setLayoutParams(msgContentFrame.getLayoutParams());
             } else {
-                msgContentFrame.setBackgroundResource(R.drawable.chat_other_bg);
+                msgContentFrame.setBackgroundResource(R.drawable.bg_chat_white);
             }
             if (properties.getLeftSvgaAvatar() != null){
-                leftSvgaImage.setImageDrawable(properties.getLeftSvgaAvatar());
+                SVGADrawable drawable = new SVGADrawable(properties.getLeftSvgaAvatar());
+                leftSvgaImage.setVisibility(View.VISIBLE);
+                leftSvgaImage.setImageDrawable(drawable);
                 leftSvgaImage.startAnimation();
+            } else {
+                leftSvgaImage.setVisibility(View.INVISIBLE);
             }
         }
 

+ 0 - 0
baseswago/src/main/res/mipmap-xxhdpi/bg_chat_purple.9.png → tuikit/src/main/res/drawable-xxhdpi/bg_chat_purple.9.png


+ 0 - 0
baseswago/src/main/res/mipmap-xxhdpi/bg_chat_white.9.png → tuikit/src/main/res/drawable-xxhdpi/bg_chat_white.9.png