tongmengxiao před 6 měsíci
rodič
revize
9a01c6d64d
40 změnil soubory, kde provedl 540 přidání a 128 odebrání
  1. 36 10
      baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt
  2. 1 2
      baseswago/src/main/java/com/swago/baseswago/UserVm.kt
  3. 5 0
      baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt
  4. 4 0
      baseswago/src/main/java/com/swago/baseswago/model/im/UserJoinRoomBean.java
  5. 37 0
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java
  6. 9 1
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomUserModel.java
  7. 5 2
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSeatModel.kt
  8. 1 0
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioModel.kt
  9. 2 1
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioSeatUpdateModel.kt
  10. 1 0
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/MaiUserModel.kt
  11. 16 5
      baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt
  12. 0 1
      baseswago/src/main/res/layout/dialog_person_data.xml
  13. 9 0
      baseswago/src/main/res/values-ar/strings.xml
  14. 9 0
      baseswago/src/main/res/values-in/strings.xml
  15. 9 0
      baseswago/src/main/res/values-ms/strings.xml
  16. 9 0
      baseswago/src/main/res/values-zh/strings.xml
  17. 9 0
      baseswago/src/main/res/values/strings.xml
  18. 22 4
      home/src/main/java/com/swago/home/ChatDetailActivity.kt
  19. 13 13
      home/src/main/java/com/swago/home/MineFragment.kt
  20. 22 0
      room/src/main/java/com/swago/room/adapter/AudienceAdapter.kt
  21. 55 28
      room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt
  22. 25 1
      room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt
  23. 23 1
      room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt
  24. 16 0
      room/src/main/java/com/swago/room/bean/UserRoomModel.kt
  25. 22 0
      room/src/main/java/com/swago/room/gift/audio/MaiUserAdapter.kt
  26. 2 1
      room/src/main/java/com/swago/room/vm/MsgVm.kt
  27. 21 0
      room/src/main/java/com/swago/room/widget/ComHeaderView.kt
  28. 0 1
      room/src/main/res/layout/item_audio_seat.xml
  29. 0 1
      room/src/main/res/layout/item_dialog_audience.xml
  30. 11 1
      room/src/main/res/layout/item_mai_user.xml
  31. 0 1
      room/src/main/res/layout/item_room_user.xml
  32. 0 1
      room/src/main/res/layout/layout_user_header_view.xml
  33. 3 0
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/conversation/holder/ConversationCommonHolder.java
  34. 21 1
      tuikit/src/main/res/layout/conversation_adapter.xml
  35. 58 19
      tuikit/src/main/res/layout/message_adapter_item_content.xml
  36. 17 12
      user/src/main/java/com/swago/user/store/StoreBuyDialog.kt
  37. 33 12
      user/src/main/java/com/swago/user/store/StoreListActivity.kt
  38. 5 0
      user/src/main/java/com/swago/user/vm/StoreVm.kt
  39. 8 8
      user/src/main/res/layout/activity_store_list.xml
  40. 1 1
      user/src/main/res/layout/dialog_store_detail.xml

+ 36 - 10
baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt

@@ -9,6 +9,9 @@ import android.widget.Toast
 import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.launcher.ARouter
 import com.bumptech.glide.Glide
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.permissionx.guolindev.PermissionX
 import com.swago.baseswago.baseroom.SwagoRoomManager
 import com.swago.baseswago.constant.ARouteConstant
@@ -21,6 +24,9 @@ import com.swago.baseswago.util.BitmapUtils
 import com.swago.baseswago.util.IMUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.UserInfo
+import com.swago.loadUrl
+import com.swago.loadUrlNoPlaceHolder
+import java.net.URL
 
 /**
  *@date 2021/8/27 17:14
@@ -36,6 +42,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var nickName = ""
     var nickIcon = ""
     var account = ""
+    var chatSpecial = ""
     var roomId:String = ""
     var isAnchor = false //是否是主播点击了资料卡
     var isAdmin = false
@@ -45,8 +52,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var openGiftDialog:((nickName:String,userId:String)->Unit)? = null
     var openGiftIconDialog:((nickName:String,userId:String,nickIcon:String)->Unit)? = null
     var sendMsgInRoom:((nickName:String)->Unit)? = null
-    private val badgeBitmap by lazy {
-        BitmapUtils.getBitmapFromPath(UserInfo.getUserInfo()?.badge_special)
+    val svgaParser by lazy {
+        SVGAParser(activity)
     }
 
     companion object{
@@ -121,7 +128,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
                                 if (allGranted) {
                                     ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
                                         .withString("account",account)
-                                        .withString("chatName",binding.tvName.text.toString()).navigation()
+                                        .withString("chatName",binding.tvName.text.toString())
+                                        .withString("chatSpecial",chatSpecial).navigation()
                                     dismissAllowingStateLoss()
                                 } else {
                                     Toast.makeText(
@@ -169,6 +177,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             nickName = it.user_name
             nickIcon = it.user_head_img_url
             account = it.user_account
+            chatSpecial = it.chat_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)
@@ -239,15 +248,32 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             }
 
             isAdmin = it.is_room_admin == 1
-        }
 
-        if (badgeBitmap == null){
-            binding.ivBadge.visibility = View.GONE
-        } else {
-            binding.ivBadge.setImageBitmap(badgeBitmap)
-            binding.ivBadge.visibility = View.VISIBLE
-        }
+            if (!TextUtils.isEmpty(it.head_special)){
+                svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        binding.svgAvatar.setImageDrawable(drawable)
+                        binding.svgAvatar.startAnimation()
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            }
+            if (TextUtils.isEmpty(it.badge_special)){
+                binding.ivBadge.visibility = View.GONE
+            } else {
+                activity?.let { activity ->
+                    Glide.with(activity)
+                        .load(it.badge_special)
+                        .override(200)
+                        .into(binding.ivBadge)
+                    binding.ivBadge.visibility = View.VISIBLE
+                }
 
+            }
+        }
         userVm.followStateLiveData.observe(this) {
             if (isFollow == 0) {
                 isFollow = 1

+ 1 - 2
baseswago/src/main/java/com/swago/baseswago/UserVm.kt

@@ -46,8 +46,7 @@ class UserVm(application: Application) : BaseViewModel(application) {
         requestData {
             val data = ApiManager.userApi.getUserInfo()
             userInfoLiveData.value = data
-            BitmapUtils.loadFile(AppContext.getContext() , data.badge_special,207,60)
-            BitmapUtils.loadFile(AppContext.getContext() , data.chat_special,134,134)
+            BitmapUtils.loadFile(AppContext.getContext() , "https://apple-1304432552.cos.ap-shanghai.myqcloud.com/1.png",207,60)
         }
     }
 

+ 5 - 0
baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt

@@ -46,4 +46,9 @@ interface IRoomInfo {
     fun getRoomBg():String //获取房间背景图
 
     fun getPassStatus():Int //是否密码房(1是0否)
+
+    fun getJoinSpecial():String //加入直播间特效
+    fun getHeadSpecial():String //头像框
+    fun getBadgeSpecial():String //徽章
+    fun getChatSpecial():String //聊天气泡
 }

+ 4 - 0
baseswago/src/main/java/com/swago/baseswago/model/im/UserJoinRoomBean.java

@@ -29,6 +29,10 @@ public class UserJoinRoomBean implements IRoomChat {
     public int isCrown;
     public int isCup;
     public int isFans;
+    public String joinSpecial="";
+    public String headSpecial="";
+    public String badgeSpecial="";
+    public String chatSpecial="";
 
     @NonNull
     @Override

+ 37 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java

@@ -55,6 +55,11 @@ public class RoomModel {
 
     private String broadcast_bg_url;
 
+    private String join_special;
+    private String head_special;
+    private String badge_special;
+    private String chat_special;
+
     private CusNewMsgBean<RoomUserChangeModel> join_im_data;
 
     public String getRtc_token() {
@@ -280,4 +285,36 @@ public class RoomModel {
     public void setJoin_im_data(CusNewMsgBean<RoomUserChangeModel> join_im_data) {
         this.join_im_data = join_im_data;
     }
+
+    public String getJoin_special() {
+        return join_special;
+    }
+
+    public void setJoin_special(String join_special) {
+        this.join_special = join_special;
+    }
+
+    public String getHead_special() {
+        return head_special;
+    }
+
+    public void setHead_special(String head_special) {
+        this.head_special = head_special;
+    }
+
+    public String getBadge_special() {
+        return badge_special;
+    }
+
+    public void setBadge_special(String badge_special) {
+        this.badge_special = badge_special;
+    }
+
+    public String getChat_special() {
+        return chat_special;
+    }
+
+    public void setChat_special(String chat_special) {
+        this.chat_special = chat_special;
+    }
 }

+ 9 - 1
baseswago/src/main/java/com/swago/baseswago/model/live/RoomUserModel.java

@@ -54,8 +54,8 @@ public class RoomUserModel {
         private int is_official;
         private int is_crown;
         private int is_cup;
-
         private String contribute_val;
+        private String head_special;
 
         public String getUser_id() {
             return user_id;
@@ -169,5 +169,13 @@ public class RoomUserModel {
         public void setContribute_val(String contribute_val) {
             this.contribute_val = contribute_val;
         }
+
+        public String getHead_special() {
+            return head_special;
+        }
+
+        public void setHead_special(String head_special) {
+            this.head_special = head_special;
+        }
     }
 }

+ 5 - 2
baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSeatModel.kt

@@ -12,7 +12,8 @@ data class AudioSeatModel(
     var voice_jifen:String?,//积分
     var voice_user_id:String?,//被谁给闭麦
     val maiIndex:Int,//积分
-    var showVoice:Int //说话闪烁 1显示 0隐藏
+    var showVoice:Int, //说话闪烁 1显示 0隐藏
+    var head_special:String? //头像框
 ) : Parcelable {
     constructor(parcel: Parcel) : this(
         parcel.readString(),
@@ -23,7 +24,8 @@ data class AudioSeatModel(
         parcel.readString(),
         parcel.readString(),
         parcel.readInt(),
-        parcel.readInt()
+        parcel.readInt(),
+        parcel.readString()
     ) {
     }
 
@@ -37,6 +39,7 @@ data class AudioSeatModel(
         parcel.writeString(voice_user_id)
         parcel.writeInt(maiIndex)
         parcel.writeInt(showVoice)
+        parcel.writeString(head_special)
     }
 
     override fun describeContents(): Int {

+ 1 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioModel.kt

@@ -14,4 +14,5 @@ data class IMAudioModel(
     val applyId:String,
     val voice_jifen:String,
     val notice: String,
+    val head_special: String
 )

+ 2 - 1
baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioSeatUpdateModel.kt

@@ -14,5 +14,6 @@ data class IMAudioSeat(
     val userAvatar:String,
     val userId:String,
     val userName:String,
-    val voiceUserId:String
+    val voiceUserId:String,
+    val head_special :String
 )

+ 1 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/audio/MaiUserModel.kt

@@ -9,4 +9,5 @@ data class MaiUserInfo(
     val user_id: String,
     val user_name: String,
     var selected:Boolean,
+    var head_special: String?=""
 )

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

@@ -3,6 +3,7 @@ package com.swago.baseswago.util
 import android.app.Activity
 import android.content.Context
 import android.graphics.Bitmap
+import android.graphics.BitmapFactory
 import android.graphics.NinePatch
 import android.graphics.drawable.Drawable
 import android.graphics.drawable.NinePatchDrawable
@@ -11,21 +12,23 @@ import com.bumptech.glide.Glide
 import com.bumptech.glide.request.target.CustomTarget
 import com.bumptech.glide.request.transition.Transition
 import java.io.File
+import java.io.FileInputStream
 import java.io.FileOutputStream
 import java.io.IOException
 
 object DianJiuUtil {
-    fun loadDian9Tu(context: Context, url: String, drawable: (e: Drawable?) -> Unit){
+    fun loadDian9Tu(context: Context, url: String, drawable: (e: NinePatchDrawable?) -> Unit){
         if (context is Activity){
             if (context.isDestroyed)
                 return
         }
         Glide.with(context)
-            .asBitmap()
+            .asFile()
             .load(url)
-            .into(object : CustomTarget<Bitmap>() {
-                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
-                    drawable.invoke(setNinePatchImage(context , resource))
+            .into(object : CustomTarget<File>() {
+                override fun onResourceReady(resource: File, transition: Transition<in File>?) {
+                    val fileInputStream = FileInputStream(resource)
+                    ninePatchImageDrawable(context , BitmapFactory.decodeStream(fileInputStream) , drawable)
                 }
 
                 override fun onLoadCleared(placeholder: Drawable?) {
@@ -34,6 +37,14 @@ object DianJiuUtil {
             })
     }
 
+    fun ninePatchImageDrawable(context: Context, bitmap: Bitmap, drawable: (e: NinePatchDrawable?) -> Unit) {
+        val chunk = bitmap.ninePatchChunk
+        if (NinePatch.isNinePatchChunk(chunk)){
+            drawable.invoke(NinePatchDrawable(context.resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null))
+        }
+        drawable.invoke(null)
+    }
+
     fun setNinePatchImage(context: Context, bitmap: Bitmap): NinePatchDrawable? {
         val chunk = bitmap.ninePatchChunk
         if (NinePatch.isNinePatchChunk(chunk)){

+ 0 - 1
baseswago/src/main/res/layout/dialog_person_data.xml

@@ -362,7 +362,6 @@
                 android:layout_width="80dp"
                 android:layout_height="80dp"
                 android:visibility="visible"
-                app:source="avatar.svga"
                 app:autoPlay="true"
                 app:loopCount="0"
                 app:layout_constraintStart_toStartOf="parent"

+ 9 - 0
baseswago/src/main/res/values-ar/strings.xml

@@ -313,4 +313,13 @@
     <string name="dress_up">إرتد ملابس</string>
     <string name="mall">مجمع تجاري</string>
     <string name="buy_it_now">اشتر الآن</string>
+    <string name="entrance_effects">تأثيرات المدخل</string>
+    <string name="avatar_frame">إطار الصورة الرمزية</string>
+    <string name="badge">شارة</string>
+    <string name="chat_bubble">فقاعة الدردشة</string>
+    <string name="more">أكثر</string>
+    <string name="take_back">استرجع</string>
+    <string name="this_product_has_been_purchased">لقد تم شراء هذا المنتج</string>
+    <string name="purchase_successful">تم الشراء بنجاح</string>
+    <string name="no_time_limit">لا يوجد حد زمني</string>
 </resources>

+ 9 - 0
baseswago/src/main/res/values-in/strings.xml

@@ -317,4 +317,13 @@
     <string name="dress_up">Berpakaian</string>
     <string name="mall">Toko</string>
     <string name="buy_it_now">Beli sekarang</string>
+    <string name="entrance_effects">Efek masuk</string>
+    <string name="avatar_frame">Bingkai avatar</string>
+    <string name="badge">Badge</string>
+    <string name="chat_bubble">chat bubble</string>
+    <string name="more">lebih banyak</string>
+    <string name="take_back">ambil kembali</string>
+    <string name="this_product_has_been_purchased">Produk ini telah dibeli</string>
+    <string name="purchase_successful">Pembelian berhasil</string>
+    <string name="no_time_limit">Tidak ada batas waktu</string>
 </resources>

+ 9 - 0
baseswago/src/main/res/values-ms/strings.xml

@@ -314,4 +314,13 @@
     <string name="dress_up">Berpakaian</string>
     <string name="mall">Toko</string>
     <string name="buy_it_now">Beli sekarang</string>
+    <string name="entrance_effects">Efek masuk</string>
+    <string name="avatar_frame">Bingkai avatar</string>
+    <string name="badge">Badge</string>
+    <string name="chat_bubble">chat bubble</string>
+    <string name="more">lebih banyak</string>
+    <string name="take_back">ambil kembali</string>
+    <string name="this_product_has_been_purchased">Produk ini telah dibeli</string>
+    <string name="purchase_successful">Pembelian berhasil</string>
+    <string name="no_time_limit">Tidak ada batas waktu</string>
 </resources>

+ 9 - 0
baseswago/src/main/res/values-zh/strings.xml

@@ -313,4 +313,13 @@
     <string name="dress_up">装扮</string>
     <string name="mall">商城</string>
     <string name="buy_it_now">立即购买</string>
+    <string name="entrance_effects">入场特效</string>
+    <string name="avatar_frame">头像框</string>
+    <string name="badge">徽章</string>
+    <string name="chat_bubble">聊天气泡</string>
+    <string name="more">更多</string>
+    <string name="take_back">收回</string>
+    <string name="this_product_has_been_purchased">该商品已经购买</string>
+    <string name="purchase_successful">购买成功</string>
+    <string name="no_time_limit">不限时间</string>
 </resources>

+ 9 - 0
baseswago/src/main/res/values/strings.xml

@@ -335,4 +335,13 @@
     <string name="dress_up">Dress up</string>
     <string name="mall">Mall</string>
     <string name="buy_it_now">Buy it now</string>
+    <string name="entrance_effects">Entrance effects</string>
+    <string name="avatar_frame">Avatar frame</string>
+    <string name="badge">Badge</string>
+    <string name="chat_bubble">chat bubble</string>
+    <string name="more">more</string>
+    <string name="take_back">take back</string>
+    <string name="this_product_has_been_purchased">This product has been purchased</string>
+    <string name="purchase_successful">Purchase successful</string>
+    <string name="no_time_limit">No time limit</string>
 </resources>

+ 22 - 4
home/src/main/java/com/swago/home/ChatDetailActivity.kt

@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.alibaba.android.arouter.launcher.ARouter
+import com.google.firebase.firestore.auth.User
 import com.google.gson.Gson
 import com.gyf.immersionbar.ImmersionBar
 import com.swago.baseswago.PersonDataDFragment
@@ -51,6 +52,10 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
     @JvmField
     var chatName: String = ""
 
+    @Autowired(required = true)
+    @JvmField
+    var chatSpecial: String = ""
+
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -121,11 +126,24 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
 
             }
         })
-        val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile/mmexport1718256766828.png"
-        val bitmap = BitmapUtils.getBitmapFromPath(path)
-        bitmap?.let {
-            messageRecyclerView.leftBubble =   DianJiuUtil.setNinePatchImage(this , it)
+
+        UserInfo.getUserInfo()?.chat_special?.let {chatUrl ->
+            DianJiuUtil.loadDian9Tu(this ,chatUrl ){ drawable ->
+                drawable?.let {
+                    messageRecyclerView.rightBubble = it
+                }
+            }
         }
+
+            if (!TextUtils.isEmpty(chatSpecial)){
+                DianJiuUtil.loadDian9Tu(this ,chatSpecial ){ drawable ->
+                    drawable?.let {
+                        messageRecyclerView.leftBubble = it
+                    }
+                }
+            }
+
+
     }
 
     override fun initLiveData() {

+ 13 - 13
home/src/main/java/com/swago/home/MineFragment.kt

@@ -28,9 +28,7 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
 
     private val userVm by viewModels<UserVm>()
     private val payVm by viewModels<PayVm>()
-    private var svgaParser: SVGAParser? = null
     override fun loadData() {
-        svgaParser = SVGAParser(activity)
     }
 
     override fun initOther() {
@@ -44,18 +42,20 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
             }
         }
 
-        UserInfo.getUserInfo()?.head_special?.let {
-            svgaParser?.decodeFromURL(URL("https://apple-1304432552.cos.ap-shanghai.myqcloud.com/7.svga"), object :SVGAParser.ParseCompletion{
-                override fun onComplete(videoItem: SVGAVideoEntity) {
-                    val drawable = SVGADrawable(videoItem)
-                    binding.svgAvatar.setImageDrawable(drawable)
-                    binding.svgAvatar.startAnimation()
-                }
-
-                override fun onError() {
+        UserInfo.getUserInfo()?.let {
+            if (!it.head_special.isNullOrEmpty()){
+                val svgaParser = SVGAParser(activity)
+                svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        binding.svgAvatar.setImageDrawable(drawable)
+                        binding.svgAvatar.startAnimation()
+                    }
 
-                }
-            })
+                    override fun onError() {
+                    }
+                })
+            }
         }
 
         binding.llFans.setOnClickListener(object: NoDoubleClickListener(){

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

@@ -3,20 +3,29 @@ package com.swago.room.adapter
 import android.view.View
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.cusview.SwagoLevelView
 import com.swago.baseswago.model.live.RoomUserModel
 import com.swago.loadUrl
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
+import java.net.URL
 
 /**
  *@date 2022/3/29 20:33
  *description:
  */
 class AudienceAdapter : BaseQuickAdapter<RoomUserModel.ListBean, BaseViewHolder>(R.layout.item_dialog_audience, arrayListOf()) {
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
     override fun convert(helper: BaseViewHolder, item: RoomUserModel.ListBean) {
         helper.apply {
             itemView.findViewById<CircleImageView>(R.id.ivAvatar).loadUrl(mContext,item.user_head_img_url)
+            val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
             setText(R.id.tvContribution,item.contribute_val)
             setText(R.id.tvName,item.user_name)
             setGone(R.id.ivBenefit,item.is_benefit == 1)
@@ -25,6 +34,19 @@ class AudienceAdapter : BaseQuickAdapter<RoomUserModel.ListBean, BaseViewHolder>
             setGone(R.id.ivCrown,item.is_crown == 1)
             setGone(R.id.ivCup,item.is_cup == 1)
             itemView.findViewById<SwagoLevelView>(R.id.tvLevel).setUserLevel(item.user_wealth_level)
+
+            if (!item.head_special.isNullOrEmpty()){
+                svgaParser.decodeFromURL(URL(item.head_special), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        svgAvatar.setImageDrawable(drawable)
+                        svgAvatar.startAnimation()
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            }
         }
     }
 }

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

@@ -3,6 +3,8 @@ package com.swago.room.adapter
 import android.graphics.Bitmap
 import android.graphics.Color
 import android.graphics.drawable.BitmapDrawable
+import android.graphics.drawable.Drawable
+import android.graphics.drawable.NinePatchDrawable
 import android.os.Build
 import android.text.*
 import android.text.method.LinkMovementMethod
@@ -16,9 +18,13 @@ import android.widget.ImageView
 import android.widget.TextView
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.core.content.ContextCompat
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.transition.Transition
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
 import com.swago.baseswago.baseroom.SwagoRoomManager
+import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.cusview.LiangView
 import com.swago.baseswago.cusview.SwagoLevelView
 import com.swago.baseswago.im.IRoomChat
@@ -36,6 +42,9 @@ import com.swago.room.R
 import com.swago.room.adapter.bitmap.CenterAlignImageSpan
 import com.swago.room.adapter.bitmap.CustomImageSpan
 import com.swago.room.adapter.bitmap.HtmlImageGetter
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
 import java.util.*
 import kotlin.collections.ArrayList
 
@@ -51,16 +60,6 @@ class RoomChatAdapter :
      */
     private val iconBitmapCachePool: HashMap<String, Bitmap> = HashMap()
     private val localImageKey = ArrayList<String>()
-    private val badgeBitmap by lazy {
-        BitmapUtils.getBitmapFromPath(UserInfo.getUserInfo()?.badge_special)
-    }
-    private val bubbleChat by lazy {
-        val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile/mmexport1718256766828.png"
-         BitmapUtils.getBitmapFromPath(path)
-    }
-    private val userid by lazy {
-        UserInfo.getUserInfo()?.id
-    }
 
     companion object {
         const val LEVEL_KEY = "level"
@@ -90,6 +89,9 @@ class RoomChatAdapter :
 
     var showUserInfoDialog: ((iChatMsg: IRoomChat) -> Unit)? = null
 
+    fun setChatAndBadge(chatDrawable: NinePatchDrawable , badgeBitmap: Bitmap){
+
+    }
 
     override fun convert(helper: BaseViewHolder, item: IRoomChat) {
         var count = 0
@@ -167,7 +169,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
 
                     if (span.length < item.getSenderName().length + count) {
@@ -208,6 +210,16 @@ class RoomChatAdapter :
                     }else{
                         setBackgroundRes(R.id.tvContent, R.drawable.shape_20000000_14)
                     }
+                    UserInfo.getUserInfo()?.chat_special = "https://apple-1304432552.cos.ap-shanghai.myqcloud.com/outdianjiu.png"
+                    mContext?.let {
+                        UserInfo.getUserInfo()?.chat_special?.let {chatUrl ->
+                            DianJiuUtil.loadDian9Tu(it ,chatUrl ){ drawable ->
+                                drawable?.let { drawable ->
+                                    tvContent.background = drawable
+                                }
+                            }
+                        }
+                    }
                 }
 
                 RoomMsgType.SYSTEM_MESSAGE -> {
@@ -292,7 +304,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
                     if (span.length < item.getSenderName().length + count) {
                         span.setSpan(
@@ -384,7 +396,7 @@ class RoomChatAdapter :
                             .append("'> ")
                     }
 
-                    if (item is UserJoinRoomBean && badgeBitmap != null) {
+                    if (item is UserJoinRoomBean && !item.badgeSpecial.isNullOrEmpty()) {
                         count++
                         sb.append("<img src='" + "file:///xx/")
                             .append(BADGE_KEY).append(".png")
@@ -403,7 +415,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
                     if (span.length < item.getSenderName().length + count) {
                         span.setSpan(
@@ -459,12 +471,7 @@ class RoomChatAdapter :
 
                 }
             }
-            if (item.getSenderId() == userid){
-                bubbleChat?.let {
-                    tvContent.background =  DianJiuUtil.setNinePatchImage(mContext , it)
-                }
 
-            }
             tvContent.movementMethod = LinkMovementMethod.getInstance()
             tvContent.highlightColor = Color.TRANSPARENT
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -476,7 +483,7 @@ class RoomChatAdapter :
     }
 
 
-    private fun setHtml(span: SpannableString, helper: BaseViewHolder, item: IRoomChat) {
+    private fun setHtml(span: SpannableString, helper: BaseViewHolder, item: IRoomChat, tvContent:TextView) {
         try {
             val imageSpans = span.getSpans(0, span.length, ImageSpan::class.java)
             var i = 0
@@ -558,12 +565,32 @@ class RoomChatAdapter :
                         Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
                     )
                 }else if (imageSpan.source != null && imageSpan!!.source!!.contains(BADGE_KEY)) {
-                span.setSpan(
-                    setBadge(helper.itemView as ViewGroup),
-                    start,
-                    end,
-                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
-                )
+                    if(item is UserJoinRoomBean && !TextUtils.isEmpty(item.badgeSpecial)){
+                        Glide.with(mContext)
+                            .asBitmap()
+                            .load(item.badgeSpecial)
+                            .override(50)
+                            .into(object : CustomTarget<Bitmap>() {
+                                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
+                                    span.setSpan(
+                                        setBadge(resource, helper.itemView as ViewGroup),
+                                        start,
+                                        end,
+                                        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
+                                    )
+                                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                                        tvContent.text = span.formatAr()
+                                    }else{
+                                        tvContent.text = span
+                                    }
+                                }
+
+                                override fun onLoadCleared(placeholder: Drawable?) {
+
+                                }
+                            })
+                    }
+
             }else {
                     span.setSpan(newImageSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
                 }
@@ -761,10 +788,10 @@ class RoomChatAdapter :
         return CustomImageSpan(mContext, bm, CustomImageSpan.ALIGN_FONTCENTER)
     }
 
-    private fun setBadge(viewGroup: ViewGroup): CustomImageSpan {
+    private fun setBadge(bitmap: Bitmap,viewGroup: ViewGroup): CustomImageSpan {
         val imageView = ImageView(mContext)
         viewGroup.addView(imageView)
-        return CustomImageSpan(mContext, badgeBitmap, CustomImageSpan.ALIGN_FONTCENTER)
+        return CustomImageSpan(mContext, bitmap, CustomImageSpan.ALIGN_FONTCENTER)
     }
 
     private fun setLevel(iSenderLevel: Int, viewGroup: ViewGroup): CustomImageSpan {

+ 25 - 1
room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt

@@ -1,24 +1,48 @@
 package com.swago.room.adapter
 
+import android.text.TextUtils
 import com.bumptech.glide.Glide
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.model.live.RoomUserModel
+import com.swago.baseswago.util.UserInfo
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
+import java.net.URL
 
 /**
  *@date 2021/10/23 09:56
  *description:
  */
 class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(R.layout.item_room_user, arrayListOf()) {
-
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
     override fun convert(helper: BaseViewHolder, item: RoomUserModel.ListBean) {
         helper.apply {
             val ivAvatar = itemView.findViewById<CircleImageView>(R.id.ivAvatar)
+            val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
             Glide.with(itemView.context).load(item.user_head_img_url)
                 .placeholder(R.mipmap.default_avatar)
                 .error(R.mipmap.default_avatar).into(ivAvatar)
+
+            if (!item.head_special.isNullOrEmpty()){
+                svgaParser.decodeFromURL(URL(item.head_special), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        svgAvatar.setImageDrawable(drawable)
+                        svgAvatar.startAnimation()
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            }
+
         }
     }
 }

+ 23 - 1
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -2,13 +2,20 @@ package com.swago.room.audio
 
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.cusview.SwagoImageView
 import com.swago.baseswago.model.live.audio.AudioSeatModel
 import com.swago.room.R
+import java.net.URL
 
 class AudioSeatAdapter :
     BaseQuickAdapter<AudioSeatModel, BaseViewHolder>(R.layout.item_audio_seat, arrayListOf()) {
-
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
     override fun convert(helper: BaseViewHolder?, item: AudioSeatModel?) {
         helper?.apply {
             item?.let {
@@ -24,6 +31,7 @@ class AudioSeatAdapter :
                             .loadImage(R.mipmap.ic_audio_seat)
                     }
                 } else {
+                    val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
                     itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                         .loadImage(it.user_head_img_url ?: "")
                     setText(R.id.tvName, it.user_name)
@@ -48,6 +56,20 @@ class AudioSeatAdapter :
                         }
 
                     }
+
+                    if (!it.head_special.isNullOrEmpty()){
+                        svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
+                            override fun onComplete(videoItem: SVGAVideoEntity) {
+                                val drawable = SVGADrawable(videoItem)
+                                svgAvatar.setImageDrawable(drawable)
+                                svgAvatar.startAnimation()
+                            }
+
+                            override fun onError() {
+                            }
+                        })
+                    }
+
                 }
             }
         }

+ 16 - 0
room/src/main/java/com/swago/room/bean/UserRoomModel.kt

@@ -193,4 +193,20 @@ class UserRoomModel : IRoomInfo {
     override fun getPassStatus(): Int {
         return momentModel?.broadcast_password_status ?: 0
     }
+
+    override fun getJoinSpecial(): String {
+        return roomModel?.join_special ?: ""
+    }
+
+    override fun getHeadSpecial(): String {
+        return roomModel?.head_special ?: ""
+    }
+
+    override fun getBadgeSpecial(): String {
+        return roomModel?.badge_special ?: ""
+    }
+
+    override fun getChatSpecial(): String {
+        return roomModel?.chat_special ?: ""
+    }
 }

+ 22 - 0
room/src/main/java/com/swago/room/gift/audio/MaiUserAdapter.kt

@@ -1,25 +1,47 @@
 package com.swago.room.gift.audio
 
+import android.text.TextUtils
 import android.view.View
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.model.live.audio.MaiUserInfo
 import com.swago.loadUrl
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
+import java.net.URL
 
 class MaiUserAdapter : BaseQuickAdapter<MaiUserInfo, BaseViewHolder>(R.layout.item_mai_user, arrayListOf()) {
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
 
     override fun convert(helper: BaseViewHolder?, item: MaiUserInfo?) {
         helper?.apply {
             item?.let {
                 itemView.findViewById<CircleImageView>(R.id.ivAvatar).loadUrl(mContext,it.user_head_img_url)
+                val svgaImageView = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
                 val view = itemView.findViewById<View>(R.id.view)
                 if (it.selected){
                     view.visibility = View.VISIBLE
                 }else{
                     view.visibility = View.GONE
                 }
+                if (!TextUtils.isEmpty(it.head_special)){
+                    svgaParser.decodeFromURL(URL(item.head_special), object : SVGAParser.ParseCompletion{
+                        override fun onComplete(videoItem: SVGAVideoEntity) {
+                            val drawable = SVGADrawable(videoItem)
+                            svgaImageView.setImageDrawable(drawable)
+                            svgaImageView.startAnimation()
+                        }
+
+                        override fun onError() {
+                        }
+                    })
+                }
             }
         }
     }

+ 2 - 1
room/src/main/java/com/swago/room/vm/MsgVm.kt

@@ -547,7 +547,8 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                             it.maiSeatInfo.integration,
                             it.maiSeatInfo.voiceUserId,
                             it.maiSeatInfo.maiIndex,
-                            0
+                            0,
+                            it.maiSeatInfo.head_special
                         )
                         AudioRoomManager.dispatchUpdateData(audioSeatModel)
                         UserInfo.getUserInfo()?.let { userInfoModel ->

+ 21 - 0
room/src/main/java/com/swago/room/widget/ComHeaderView.kt

@@ -2,6 +2,7 @@ package com.swago.room.widget
 
 import android.content.Context
 import android.graphics.drawable.Drawable
+import android.text.TextUtils
 import android.util.AttributeSet
 import android.util.Log
 import android.util.TimeUtils
@@ -16,6 +17,9 @@ import com.bumptech.glide.load.DataSource
 import com.bumptech.glide.load.engine.GlideException
 import com.bumptech.glide.request.RequestListener
 import com.bumptech.glide.request.target.Target
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.R
 import com.swago.baseswago.baseroom.*
 import com.swago.baseswago.constant.ARouteConstant
@@ -29,6 +33,7 @@ import com.swago.room.databinding.LayoutUserHeaderViewBinding
 import com.swago.room.dialog.AudioNoticeDialog
 import com.swago.room.dialog.AudioNoticeUserDialog
 import com.swago.room.inter.IHeader
+import java.net.URL
 
 /**
  *@date 2022/3/4 14:56
@@ -52,6 +57,7 @@ class ComHeaderView  : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
 
     private var timeL = 0L
 
+    var svgaParser:SVGAParser? = null
     private val adapter by lazy {
         RoomUserAdapter()
     }
@@ -72,6 +78,7 @@ class ComHeaderView  : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
         binding = LayoutUserHeaderViewBinding.inflate(LayoutInflater.from(context), this, true)
         binding.rvUser.layoutManager = LinearLayoutManager(context,RecyclerView.HORIZONTAL,false)
         binding.rvUser.adapter = adapter
+        svgaParser = SVGAParser(context)
 
         binding.tvFollow.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
@@ -179,6 +186,20 @@ class ComHeaderView  : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
                 }
             })
             .into(binding.ivAvatar)
+
+        if (iRoomInfo.getHeadSpecial().isNotEmpty()){
+            svgaParser?.decodeFromURL(URL(iRoomInfo.getHeadSpecial()), object :SVGAParser.ParseCompletion{
+                override fun onComplete(videoItem: SVGAVideoEntity) {
+                    val drawable = SVGADrawable(videoItem)
+                    binding.svgAvatar.setImageDrawable(drawable)
+                    binding.svgAvatar.startAnimation()
+                }
+
+                override fun onError() {
+                }
+            })
+        }
+
         binding.tvName.text =iRoomInfo.getAnchorName()
         binding.tvId.text = "Likes:${iRoomInfo.getLikeNum()}"
         binding.tvHot.text = iRoomInfo.getRoomHot()

+ 0 - 1
room/src/main/res/layout/item_audio_seat.xml

@@ -26,7 +26,6 @@
             android:layout_width="68dp"
             android:layout_height="68dp"
             android:visibility="visible"
-            app:source="avatar.svga"
             app:autoPlay="true"
             app:loopCount="0"
             app:layout_constraintStart_toStartOf="parent"

+ 0 - 1
room/src/main/res/layout/item_dialog_audience.xml

@@ -28,7 +28,6 @@
             android:layout_width="50dp"
             android:layout_height="50dp"
             android:visibility="visible"
-            app:source="avatar.svga"
             app:autoPlay="true"
             app:loopCount="0"
             app:layout_constraintStart_toStartOf="parent"

+ 11 - 1
room/src/main/res/layout/item_mai_user.xml

@@ -13,7 +13,17 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
-
+    <com.opensource.svgaplayer.SVGAImageView
+        android:id="@+id/svgAvatar"
+        android:layout_width="38dp"
+        android:layout_height="38dp"
+        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"/>
     <View
         android:id="@+id/view"
         android:visibility="gone"

+ 0 - 1
room/src/main/res/layout/item_room_user.xml

@@ -20,7 +20,6 @@
         android:layout_width="30dp"
         android:layout_height="30dp"
         android:visibility="visible"
-        app:source="avatar.svga"
         app:autoPlay="true"
         app:loopCount="0"
         app:layout_constraintStart_toStartOf="parent"

+ 0 - 1
room/src/main/res/layout/layout_user_header_view.xml

@@ -40,7 +40,6 @@
                 android:layout_width="30dp"
                 android:layout_height="30dp"
                 android:visibility="visible"
-                app:source="avatar.svga"
                 app:autoPlay="true"
                 app:loopCount="0"
                 app:layout_constraintStart_toStartOf="parent"

+ 3 - 0
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/conversation/holder/ConversationCommonHolder.java

@@ -11,6 +11,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
+import com.opensource.svgaplayer.SVGAImageView;
 import com.tencent.imsdk.v2.V2TIMManager;
 import com.tencent.imsdk.v2.V2TIMUserFullInfo;
 import com.tencent.imsdk.v2.V2TIMValueCallback;
@@ -48,6 +49,7 @@ public class ConversationCommonHolder extends ConversationBaseHolder {
     protected TextView tvOfficial;
     protected ImageView ivCrown;
     protected ImageView ivCup;
+    protected SVGAImageView svgaImageView;
 
     public ConversationCommonHolder(View itemView) {
         super(itemView);
@@ -63,6 +65,7 @@ public class ConversationCommonHolder extends ConversationBaseHolder {
         tvOfficial = rootView.findViewById(R.id.tvOfficial);
         ivCrown = rootView.findViewById(R.id.ivCrown);
         ivCup = rootView.findViewById(R.id.ivCup);
+        svgaImageView = rootView.findViewById(R.id.svgAvatar);
     }
 
     public void layoutViews(ConversationInfo conversation, int position) {

+ 21 - 1
tuikit/src/main/res/layout/conversation_adapter.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/item_left"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -18,11 +19,30 @@
         android:button="@drawable/checkbox_selector"
         android:layout_marginEnd="6.23dp"
         android:visibility="gone" />
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content">
 
         <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/conversation_icon"
             android:layout_width="@dimen/conversation_avatar_width"
-            android:layout_height="@dimen/conversation_avatar_height" />
+            android:layout_height="@dimen/conversation_avatar_height"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"/>
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar"
+            android:layout_width="@dimen/conversation_avatar_width"
+            android:layout_height="@dimen/conversation_avatar_height"
+            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>
 
         <RelativeLayout
             android:layout_width="match_parent"

+ 58 - 19
tuikit/src/main/res/layout/message_adapter_item_content.xml

@@ -38,31 +38,70 @@
         android:layout_height="wrap_content"
         android:layout_width="match_parent">
 
-
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/left_user_icon_view"
-            android:layout_width="41dp"
-            android:layout_height="41dp"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/cl_left"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:layout_alignParentLeft="true"
-            android:layout_marginRight="6.23dp"
-            android:visibility="gone"
-            android:scaleType="centerCrop"/>
+            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>
 
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/right_user_icon_view"
-            android:layout_width="41dp"
-            android:layout_height="41dp"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/cl_right"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
-            android:layout_marginLeft="6.23dp"
-            android:scaleType="centerCrop"
-            android:visibility="gone"/>
+            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>
 
         <TextView
             android:id="@+id/user_name_tv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_toLeftOf="@+id/right_user_icon_view"
-            android:layout_toRightOf="@+id/left_user_icon_view"
+            android:layout_toLeftOf="@+id/cl_right"
+            android:layout_toRightOf="@+id/cl_left"
             android:layout_marginBottom="3.68dp"
             android:textColor="@color/text_tips_color"
             android:layout_marginLeft="6.67dp"
@@ -74,8 +113,8 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@+id/user_name_tv"
-            android:layout_toLeftOf="@+id/right_user_icon_view"
-            android:layout_toRightOf="@+id/left_user_icon_view"
+            android:layout_toLeftOf="@+id/cl_right"
+            android:layout_toRightOf="@+id/cl_left"
             android:orientation="horizontal">
 
             <com.tencent.qcloud.tim.uikit.component.UnreadCountTextView

+ 17 - 12
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -13,8 +13,10 @@ import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.loadUrl
+import com.swago.user.R
 import com.swago.user.databinding.DialogStoreDetailBinding
 import com.swago.user.vm.StoreVm
+import com.tencent.qcloud.tim.uikit.utils.ToastUtil
 import java.io.File
 import java.net.URL
 
@@ -23,6 +25,7 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
 
     private var svgaParser: SVGAParser? = null
     var storeBean: StoreItemBean ?= null
+    var buySuccessFun:(()->Unit)? = null
     init {
         setGravity(Gravity.BOTTOM)
         setDimAmount(0.5f)
@@ -50,20 +53,17 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
             binding.tvCoin.text = "${it.product_coin}"
             binding.ivIcon.visibility = if (it.product_url?.endsWith("svga") == true) View.GONE else View.VISIBLE
             binding.ivIcon.loadUrl(AppContext.getContext(),it.product_url?:"")
-            svgaParser?.let { svgaParser ->
-                svgaParser.decodeFromURL(URL(it.product_url), object : SVGAParser.ParseCompletion{
-                    override fun onComplete(videoItem: SVGAVideoEntity) {
-                        val drawable = SVGADrawable(videoItem)
-                        binding.svgContent.setImageDrawable(drawable)
-                        binding.svgContent.startAnimation()
-                    }
-
-                    override fun onError() {
+            svgaParser?.decodeFromURL(URL(it.product_url), object : SVGAParser.ParseCompletion{
+                override fun onComplete(videoItem: SVGAVideoEntity) {
+                    val drawable = SVGADrawable(videoItem)
+                    binding.svgContent.setImageDrawable(drawable)
+                    binding.svgContent.startAnimation()
+                }
 
-                    }
-                })
+                override fun onError() {
 
-            }
+                }
+            })
         }
     }
 
@@ -71,7 +71,12 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         binding.tvBuy.setOnClickListener(object: NoDoubleClickListener(){
             override fun onClick() {
                 storeBean?.let {
+                    if (it.product_status ==1){
+                        ToastUtil.toastShortMessage(getString(R.string.this_product_has_been_purchased))
+                        return@let
+                    }
                     storeVm.buyProduct(it.id)
+                    buySuccessFun?.invoke()
                     dismissAllowingStateLoss()
                 }
 

+ 33 - 12
user/src/main/java/com/swago/user/store/StoreListActivity.kt

@@ -19,6 +19,7 @@ import com.swago.user.R
 import com.swago.user.databinding.ActivityStoreListBinding
 import com.swago.user.vm.StoreVm
 import com.swago.user.vm.TaskVm
+import com.tencent.qcloud.tim.uikit.utils.ToastUtil
 import com.zy.multistatepage.state.EmptyState
 import java.util.concurrent.CopyOnWriteArrayList
 
@@ -225,11 +226,11 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             isEnterExpanded = !isEnterExpanded
             if (isEnterExpanded) {
                 enterAdapter.setNewData(enterList)
-                binding.tvEnterMore.text = "Show Less"
+                binding.tvEnterMore.text = getString(R.string.take_back)
                 binding.ivEnterMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 enterAdapter.setNewData(enterList.subList(0, enterList.size.coerceAtMost(3)))
-                binding.tvEnterMore.text = "Show More"
+                binding.tvEnterMore.text = getString(R.string.more)
                 binding.ivEnterMore.setImageResource(R.mipmap.ic_show_more)
             }
         }
@@ -240,11 +241,11 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             isAvatarExpanded = !isAvatarExpanded
             if (isAvatarExpanded) {
                 avatarAdapter.setNewData(avatarList)
-                binding.tvAvatarMore.text = "Show Less"
+                binding.tvAvatarMore.text = getString(R.string.take_back)
                 binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 avatarAdapter.setNewData(avatarList.subList(0, avatarList.size.coerceAtMost(3)))
-                binding.tvAvatarMore.text = "Show More"
+                binding.tvAvatarMore.text = getString(R.string.more)
                 binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_more)
             }
         }
@@ -255,11 +256,11 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             isBadgeExpanded = !isBadgeExpanded
             if (isBadgeExpanded) {
                 badgeAdapter.setNewData(badgeList)
-                binding.tvBadgeMore.text = "Show Less"
+                binding.tvBadgeMore.text = getString(R.string.take_back)
                 binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 badgeAdapter.setNewData(badgeList.subList(0, badgeList.size.coerceAtMost(3)))
-                binding.tvBadgeMore.text = "Show More"
+                binding.tvBadgeMore.text = getString(R.string.more)
                 binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_more)
             }
         }
@@ -270,17 +271,22 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             isBubbleExpanded = !isBubbleExpanded
             if (isBubbleExpanded) {
                 bubbleAdapter.setNewData(bubbleList)
-                binding.tvBubbleMore.text = "Show Less"
+                binding.tvBubbleMore.text = getString(R.string.take_back)
                 binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 bubbleAdapter.setNewData(bubbleList.subList(0, bubbleList.size.coerceAtMost(3)))
-                binding.tvBubbleMore.text = "Show More"
+                binding.tvBubbleMore.text = getString(R.string.more)
                 binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_more)
             }
         }
         enterAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+                StoreBuyDialog.newInstance(enterAdapter.data[position]).apply {
+                    this.buySuccessFun = {
+                        enterAdapter.data[position].product_status = 1
+                        enterAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
             } else if (type == 2){
                 storeVm.chooseProduct(enterAdapter.data[position].id)
                 enterList.forEachIndexed { index, storeItemBean ->
@@ -293,7 +299,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         avatarAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(avatarAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+                StoreBuyDialog.newInstance(avatarAdapter.data[position]).apply {
+                    this.buySuccessFun = {
+                        avatarAdapter.data[position].product_status = 1
+                        avatarAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
             } else if (type == 2){
                 storeVm.chooseProduct(avatarAdapter.data[position].id)
                 avatarList.forEachIndexed { index, storeItemBean ->
@@ -306,7 +317,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         badgeAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(badgeAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+                StoreBuyDialog.newInstance(badgeAdapter.data[position]).apply {
+                    this.buySuccessFun = {
+                        badgeAdapter.data[position].product_status = 1
+                        badgeAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
             } else if (type == 2){
                 storeVm.chooseProduct(badgeAdapter.data[position].id)
                 badgeList.forEachIndexed { index, storeItemBean ->
@@ -319,7 +335,12 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         bubbleAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(bubbleAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+                StoreBuyDialog.newInstance(bubbleAdapter.data[position]).apply {
+                    this.buySuccessFun = {
+                        bubbleAdapter.data[position].product_status = 1
+                        bubbleAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
             } else if (type == 2){
                 storeVm.chooseProduct(bubbleAdapter.data[position].id)
                 bubbleList.forEachIndexed { index, storeItemBean ->

+ 5 - 0
user/src/main/java/com/swago/user/vm/StoreVm.kt

@@ -1,13 +1,17 @@
 package com.swago.user.vm
 
 import android.app.Application
+import android.widget.Toast
 import androidx.lifecycle.MutableLiveData
 import com.swago.baseswago.inter.ApiManager
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.model.mine.TaskModel
 import com.swago.baseswago.util.ActivityManagerUtil
+import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.BaseViewModel
 import com.swago.baseswago.util.SwagoLoading
+import com.swago.user.R
+import com.tencent.qcloud.tim.uikit.utils.ToastUtil
 
 class StoreVm(application: Application) : BaseViewModel(application){
 
@@ -31,6 +35,7 @@ class StoreVm(application: Application) : BaseViewModel(application){
         requestData2 {
             requestData {
                 ApiManager.userApi.buyProduct(productId)
+                ToastUtil.toastShortMessage(AppContext.getContext().getString(R.string.purchase_successful))
             }
 
         }

+ 8 - 8
user/src/main/res/layout/activity_store_list.xml

@@ -51,7 +51,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="入场特效" />
+                    android:text="@string/entrance_effects" />
 
                 <com.swago.baseswago.cusview.MediumTextView
                     android:id="@+id/tvEnterMore"
@@ -64,7 +64,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toStartOf="@+id/ivEnterMore"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="Show Less" />
+                    android:text="@string/more" />
                 <ImageView
                     android:id="@+id/ivEnterMore"
                     android:layout_width="wrap_content"
@@ -103,7 +103,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="头像框" />
+                    android:text="@string/avatar_frame" />
 
                 <com.swago.baseswago.cusview.MediumTextView
                     android:id="@+id/tvAvatarMore"
@@ -116,7 +116,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toStartOf="@+id/ivAvatarMore"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="Show Less" />
+                    android:text="@string/more" />
                 <ImageView
                     android:id="@+id/ivAvatarMore"
                     android:layout_width="wrap_content"
@@ -155,7 +155,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="徽章" />
+                    android:text="@string/badge" />
 
                 <com.swago.baseswago.cusview.MediumTextView
                     android:id="@+id/tvBadgeMore"
@@ -168,7 +168,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toStartOf="@+id/ivBadgeMore"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="Show Less" />
+                    android:text="@string/more" />
                 <ImageView
                     android:id="@+id/ivBadgeMore"
                     android:layout_width="wrap_content"
@@ -207,7 +207,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="聊天气泡" />
+                    android:text="@string/chat_bubble" />
 
                 <com.swago.baseswago.cusview.MediumTextView
                     android:id="@+id/tvBubbleMore"
@@ -220,7 +220,7 @@
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toStartOf="@+id/ivBubbleMore"
                     app:layout_constraintTop_toTopOf="parent"
-                    android:text="Show Less" />
+                    android:text="@string/more" />
                 <ImageView
                     android:id="@+id/ivBubbleMore"
                     android:layout_width="wrap_content"

+ 1 - 1
user/src/main/res/layout/dialog_store_detail.xml

@@ -14,7 +14,7 @@
             app:layout_constraintDimensionRatio="h,1:1"
             app:layout_constraintBottom_toTopOf="@+id/cl_bottom"
             app:layout_constraintTop_toTopOf="parent"
-            app:loopCount="1" />
+            app:loopCount="0" />
 
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/cl_bottom"