18 Коміти 203f94e779 ... f88db1a1c0

Автор SHA1 Опис Дата
  tongmengxiao f88db1a1c0 fix: 多人入场动画展示 5 місяців тому
  tongmengxiao 2f2c3ba9af fix: 麦位 5 місяців тому
  tongmengxiao 40616e2e89 feat: delete push 5 місяців тому
  tongmengxiao cd32a50ad8 fix: 商城bug 5 місяців тому
  tongmengxiao 170eddda16 fix: 麦位占位图 5 місяців тому
  tongmengxiao 9002513611 fix: 内存泄露 person dialog 5 місяців тому
  tongmengxiao b7023d4cec fix: invisible 5 місяців тому
  tongmengxiao 00e9fe3cd4 fix: join animal peek 5 місяців тому
  tongmengxiao 615173c766 feat: person leak 5 місяців тому
  tongmengxiao 6aee69ca93 fix: message info 5 місяців тому
  tongmengxiao 34cce02f0b fix: buyProduct success 5 місяців тому
  tongmengxiao 4df5895987 fix: bug 5 місяців тому
  tongmengxiao 5bc23b3621 fix: using 6 місяців тому
  tongmengxiao d606ca8d23 feat: game send 6 місяців тому
  tongmengxiao 0e494db6a1 fix: chat text 6 місяців тому
  tongmengxiao a4f9008ada fix: 商品状态 6 місяців тому
  tongmengxiao 9af186164f fix: bug 6 місяців тому
  tongmengxiao 6602f16e34 feat:chat 默认背景图 6 місяців тому
59 змінених файлів з 849 додано та 251 видалено
  1. 0 1
      app/src/main/java/com/swago/app/SwagoApp.kt
  2. 9 4
      baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt
  3. 2 3
      baseswago/src/main/java/com/swago/baseswago/dialog/HandleDialogFragment.kt
  4. 2 2
      baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt
  5. 1 0
      baseswago/src/main/java/com/swago/baseswago/model/im/UserJoinRoomBean.java
  6. 10 0
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java
  7. 2 1
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSendGiftModel.kt
  8. 9 0
      baseswago/src/main/java/com/swago/baseswago/model/live/gift/IMGiftModel.java
  9. 5 0
      baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt
  10. 24 0
      baseswago/src/main/java/com/swago/baseswago/util/StringUtils.kt
  11. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.png
  12. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.webp
  13. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.png
  14. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.webp
  15. 3 1
      baseswago/src/main/res/values-ar/strings.xml
  16. 2 0
      baseswago/src/main/res/values-in/strings.xml
  17. 2 0
      baseswago/src/main/res/values-ms/strings.xml
  18. 3 1
      baseswago/src/main/res/values-zh/strings.xml
  19. 4 2
      baseswago/src/main/res/values/strings.xml
  20. 18 38
      home/src/main/java/com/swago/home/ChatDetailActivity.kt
  21. 25 5
      home/src/main/java/com/swago/home/MessageFragment.kt
  22. 27 36
      home/src/main/res/layout/fragment_mine.xml
  23. BIN
      home/src/main/res/mipmap-xxhdpi/icon_my_store.png
  24. 10 0
      room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt
  25. 6 2
      room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt
  26. 41 8
      room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt
  27. 77 32
      room/src/main/java/com/swago/room/base/BaseComFragment.kt
  28. 1 1
      room/src/main/java/com/swago/room/bean/UserRoomModel.kt
  29. 0 1
      room/src/main/java/com/swago/room/dialog/AudienceListDialog.kt
  30. 29 10
      room/src/main/java/com/swago/room/dialog/MessageListDialog.kt
  31. 6 1
      room/src/main/java/com/swago/room/dialog/SendMsgDialog.kt
  32. 14 10
      room/src/main/java/com/swago/room/game/GamePlayDialog.kt
  33. 9 0
      room/src/main/java/com/swago/room/gift/GiftDialog.kt
  34. 3 0
      room/src/main/java/com/swago/room/gift/audio/MaiUserAdapter.kt
  35. 22 7
      room/src/main/java/com/swago/room/gift/control/XSvgPlayer.kt
  36. 16 0
      room/src/main/java/com/swago/room/giftdandao/GiftDanDaoView.kt
  37. 82 0
      room/src/main/java/com/swago/room/manager/JoinAnimalManager.kt
  38. 22 0
      room/src/main/java/com/swago/room/manager/JoinRoomManager.kt
  39. 0 1
      room/src/main/java/com/swago/room/user/UserRoomFragment.kt
  40. 7 0
      room/src/main/java/com/swago/room/vm/MsgVm.kt
  41. 1 0
      room/src/main/res/layout/activity_anchor_room.xml
  42. 1 1
      room/src/main/res/layout/item_audio_seat.xml
  43. 31 10
      room/src/main/res/layout/view_item_gift.xml
  44. 1 1
      room/src/main/res/layout/view_user_join_room.xml
  45. 17 0
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/base/ChatManagerKit.java
  46. 6 4
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/interfaces/IMessageProperties.java
  47. 11 10
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/MessageLayoutUI.java
  48. 42 13
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/holder/MessageContentHolder.java
  49. 2 1
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/conversation/holder/ConversationCommonHolder.java
  50. 0 0
      tuikit/src/main/res/drawable-xxhdpi/bg_chat_purple.9.png
  51. 0 0
      tuikit/src/main/res/drawable-xxhdpi/bg_chat_white.9.png
  52. 2 2
      tuikit/src/main/res/layout/message_adapter_item_content.xml
  53. 104 0
      user/src/main/java/com/swago/user/store/BaseStoreDFragment.kt
  54. 65 28
      user/src/main/java/com/swago/user/store/StoreBuyDialog.kt
  55. 20 1
      user/src/main/java/com/swago/user/store/StoreItemAdapter.kt
  56. 4 4
      user/src/main/java/com/swago/user/store/StoreListActivity.kt
  57. 8 1
      user/src/main/java/com/swago/user/vm/StoreVm.kt
  58. 38 7
      user/src/main/res/layout/dialog_store_detail.xml
  59. 3 1
      user/src/main/res/layout/item_store.xml

+ 0 - 1
app/src/main/java/com/swago/app/SwagoApp.kt

@@ -46,7 +46,6 @@ class SwagoApp : Application() {
             Firebase.crashlytics.setUserId(it.user_account)
         }
         Firebase.crashlytics.setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
-        pushCrash()
         ActivityManagerUtil.get().init(this)
         ARouter.init(this)
         //svga缓存

+ 9 - 4
baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt

@@ -43,6 +43,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var nickIcon = ""
     var account = ""
     var roomId:String = ""
+    var headSpecial:String = ""
     var isAnchor = false //是否是主播点击了资料卡
     var isAdmin = false
     var isMessage = false
@@ -128,6 +129,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
                                     ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
                                         .withString("account",account)
                                         .withString("chatName",binding.tvName.text.toString())
+                                        .withString("headSpecial" , headSpecial).navigation()
                                     dismissAllowingStateLoss()
                                 } else {
                                     Toast.makeText(
@@ -157,11 +159,13 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
 
             binding.ivMore.setOnClickListener(object:NoDoubleClickListener(){
                 override fun onClick() {
-                    HandleDialogFragment.newInstance(uid,account,isForbid,isAnchor,inRoom,isAdmin){
-                        if (!TextUtils.isEmpty(uid)){
-                            userVm.getOtherUserInfo(uid,roomId)
+                    HandleDialogFragment.newInstance(uid,account,isForbid,isAnchor,inRoom,isAdmin).apply {
+                        this.refreshCallBack = {
+                            if (!TextUtils.isEmpty(uid)){
+                                userVm.getOtherUserInfo(uid,roomId)
+                            }
                         }
-                    }.show(parentFragmentManager,"HandleDialogFragment")
+                    }.show(childFragmentManager,"HandleDialogFragment")
                 }
             })
 
@@ -175,6 +179,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             nickName = it.user_name
             nickIcon = it.user_head_img_url
             account = it.user_account
+            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)

+ 2 - 3
baseswago/src/main/java/com/swago/baseswago/dialog/HandleDialogFragment.kt

@@ -29,6 +29,7 @@ class HandleDialogFragment : BaseXDFragment<DialogHandleBinding>() {
     private var inRoom = false
     private var isAnchor = false
     private var isRoomAdmin = false
+    var refreshCallBack:(()->Unit)? = null
 
 
     init {
@@ -38,9 +39,7 @@ class HandleDialogFragment : BaseXDFragment<DialogHandleBinding>() {
 
 
     companion object{
-        private var refreshCallBack:(()->Unit)? = null
-        fun newInstance(userId:String,account:String,isForbid:Int,isAnchor:Boolean,inRoom:Boolean=false,isRoomAdmin:Boolean=false,refreshCallBack:(()->Unit)? = null): HandleDialogFragment {
-            this.refreshCallBack = refreshCallBack
+        fun newInstance(userId:String,account:String,isForbid:Int,isAnchor:Boolean,inRoom:Boolean=false,isRoomAdmin:Boolean=false): HandleDialogFragment {
             val args = Bundle()
             args.putString("userId",userId)
             args.putString("account",account)

+ 2 - 2
baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt

@@ -102,7 +102,7 @@ interface RoomApi {
     suspend fun getRoomUser(
         @Field("room_id") room_id: String,
         @Field("page") page: Int = 1,
-        @Field("page_size") page_size: Int = 5
+        @Field("page_size") page_size: Int = 10
     ): RoomUserModel
 
     /**
@@ -113,7 +113,7 @@ interface RoomApi {
     suspend fun getHouseRoomUser(
         @Field("room_id") room_id: String,
         @Field("page") page: Int = 1,
-        @Field("page_size") page_size: Int = 5
+        @Field("page_size") page_size: Int = 10
     ): RoomUserModel
 
     /**

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

@@ -32,6 +32,7 @@ public class UserJoinRoomBean implements IRoomChat {
     public String androidJoinSpecial="";
     public String androidHeadSpecial="";
     public String androidBadgeSpecial="";
+    public String androidChatSpecial="";
     public String iosChatSpecial="";
 
     @NonNull

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

@@ -60,6 +60,8 @@ public class RoomModel {
     private String badge_special;
     private String chat_special;
 
+    private String broadcast_head_special;
+
     private CusNewMsgBean<RoomUserChangeModel> join_im_data;
 
     public String getRtc_token() {
@@ -317,4 +319,12 @@ public class RoomModel {
     public void setChat_special(String chat_special) {
         this.chat_special = chat_special;
     }
+
+    public String getBroadcast_head_special() {
+        return broadcast_head_special;
+    }
+
+    public void setBroadcast_head_special(String broadcast_head_special) {
+        this.broadcast_head_special = broadcast_head_special;
+    }
 }

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

@@ -30,7 +30,8 @@ data class AudioSendGiftModel(
     val senderAvatar:String,
     val im_data: ImData,
     val isCombo: Int,
-    val senderCode: String
+    val senderCode: String,
+    val androidHeadSpecial: String
 )
 
 data class Receiver(

+ 9 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/gift/IMGiftModel.java

@@ -57,6 +57,7 @@ public class IMGiftModel implements IPiaoTiao {
     private String userWealthJingyanValue;
 
     private String nextWealthNeedJingyan;
+    private String androidHeadSpecial;
 
     public String getRoomId() {
         return roomId;
@@ -250,4 +251,12 @@ public class IMGiftModel implements IPiaoTiao {
     public void setNextWealthNeedJingyan(String nextWealthNeedJingyan) {
         this.nextWealthNeedJingyan = nextWealthNeedJingyan;
     }
+
+    public String getAndroidHeadSpecial() {
+        return androidHeadSpecial;
+    }
+
+    public void setAndroidHeadSpecial(String androidHeadSpecial) {
+        this.androidHeadSpecial = androidHeadSpecial;
+    }
 }

+ 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)

+ 24 - 0
baseswago/src/main/java/com/swago/baseswago/util/StringUtils.kt

@@ -0,0 +1,24 @@
+package com.swago.baseswago.util
+
+import org.json.JSONObject
+import java.util.regex.Pattern
+
+object StringUtils {
+    fun extractJsonObjects(text: String): List<JSONObject> {
+        val jsonObjects = mutableListOf<JSONObject>()
+        val pattern = Pattern.compile("\\{.*?\\}")
+        val matcher = pattern.matcher(text)
+
+        while (matcher.find()) {
+            val jsonString = matcher.group()
+            try {
+                val jsonObject = JSONObject(jsonString)
+                jsonObjects.add(jsonObject)
+            } catch (e: Exception) {
+                e.printStackTrace()
+            }
+        }
+
+        return jsonObjects
+    }
+}

BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.webp


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.webp


+ 3 - 1
baseswago/src/main/res/values-ar/strings.xml

@@ -310,7 +310,7 @@
     <string name="Password_rooms_do_not_count_as_hours">أوقات غرفة القفل لم يتم احتسابها في المدة</string>
     <string name="clear_cache">مسح ذاكرة التخزين المؤقت</string>
     <string name="clear_cache_success">مسح ذاكرة التخزين المؤقت بنجاح</string>
-    <string name="dress_up">إرتد ملابس</string>
+    <string name="dress_up">زخارف بلدي</string>
     <string name="mall">مجمع تجاري</string>
     <string name="buy_it_now">اشتر الآن</string>
     <string name="entrance_effects">تأثيرات المدخل</string>
@@ -322,4 +322,6 @@
     <string name="this_product_has_been_purchased">لقد تم شراء هذا المنتج</string>
     <string name="purchase_successful">تم الشراء بنجاح</string>
     <string name="no_time_limit">لا يوجد حد زمني</string>
+    <string name="already_owned">مملوكة</string>
+    <string name="using">استخدام</string>
 </resources>

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

@@ -326,4 +326,6 @@
     <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>
+    <string name="already_owned">dimiliki</string>
+    <string name="using">digunakan</string>
 </resources>

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

@@ -323,4 +323,6 @@
     <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>
+    <string name="already_owned">dimiliki</string>
+    <string name="using">digunakan</string>
 </resources>

+ 3 - 1
baseswago/src/main/res/values-zh/strings.xml

@@ -310,7 +310,7 @@
     <string name="Password_rooms_do_not_count_as_hours">密码房不计入时长</string>
     <string name="clear_cache">清除缓存</string>
     <string name="clear_cache_success">清除成功</string>
-    <string name="dress_up">装扮</string>
+    <string name="dress_up">我的装扮</string>
     <string name="mall">商城</string>
     <string name="buy_it_now">立即购买</string>
     <string name="entrance_effects">入场特效</string>
@@ -322,4 +322,6 @@
     <string name="this_product_has_been_purchased">该商品已经购买</string>
     <string name="purchase_successful">购买成功</string>
     <string name="no_time_limit">不限时间</string>
+    <string name="already_owned">已拥有</string>
+    <string name="using">使用中</string>
 </resources>

+ 4 - 2
baseswago/src/main/res/values/strings.xml

@@ -332,16 +332,18 @@
     <string name="Password_rooms_do_not_count_as_hours">Lock room times didn\'t count into</string>
     <string name="clear_cache">clear cache</string>
     <string name="clear_cache_success">Clearance successful</string>
-    <string name="dress_up">Dress up</string>
+    <string name="dress_up">my decorations</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="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>
+    <string name="already_owned">owned</string>
+    <string name="using">using</string>
 </resources>

+ 18 - 38
home/src/main/java/com/swago/home/ChatDetailActivity.kt

@@ -47,8 +47,14 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
     @JvmField
     var chatName: 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)
@@ -59,16 +65,12 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
     }
 
     override fun loadData() {
-
     }
 
     override fun initOther() {
         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 +94,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?) {
 
@@ -123,48 +125,24 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
             }
         })
 
-        if (UserInfo.getUserInfo() != null && !TextUtils.isEmpty(UserInfo.getUserInfo()?.android_chat_special)){
-            UserInfo.getUserInfo()?.android_chat_special?.let {chatUrl ->
-                DianJiuUtil.loadDian9Tu(this ,chatUrl ){ drawable ->
-                    drawable?.let {
-                        messageRecyclerView?.rightBubble = it
-                    }
+        if (!TextUtils.isEmpty(headSpecial)){
+            svgaParser?.decodeFromURL(URL(headSpecial), object :SVGAParser.ParseCompletion{
+                override fun onComplete(videoItem: SVGAVideoEntity) {
+                    messageRecyclerView?.leftSvgaAvatar = videoItem
                 }
-            }
-        } 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(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() {
 
-                    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 +163,9 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
 
     override fun onDestroy() {
         super.onDestroy()
-
+        messageRecyclerView?.leftSvgaAvatar = null
+        messageRecyclerView?.rightSvgaAvatar = null
+        messageRecyclerView = null
     }
 
 }

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

@@ -17,6 +17,8 @@ import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.dialog.ChoiceDialogFragment
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.DianJiuUtil
+import com.swago.baseswago.util.LogUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.UserInfo
 import com.swago.home.databinding.FragmentMessageBinding
@@ -25,14 +27,17 @@ 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
+    private var jumpDetail = true
 
     override fun loadData() {
         officialVm.getMsgSum()
@@ -45,10 +50,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 +97,22 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
                 binding.tvCount.visibility = View.VISIBLE
             }
         }
+        userVm.otherUserInfoLiveData.observe(this){
+            if (jumpDetail){
+                ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
+                    .withInt("type", V2TIMConversation.V2TIM_C2C)
+                    .withString("account", conversationInfo?.id)
+                    .withString("chatName", conversationInfo?.title)
+                    .withString("headSpecial" , it.android_head_special)
+                    .navigation()
+            }
+            jumpDetail = false
+
+        }
+    }
+
+    override fun onResume() {
+        super.onResume()
+        jumpDetail = true
     }
 }

+ 27 - 36
home/src/main/res/layout/fragment_mine.xml

@@ -19,7 +19,7 @@
         android:layout_marginEnd="16dp"
         android:src="@mipmap/bg_edit"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/clAvatar" />
+        app:layout_constraintTop_toTopOf="@+id/ivAvatar" />
 
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tvEdit"
@@ -37,37 +37,28 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/ivEditBg" />
 
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/clAvatar"
+
+    <de.hdodenhof.circleimageview.CircleImageView
+        android:id="@+id/ivAvatar"
         android:layout_width="50dp"
         android:layout_height="50dp"
         android:layout_marginStart="16dp"
         android:layout_marginTop="66dp"
+        android:src="@mipmap/default_avatar"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" >
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
-            android:src="@mipmap/default_avatar"
-            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="50dp"
-            android:layout_height="50dp"
-            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>
+        app:layout_constraintTop_toTopOf="parent" />
 
+    <com.opensource.svgaplayer.SVGAImageView
+        android:id="@+id/svgAvatar"
+        android:layout_width="60dp"
+        android:layout_height="60dp"
+        android:visibility="visible"
+        app:autoPlay="true"
+        app:loopCount="0"
+        android:layout_marginStart="10dp"
+        android:layout_marginTop="60dp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
     <com.swago.baseswago.cusview.BoldTextView
         android:id="@+id/tvName"
@@ -78,8 +69,8 @@
         android:maxLines="1"
         android:textColor="#435568"
         android:textSize="20dp"
-        app:layout_constraintStart_toEndOf="@+id/clAvatar"
-        app:layout_constraintTop_toTopOf="@+id/clAvatar"
+        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+        app:layout_constraintTop_toTopOf="@+id/ivAvatar"
         tools:text="NickName" />
 
     <com.swago.baseswago.cusview.SwagoLevelView
@@ -166,8 +157,8 @@
         android:maxLines="1"
         android:textColor="#868686"
         android:textSize="12dp"
-        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
-        app:layout_constraintStart_toEndOf="@+id/clAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
         tools:text="ID:12030747" />
 
 
@@ -181,7 +172,7 @@
         app:layout_constraintEnd_toStartOf="@+id/llFans"
         app:layout_constraintHorizontal_chainStyle="spread"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvFollowNum"
@@ -210,7 +201,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toStartOf="@+id/llCoin"
         app:layout_constraintStart_toEndOf="@+id/llFollow"
-        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvFansNum"
@@ -239,7 +230,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toStartOf="@+id/llDiamonds"
         app:layout_constraintStart_toEndOf="@+id/llFans"
-        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvCoin"
@@ -268,7 +259,7 @@
         android:orientation="vertical"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toEndOf="@+id/llCoin"
-        app:layout_constraintTop_toBottomOf="@+id/clAvatar">
+        app:layout_constraintTop_toBottomOf="@+id/ivAvatar">
 
         <com.swago.baseswago.cusview.MediumTextView
             android:id="@+id/tvDiamonds"
@@ -363,7 +354,7 @@
             android:id="@+id/tvXStore"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:drawableTop="@mipmap/icon_my_store"
+            android:drawableTop="@mipmap/icon_my_outfit"
             android:drawablePadding="2dp"
             android:text="@string/mall"
             android:textColor="#131B23"
@@ -378,7 +369,7 @@
             android:id="@+id/tvXoutfit"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:drawableTop="@mipmap/icon_my_outfit"
+            android:drawableTop="@mipmap/icon_my_store"
             android:drawablePadding="2dp"
             android:text="@string/dress_up"
             android:textColor="#131B23"

BIN
home/src/main/res/mipmap-xxhdpi/icon_my_store.png


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

@@ -463,6 +463,16 @@ class RoomChatAdapter :
                         }
                     }
 
+                    mContext?.let {
+                        if (item is UserJoinRoomBean&&!item.androidChatSpecial.isNullOrEmpty()){
+                            DianJiuUtil.loadDian9Tu(it ,item.androidChatSpecial ){ drawable ->
+                                drawable?.let { drawable ->
+                                    tvContent.background = drawable
+                                }
+                            }
+                        }
+                    }
+
                 }
             }
 

+ 6 - 2
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
@@ -30,8 +31,9 @@ class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(
                 .placeholder(R.mipmap.default_avatar)
                 .error(R.mipmap.default_avatar).into(ivAvatar)
 
-            if (!item.android_head_special.isNullOrEmpty()){
-                svgaParser.decodeFromURL(URL(item.android_head_special), object :SVGAParser.ParseCompletion{
+            if (!item.android_head_special.isNullOrEmpty() || !item.head_special.isNullOrEmpty()){
+                svgAvatar.visibility = View.VISIBLE
+                svgaParser.decodeFromURL(URL(if (item.android_head_special.isNullOrEmpty()) item.head_special else item.android_head_special), object :SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
                         svgAvatar.setImageDrawable(drawable)
@@ -41,6 +43,8 @@ class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(
                     override fun onError() {
                     }
                 })
+            } else{
+                svgAvatar.visibility = View.INVISIBLE
             }
 
         }

+ 41 - 8
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -1,5 +1,7 @@
 package com.swago.room.audio
 
+import android.graphics.drawable.Drawable
+import android.view.View
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
 import com.opensource.svgaplayer.SVGADrawable
@@ -8,6 +10,7 @@ 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.baseswago.util.LogUtil
 import com.swago.room.R
 import java.net.URL
 
@@ -16,9 +19,22 @@ class AudioSeatAdapter :
     private val svgaParser by lazy {
         SVGAParser(mContext)
     }
+
+    private val svgaVideoEntityMap: MutableMap<Int, OldSeatModel?> = mutableMapOf(
+        0 to null,
+        1 to null,
+        2 to null,
+        3 to null,
+        4 to null,
+        5 to null,
+        6 to null,
+        7 to null
+    )
+
     override fun convert(helper: BaseViewHolder?, item: AudioSeatModel?) {
         helper?.apply {
             item?.let {
+                val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
                 if (it.user_id == "0") {
                     setVisible(R.id.tvIntegration, false)
                     setVisible(R.id.ivAudioState, false)
@@ -30,8 +46,9 @@ class AudioSeatAdapter :
                         itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                             .loadImage(R.mipmap.ic_audio_seat)
                     }
+                    svgaVideoEntityMap[adapterPosition] = null
+                    svgAvatar.visibility = View.INVISIBLE
                 } 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)
@@ -56,18 +73,32 @@ class AudioSeatAdapter :
                         }
 
                     }
+                    if (!it.head_special.isNullOrEmpty() ){
+                        svgAvatar.visibility = View.VISIBLE
+                        if (svgaVideoEntityMap[adapterPosition] == null || svgaVideoEntityMap[adapterPosition]?.url != item.head_special){
+                            svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
+                                override fun onComplete(videoItem: SVGAVideoEntity) {
+                                    val drawable = SVGADrawable(videoItem)
+                                    svgaVideoEntityMap[adapterPosition] = OldSeatModel(videoItem,it.head_special)
+                                    svgAvatar.setImageDrawable(drawable)
+                                    svgAvatar.startAnimation()
+                                }
 
-                    if (!it.head_special.isNullOrEmpty()){
-                        svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
-                            override fun onComplete(videoItem: SVGAVideoEntity) {
-                                val drawable = SVGADrawable(videoItem)
+                                override fun onError() {
+                                }
+                            })
+                        } else {
+                            svgaVideoEntityMap[adapterPosition]?.let { oldSeat ->
+                                val drawable = SVGADrawable(oldSeat.drawable)
                                 svgAvatar.setImageDrawable(drawable)
                                 svgAvatar.startAnimation()
                             }
 
-                            override fun onError() {
-                            }
-                        })
+                        }
+
+                    } else {
+                        svgaVideoEntityMap[adapterPosition] = null
+                        svgAvatar.visibility = View.INVISIBLE
                     }
 
                 }
@@ -75,4 +106,6 @@ class AudioSeatAdapter :
         }
 
     }
+
+    data class  OldSeatModel(val drawable: SVGAVideoEntity,val url:String?)
 }

+ 77 - 32
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -5,7 +5,6 @@ import android.graphics.Rect
 import android.text.TextUtils
 import android.util.Log
 import android.view.View
-import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.TextView
 import android.widget.Toast
@@ -26,7 +25,6 @@ import com.liulishuo.okdownload.core.cause.ResumeFailedCause
 import com.permissionx.guolindev.PermissionX
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.UserVm
-import com.swago.baseswago.agora.AgoraManager
 import com.swago.baseswago.baseroom.*
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.constant.UrlConstant
@@ -60,8 +58,6 @@ import com.swago.room.databinding.FragmentBaseComBinding
 import com.swago.room.dialog.AudienceListDialog
 import com.swago.room.dialog.FanClubAnchorDialog
 import com.swago.room.dialog.FanClubForUserDialog
-import com.swago.room.dialog.FooterMoreDialog
-import com.swago.room.dialog.HouseGoLiveDialog
 import com.swago.room.dialog.JoinFanClubDialog
 import com.swago.room.dialog.LevelUpDialog
 import com.swago.room.dialog.MessageListDialog
@@ -79,6 +75,7 @@ import com.swago.room.hongbao.RedEnvelopeDialog
 import com.swago.room.inter.IFooter
 import com.swago.room.inter.IHeader
 import com.swago.room.lianmai.LianMaiVm
+import com.swago.room.manager.JoinAnimalManager
 import com.swago.room.piaotiao.WaftManager
 import com.swago.room.pk.IPKListener
 import com.swago.room.pk.PKStateManager
@@ -91,9 +88,12 @@ 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.delay
+import kotlinx.coroutines.isActive
 import kotlinx.coroutines.launch
 import java.io.File
 import java.lang.Exception
@@ -140,10 +140,10 @@ 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
-    var msgListDialog: MessageListDialog? = null
 
     val gameList by lazy {
         ArrayList<GameModel>()
@@ -157,6 +157,10 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         SvgPlayerManager()
     }
 
+    private val joinAnimalManager by lazy {
+        JoinAnimalManager()
+    }
+
     private val waftManager by lazy {
         WaftManager()
     }
@@ -221,6 +225,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         chatAdapter.setNewData(dataChatList)
         context?.let {
             svgPlayerManager.init(it, binding.xSvgaPlayer, binding.svgDanDaoView)
+            joinAnimalManager.init(it, binding.xSvgaPlayer)
         }
 
         activity?.let {
@@ -237,6 +242,21 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
                 roomOtherVm.userDianZan()
             }
         }
+
+        coroutineScope.launch {
+            while (isActive){
+                SwagoRoomManager.iRoomInfo?.let {
+                    if (it.getRoomType() == RoomType.AUDIO.type){
+                        roomVm.getAudioList(it.getAnchorId(), 2)
+                    }
+                }
+                if (SwagoRoomManager.roleType == RoleType.anchor){
+                    roomVm.loadRoomData()
+                }
+                delay(10000)
+            }
+        }
+
     }
 
     private fun initAudioRvList() {
@@ -452,9 +472,26 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         (iHeader as ComHeaderView).openAudienceListDialog = {
             AudienceListDialog.newInstance().apply {
                 this.showUserInfo = {userid ->
-                   PersonDataDFragment.newInstance(userid,
-                       isAnchor = false,
-                       inRoom = true).show(this@BaseComFragment.childFragmentManager,"PersonDataDFragment")
+                    PersonDataDFragment.newInstance(userid,
+                        isAnchor = false,
+                        inRoom = true).apply {
+                        this.openGiftIconDialog = { nickName, userId ,nickIcon->
+                            openGiftDialog(nickName, userId)
+                        }
+                        this.sendMsgInRoom = {
+                            if (isForbid) {
+                                Toast.makeText(
+                                    AppContext.getContext(),
+                                    AppContext.getContext().resources.getString(
+                                        R.string.you_are_been_forbid
+                                    ),
+                                    Toast.LENGTH_SHORT
+                                ).show()
+                            } else {
+                                openSendMessageDialog("@${it} ")
+                            }
+                        }
+                    }.show(this@BaseComFragment.childFragmentManager,"PersonDataDFragment")
                 }
             }.show(childFragmentManager, "AudienceListDialog")
         }
@@ -484,16 +521,16 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         }
         //推荐游戏列表
         roomVm.recommendGameListModelLiveData.observe(this){
-                binding.playBannerView.setData(it.list)
-                binding.playBannerView.jumpToWebFun = { game ->
-                    setRecommendGame(game)
+            binding.playBannerView.setData(it.list)
+            binding.playBannerView.jumpToWebFun = { game ->
+                setRecommendGame(game)
 
-                }
-                binding.videoPlayBannerView.setData(it.list)
-                binding.videoPlayBannerView.jumpToWebFun = { game ->
-                    setRecommendGame(game)
+            }
+            binding.videoPlayBannerView.setData(it.list)
+            binding.videoPlayBannerView.jumpToWebFun = { game ->
+                setRecommendGame(game)
 
-                }
+            }
         }
 
         //直播间配置
@@ -527,8 +564,11 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         //语音房麦位列表数据
         roomVm.audioSeatListLiveData.observe(this) {
             if (it != null) {
-                audioSeatAdapter.setNewData(it)
-                initMaiPosition()
+                if (audioSeatAdapter.data !=  it){
+                    audioSeatAdapter.setNewData(it)
+                    initMaiPosition()
+                }
+
             }
         }
 
@@ -600,6 +640,14 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             userVm.getUserInfo()
         }
 
+        msgVm.joinRoomFun = {
+            //svg播放
+            if (!it.androidJoinSpecial.isNullOrEmpty()){
+                joinAnimalManager.addSvgUrl(it)
+            }
+
+        }
+
         userVm.userInfoLiveData.observe(this) {
             UserInfo.setUserInfo(it)
             SpUtil.putString("user_info", Gson().toJson(it))
@@ -717,9 +765,8 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
 
     override fun onDestroyView() {
         super.onDestroyView()
-        dialog = null
         gameDialog = null
-        msgListDialog = null
+        job.cancel()
         PKStateManager.removePKListener(this)
         activity?.let {
             KeyboardUtils.unregisterSoftInputChangedListener(it.window)
@@ -729,11 +776,11 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     }
 
     fun openSendMessageDialog(atName: String = "") {
-        dialog = SendMsgDialog.newInstance(atName)
-        dialog?.addSenderMsgToRoomChatList = {
-            addChatMsgToRv(it)
-        }
-        dialog?.show(childFragmentManager, "SendMsgDialog")
+        SendMsgDialog.newInstance(atName).apply {
+            this.addSenderMsgToRoomChatList = {
+                addChatMsgToRv(it)
+            }
+        }.show(childFragmentManager, "SendMsgDialog")
     }
 
     fun openMoreDialog(){
@@ -748,8 +795,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     }
 
     fun openMessageListDialog() {
-        msgListDialog = MessageListDialog.newInstance()
-        msgListDialog?.show(childFragmentManager, "MessageListDialog")
+       MessageListDialog.newInstance().show(childFragmentManager, "MessageListDialog")
     }
 
     private var gameIsOpen = false
@@ -763,9 +809,9 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             )
             if (download) {
                 gameDialog =
-                    GamePlayDialog.newInstance("file://" + UrlConstant.appGameRootPath + File.separator + it.getGameType() + File.separator + "index.html",it.getIsFullGame())
+                    GamePlayDialog.newInstance("file://" + UrlConstant.appGameRootPath + File.separator + it.getGameType() + File.separator + "index.html",it.getIsFullGame(),it.getGameType().toString())
             } else {
-                gameDialog = GamePlayDialog.newInstance(it.getGameUrl(),it.getIsFullGame())
+                gameDialog = GamePlayDialog.newInstance(it.getGameUrl(),it.getIsFullGame(),it.getGameType().toString())
             }
             gameDialog?.dialogDisFun = {
                 gameIsOpen = false
@@ -880,9 +926,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
 
     override fun leaveRoom(iRoomInfo: IRoomInfo) {
         dataChatList.clear()
-        dialog = null
         gameDialog = null
-        msgListDialog = null
         chatAdapter.notifyDataSetChanged()
         if (iRoomInfo.getRoomType() == RoomType.AUDIO.type){
             val data = ArrayList<AudioSeatModel>()
@@ -893,6 +937,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
 
     override fun closeRoomed() {
         binding.likeLayout.clear()
+        gameDialog = null
         RoomTimer.timeTickList.remove(this)
     }
 

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

@@ -200,7 +200,7 @@ class UserRoomModel : IRoomInfo {
 
     override fun getHeadSpecial(): String {
         return if (RoleType.user == SwagoRoomManager.roleType) {
-            momentModel?.head_special ?: ""
+            roomModel?.broadcast_head_special ?: ""
         } else {
             roomModel?.head_special ?: ""
         }

+ 0 - 1
room/src/main/java/com/swago/room/dialog/AudienceListDialog.kt

@@ -73,7 +73,6 @@ class AudienceListDialog : BaseListDialogFragment<DialogAudienceListBinding,Room
                } else {
                    adapter.loadMoreEnd()
                }
-
            }
        }
 

+ 29 - 10
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,16 @@ 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
+    private var jumpDetail = true
 
     init {
         setDimAmount(0f)
@@ -35,25 +41,38 @@ class MessageListDialog : BaseXDFragment<DialogMessageListBinding>() {
 
 
     override fun initOther() {
-        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()
-            }
+        binding.conversation.initDefault()
+        binding.conversation.conversationList.setOnItemClickListener { view, position, messageInfo ->
+            conversationInfo = messageInfo
+            userVm.getOtherUserInfo(messageInfo.id,"")
+        }
 
-            binding.conversation.conversationList.setOnItemLongClickListener { view, position, messageInfo ->
+        binding.conversation.conversationList.setOnItemLongClickListener { view, position, messageInfo ->
 
-            }
+        }
 
+        userVm.otherUserInfoLiveData.observe(viewLifecycleOwner){model ->
+            if (jumpDetail){
+                ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
+                    .withInt("type", V2TIMConversation.V2TIM_C2C)
+                    .withString("account", conversationInfo?.id)
+                    .withString("chatName", conversationInfo?.title)
+                    .withString("headSpecial" , model.android_head_special)
+                    .navigation()
+            }
+            jumpDetail = false
         }
     }
 
     override fun initLiveData() {}
     override fun onDestroyView() {
         ConversationManagerKit.getInstance().detachAdapter()
+        userVm.otherUserInfoLiveData.removeObservers(viewLifecycleOwner)
         super.onDestroyView()
     }
+
+    override fun onResume() {
+        super.onResume()
+        jumpDetail = true
+    }
 }

+ 6 - 1
room/src/main/java/com/swago/room/dialog/SendMsgDialog.kt

@@ -217,12 +217,17 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
     }
 
     override fun initLiveData() {
-        roomOtherVm.sendDanMuResultLiveData.observe(this){
+        roomOtherVm.sendDanMuResultLiveData.observe(viewLifecycleOwner){
             SwagoLoading.cancelLoadingDialog()
             dismissAllowingStateLoss()
         }
     }
 
+    override fun onDestroyView() {
+        roomOtherVm.sendDanMuResultLiveData.removeObservers(viewLifecycleOwner)
+        super.onDestroyView()
+    }
+
     override fun dismiss() {
         binding.et.setText("")
         super.dismiss()

+ 14 - 10
room/src/main/java/com/swago/room/game/GamePlayDialog.kt

@@ -42,6 +42,7 @@ import java.io.File
 class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListener {
 
     private var url = ""
+    private var gameType = ""
 
     private var webView: WebView? = null
     private var localGameUrl = ""
@@ -54,18 +55,18 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
 
     private val imGroupNewMsgListener = IMGroupNewMsgListener()
 
-    private var isFullScreen = false
-
     var dialogDisFun: (() -> Unit)? = null
     var openMessageFun:(()->Unit)? = null
     companion object {
         private const val URL = "url"
         private const val FULL_GAME = "fullGame"
-        fun newInstance(url: String,isFullGame:Boolean): GamePlayDialog {
+        private const val GAME_TYPE = "gameType"
+        fun newInstance(url: String,isFullGame:Boolean,gameType:String): GamePlayDialog {
             val dialog = GamePlayDialog()
             val bundle = Bundle()
             bundle.putString(URL, url)
             bundle.putBoolean(FULL_GAME, isFullGame)
+            bundle.putString(GAME_TYPE,gameType)
             dialog.arguments = bundle
             return dialog
         }
@@ -85,7 +86,6 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
             if (url.startsWith("file://")){
                 localGameUrl = url
             }
-            isFullScreen = it.getBoolean(FULL_GAME,false)
             activity?.let { activity ->
 
                 webView = WebView(activity)
@@ -94,7 +94,11 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
                 imageViewLayoutParams.bottomToBottom = R.id.cl
                 imageViewLayoutParams.leftToLeft = R.id.cl
                 imageViewLayoutParams.leftMargin = DpPxUtil.dip2px(10f)
-                imageViewLayoutParams.bottomMargin = DpPxUtil.dip2px(320f)
+                if (gameType == "9"){
+                    imageViewLayoutParams.bottomMargin = DpPxUtil.dip2px(390f)
+                } else {
+                    imageViewLayoutParams.bottomMargin = DpPxUtil.dip2px(340f)
+                }
                 val imageView = ImageView(activity)
                 imageView.setBackgroundResource(R.drawable.shape_80000000_20)
                 imageView.setImageResource(R.mipmap.live_chat)
@@ -158,11 +162,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)

+ 9 - 0
room/src/main/java/com/swago/room/gift/GiftDialog.kt

@@ -861,4 +861,13 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
             }
         }
     }
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+        luckyFragment = null
+        hotFragment = null
+        luxuryFragment = null
+        specialFragment = null
+        mingRenTangFragment = null
+    }
 }

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

@@ -31,6 +31,7 @@ class MaiUserAdapter : BaseQuickAdapter<MaiUserInfo, BaseViewHolder>(R.layout.it
                     view.visibility = View.GONE
                 }
                 if (!TextUtils.isEmpty(it.head_special)){
+                    svgaImageView.visibility = View.VISIBLE
                     svgaParser.decodeFromURL(URL(item.head_special), object : SVGAParser.ParseCompletion{
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
@@ -41,6 +42,8 @@ class MaiUserAdapter : BaseQuickAdapter<MaiUserInfo, BaseViewHolder>(R.layout.it
                         override fun onError() {
                         }
                     })
+                } else {
+                    svgaImageView.visibility = View.INVISIBLE
                 }
             }
         }

+ 22 - 7
room/src/main/java/com/swago/room/gift/control/XSvgPlayer.kt

@@ -10,6 +10,7 @@ import com.opensource.svgaplayer.SVGACallback
 import com.opensource.svgaplayer.SVGADrawable
 import com.opensource.svgaplayer.SVGAParser
 import com.opensource.svgaplayer.SVGAVideoEntity
+import com.swago.baseswago.model.im.UserJoinRoomBean
 import com.swago.baseswago.model.live.gift.IMGiftModel
 import com.swago.baseswago.util.LogUtil
 import com.swago.room.databinding.ViewSvgaBinding
@@ -32,6 +33,8 @@ class XSvgPlayer : ConstraintLayout {
      */
     var isPlaying = false
 
+    var callbackExecuted = true
+
     constructor(context: Context) : super(context)
     constructor(context: Context, mAttributeSet: AttributeSet?) : super(context, mAttributeSet){
         initView(context)
@@ -85,14 +88,22 @@ class XSvgPlayer : ConstraintLayout {
         }
     }
 
-    fun playJoinRoomSvga(svgaUrl:String?){
-        if (svgaUrl.isNullOrEmpty()){
+    fun playJoinRoomSvga(userJoinRoomBean: UserJoinRoomBean?){
+        if (userJoinRoomBean == null || userJoinRoomBean.androidJoinSpecial.isNullOrEmpty()){
             return
         }
+        if (Regex("%E8%B1%AA%E5%8D%8E%E6%B8%B8%E8%BD%AE").containsMatchIn(userJoinRoomBean.androidJoinSpecial)){
+            binding?.svgaImageView?.layoutParams = ( binding?.svgaImageView?.layoutParams as MarginLayoutParams).apply {
+                bottomMargin = -155 // 以像素为单位设置底部边距
+                topMargin = -155 // 以像素为单位设置顶部边距
+            }
+        }
         svgaParser!!.let {
             LogUtil.d("svgPlayer","xxx--$isPlaying")
-            it.decodeFromURL(URL(svgaUrl),object:SVGAParser.ParseCompletion{
+            callbackExecuted = false
+            it.decodeFromURL(URL(userJoinRoomBean.androidJoinSpecial),object:SVGAParser.ParseCompletion{
                 override fun onComplete(videoItem: SVGAVideoEntity) {
+                    callbackExecuted = true
                     binding!!.apply {
                         val drawable = SVGADrawable(videoItem)
                         svgaImageView.visibility = View.VISIBLE
@@ -110,6 +121,7 @@ class XSvgPlayer : ConstraintLayout {
                 }
 
                 override fun onError() {
+                    callbackExecuted = true
                     binding?.apply {
                         isPlaying = false
                         LogUtil.d("svgPlayer","onError--$isPlaying")
@@ -117,12 +129,15 @@ class XSvgPlayer : ConstraintLayout {
                         nextSvgPlay?.invoke()
                     }
                 }
-            },object:SVGAParser.PlayCallback{
-                override fun onPlay(file: List<File>) {
-                    LogUtil.d("svgPlayer","onPlay--${file.size}")
+            })
+
+            handler.postDelayed({
+                if (!callbackExecuted){
+                    playJoinRoomSvga(userJoinRoomBean)
+                    LogUtil.d("JoinAnimalManager","callbackExecuted")
                 }
 
-            })
+            },7000)
 
         }
     }

+ 16 - 0
room/src/main/java/com/swago/room/giftdandao/GiftDanDaoView.kt

@@ -30,6 +30,7 @@ import com.swago.room.BuildConfig
 import com.swago.room.R
 import com.swago.room.databinding.ViewItemGiftBinding
 import java.io.File
+import java.net.URL
 
 /**
  *@date 2022/1/22 16:57
@@ -89,6 +90,21 @@ class GiftDanDaoView : FrameLayout {
                 .error(R.mipmap.default_avatar)
                 .into(ivGiftIcon)
 
+            if (!imGiftModel.androidHeadSpecial.isNullOrEmpty()){
+                svgAvatar.visibility =View.VISIBLE
+                svgParser?.decodeFromURL(URL(imGiftModel.androidHeadSpecial), object : SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        svgAvatar.setImageDrawable(drawable)
+                        svgAvatar.startAnimation()
+                    }
+                    override fun onError() {
+                    }
+                })
+            } else {
+                svgAvatar.visibility =View.INVISIBLE
+            }
+
             tvSenderName.text = imGiftModel.senderName
             if (!tvSenderName.isSelected) {
                 tvSenderName.isSelected = true

+ 82 - 0
room/src/main/java/com/swago/room/manager/JoinAnimalManager.kt

@@ -0,0 +1,82 @@
+package com.swago.room.manager
+
+import android.content.Context
+import com.opensource.svgaplayer.SVGAParser
+import com.swago.baseswago.baseroom.IRoomActiveListener
+import com.swago.baseswago.baseroom.IRoomInfo
+import com.swago.baseswago.baseroom.SwagoRoomManager
+import com.swago.baseswago.model.im.UserJoinRoomBean
+import com.swago.baseswago.model.live.gift.IMGiftModel
+import com.swago.baseswago.util.LogUtil
+import com.swago.room.gift.control.XSvgPlayer
+import java.util.*
+
+/**
+ *@date 2021/12/11 16:42
+ *description:
+ */
+class JoinAnimalManager : IRoomActiveListener {
+
+    private val svgListQueue = LinkedList<UserJoinRoomBean>()
+    private var xSvgPlayer: XSvgPlayer? = null
+
+    fun init(context: Context, xSvgPlayer: XSvgPlayer) {
+        SVGAParser.shareParser().init(context)
+        this.xSvgPlayer = xSvgPlayer
+        SwagoRoomManager.addListener(this)
+
+        this.xSvgPlayer?.nextSvgPlay = {
+            svgListQueue.poll()
+            val uerJoinRoomBean = svgListQueue.peek()
+            LogUtil.d("SvgPlayerManager","${svgListQueue.size}")
+            if (uerJoinRoomBean==null){
+                LogUtil.d("SvgPlayerManager","clear svgListQueue")
+                svgListQueue.clear()
+            }else{
+                if (this.xSvgPlayer==null){
+                    svgListQueue.clear()
+                    LogUtil.d("SvgPlayerManager","xSvgPlayer 为空")
+                }else{
+                    this.xSvgPlayer!!.playJoinRoomSvga(uerJoinRoomBean)
+                }
+
+            }
+        }
+    }
+
+    override fun changeRoom(iRoomInfo: IRoomInfo) {
+        svgListQueue.clear()
+        xSvgPlayer?.clear()
+    }
+
+    override fun leaveRoom(iRoomInfo: IRoomInfo) {
+        svgListQueue.clear()
+        xSvgPlayer?.clear()
+    }
+
+    override fun joinedRoom(iRoomInfo: IRoomInfo) {
+
+    }
+
+    override fun endRoom(iRoomInfo: IRoomInfo?) {
+
+    }
+
+    override fun closeRoomed() {
+        svgListQueue.clear()
+        xSvgPlayer?.clear()
+        SwagoRoomManager.removeListener(this)
+    }
+
+    fun addSvgUrl(userJoinRoomBean: UserJoinRoomBean?) {
+        userJoinRoomBean?.let {
+            if (svgListQueue.isEmpty()) {
+                LogUtil.d("SvgPlayerManager","数据源没有数据 新增一条")
+                svgListQueue.add(it)
+                this.xSvgPlayer?.playJoinRoomSvga(it)
+            } else {
+                svgListQueue.add(it)
+            }
+        }
+    }
+}

+ 22 - 0
room/src/main/java/com/swago/room/manager/JoinRoomManager.kt

@@ -13,6 +13,7 @@ import android.widget.TextView
 import android.widget.Toast
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.fragment.app.FragmentActivity
+import androidx.transition.Visibility
 import com.opensource.svgaplayer.SVGADrawable
 import com.opensource.svgaplayer.SVGAImageView
 import com.opensource.svgaplayer.SVGAParser
@@ -124,6 +125,7 @@ class JoinRoomManager : IRoomActiveListener {
                 animationSet?.start()
                 joinRoomRootView?.visibility = View.VISIBLE
                 if (!userJoinRoomBean.androidHeadSpecial.isNullOrEmpty()) {
+                    svgaAvatar?.visibility = View.VISIBLE
                     svgParser?.decodeFromURL(URL(userJoinRoomBean.androidHeadSpecial), object :SVGAParser.ParseCompletion{
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
@@ -134,6 +136,8 @@ class JoinRoomManager : IRoomActiveListener {
                         override fun onError() {
                         }
                     })
+                } else {
+                    svgaAvatar?.visibility = View.INVISIBLE
                 }
             }
             in 15..19 -> {
@@ -148,6 +152,7 @@ class JoinRoomManager : IRoomActiveListener {
                 animationSet?.start()
                 joinRoomRootView?.visibility = View.VISIBLE
                 if (!userJoinRoomBean.androidHeadSpecial.isNullOrEmpty()) {
+                    svgaAvatar?.visibility = View.VISIBLE
                     svgParser?.decodeFromURL(URL(userJoinRoomBean.androidHeadSpecial), object :SVGAParser.ParseCompletion{
                         override fun onComplete(videoItem: SVGAVideoEntity) {
                             val drawable = SVGADrawable(videoItem)
@@ -158,6 +163,8 @@ class JoinRoomManager : IRoomActiveListener {
                         override fun onError() {
                         }
                     })
+                } else {
+                    svgaAvatar?.visibility = View.INVISIBLE
                 }
             }
             else -> {
@@ -205,6 +212,21 @@ class JoinRoomManager : IRoomActiveListener {
                     })
 
                 }
+                if (!userJoinRoomBean.androidHeadSpecial.isNullOrEmpty()) {
+                    svgaAvatar?.visibility = View.VISIBLE
+                    svgParser?.decodeFromURL(URL(userJoinRoomBean.androidHeadSpecial), object :SVGAParser.ParseCompletion{
+                        override fun onComplete(videoItem: SVGAVideoEntity) {
+                            val drawable = SVGADrawable(videoItem)
+                            svgaAvatar?.setImageDrawable(drawable)
+                            svgaAvatar?.startAnimation()
+                        }
+
+                        override fun onError() {
+                        }
+                    })
+                } else {
+                    svgaAvatar?.visibility = View.INVISIBLE
+                }
             }
         }
     }

+ 0 - 1
room/src/main/java/com/swago/room/user/UserRoomFragment.kt

@@ -246,7 +246,6 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
     override fun joinedRoom(iRoomInfo: IRoomInfo) {
         super.joinedRoom(iRoomInfo)
         SwagoRoomManager.iRoomInfo?.let {
-            binding.xSvgaPlayer.playJoinRoomSvga(iRoomInfo.getJoinSpecial())
             if (it.getAudioNotice().isNotEmpty()){
                 AudioNoticeUserDialog.newInstance().show(childFragmentManager,"AudioNoticeUserDialog")
             }

+ 7 - 0
room/src/main/java/com/swago/room/vm/MsgVm.kt

@@ -156,6 +156,11 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
 
     var changeNameChangeFun:((data: ChangeNameData) -> Unit)? = null
 
+    /**
+     * 进入直播间动画
+     * */
+    var joinRoomFun:((data: UserJoinRoomBean) -> Unit)? = null
+
     val joinRoomManager by lazy {
         JoinRoomManager()
     }
@@ -177,6 +182,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                     it.data?.let {
                         updateHotValue?.invoke(it.hotValue)
                         joinRoomManager.addJoinRoomData(it)
+                        joinRoomFun?.invoke(it)
                         BitmapUtils.loadFile(AppContext.getContext() , it.androidBadgeSpecial){ bitmap ->
                             newChatMsgFun?.invoke(it)
                         }
@@ -701,6 +707,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                                 imGiftModel.senderAvatar = it.senderAvatar
                                 imGiftModel.isCombo = it.isCombo
                                 imGiftModel.senderCode = it.senderCode
+                                imGiftModel.androidHeadSpecial = it.androidHeadSpecial
                                 imGiftModel.receiverUserId = receiverUserId.toString()
                                 showGiftDanDao?.invoke(imGiftModel)
                             } else {

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

@@ -135,6 +135,7 @@
             android:orientation="horizontal"
             android:visibility="gone"
             tools:visibility="visible"
+            android:layoutDirection="ltr"
             android:layout_marginBottom="10dp"
             app:layout_constraintBottom_toTopOf="@+id/ll_change"
             app:layout_constraintEnd_toEndOf="parent"

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

@@ -25,7 +25,7 @@
             android:id="@+id/svgAvatar"
             android:layout_width="68dp"
             android:layout_height="68dp"
-            android:visibility="visible"
+            android:visibility="invisible"
             app:autoPlay="true"
             app:loopCount="0"
             app:layout_constraintStart_toStartOf="parent"

+ 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"/>
 

+ 1 - 1
room/src/main/res/layout/view_user_join_room.xml

@@ -89,7 +89,7 @@
                 android:id="@+id/svgAvatar"
                 android:layout_width="44dp"
                 android:layout_height="44dp"
-                android:visibility="visible"
+                android:visibility="invisible"
                 app:autoPlay="true"
                 app:loopCount="0"
                 app:layout_constraintStart_toStartOf="parent"

+ 17 - 0
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/base/ChatManagerKit.java

@@ -6,6 +6,8 @@ import android.os.Message;
 import android.text.TextUtils;
 
 import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.swago.baseswago.util.UserInfo;
 import com.tencent.imsdk.BaseConstants;
 import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener;
 import com.tencent.imsdk.v2.V2TIMCallback;
@@ -42,6 +44,9 @@ import java.util.List;
 
 import static com.tencent.imsdk.v2.V2TIMMessage.V2TIM_MSG_STATUS_SEND_FAIL;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 public abstract class ChatManagerKit extends V2TIMAdvancedMsgListener implements MessageRevokedManager.MessageRevokeHandler, IBaseMessageSender {
     private static final String TAG = ChatManagerKit.class.getSimpleName();
 
@@ -472,6 +477,18 @@ public abstract class ChatManagerKit extends V2TIMAdvancedMsgListener implements
         }
 
         v2TIMMessage.setExcludedFromLastMessage(TUIKitConfigs.getConfigs().getGeneralConfig().isExcludedFromLastMessage());
+        if (!TextUtils.isEmpty(UserInfo.INSTANCE.getUserInfo().getAndroid_chat_special())){
+            V2TIMCustomElem elem = new V2TIMCustomElem();
+            JSONObject jsonObject = new JSONObject();
+            try {
+                jsonObject.put("android_chat_special", UserInfo.INSTANCE.getUserInfo().getAndroid_chat_special());
+                jsonObject.put("ios_chat_special", UserInfo.INSTANCE.getUserInfo().getIos_chat_special());
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+            elem.setData(jsonObject.toString().getBytes());
+            v2TIMMessage.getTextElem().appendElem(elem);
+        }
 
         String msgID = V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, isGroup ? null : userID, isGroup ? groupID : null,
                 V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<V2TIMMessage>() {

+ 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;
         }
     }

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

@@ -1,5 +1,6 @@
 package com.tencent.qcloud.tim.uikit.modules.chat.layout.message.holder;
 
+import android.graphics.drawable.NinePatchDrawable;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
@@ -12,14 +13,26 @@ import android.widget.TextView;
 import com.bumptech.glide.Glide;
 import com.opensource.svgaplayer.SVGAImageView;
 import com.swago.baseswago.util.AppContext;
+import com.swago.baseswago.util.DianJiuUtil;
+import com.swago.baseswago.util.StringUtils;
 import com.swago.baseswago.util.UserInfo;
+import com.tencent.imsdk.message.CustomElement;
+import com.tencent.imsdk.v2.V2TIMCustomElem;
 import com.tencent.imsdk.v2.V2TIMMessage;
 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 org.json.JSONObject;
+
+import java.util.List;
 
 import de.hdodenhof.circleimageview.CircleImageView;
+import kotlin.Unit;
+import kotlin.jvm.functions.Function1;
 
 public abstract class MessageContentHolder extends MessageEmptyHolder {
 
@@ -120,28 +133,44 @@ public abstract class MessageContentHolder extends MessageEmptyHolder {
             sendingProgress.setVisibility(View.GONE);
         }
 
-        //// 聊天气泡设置
-        if (msg.isSelf()) {
-            if (properties.getRightBubble() != null && properties.getRightBubble().getConstantState() != null) {
-                msgContentFrame.setBackground(properties.getRightBubble().getConstantState().newDrawable());
+        String customElem = msg.getTimMessage().toString();
+        List<JSONObject> customEle = StringUtils.INSTANCE.extractJsonObjects(customElem);
+        if (!customEle.isEmpty()){
+            String android_chat_special = customEle.get(0).optString("android_chat_special");
+            DianJiuUtil.INSTANCE.loadDian9Tu(AppContext.getContext(), android_chat_special, new Function1<NinePatchDrawable, Unit>() {
+                @Override
+                public Unit invoke(NinePatchDrawable ninePatchDrawable) {
+                    if (ninePatchDrawable != null){
+                        msgContentLinear.setBackground(ninePatchDrawable);
+                    }
+                    return null;
+                }
+            });
+        } else {
+            if (msg.isSelf()){
+                msgContentLinear.setBackgroundResource(R.drawable.bg_chat_purple);
             } else {
-                msgContentFrame.setBackgroundResource(R.drawable.chat_bubble_myself);
+                msgContentLinear.setBackgroundResource(R.drawable.bg_chat_white);
             }
+        }
+
+        //// 聊天气泡设置
+        if (msg.isSelf()) {
             if (properties.getRightSvgaAvatar() != null){
-                rightSvgaImage.setImageDrawable(properties.getRightSvgaAvatar());
+                SVGADrawable drawable = new SVGADrawable(properties.getRightSvgaAvatar());
+                rightSvgaImage.setVisibility(View.VISIBLE);
+                rightSvgaImage.setImageDrawable(drawable);
                 rightSvgaImage.startAnimation();
             }
+            leftSvgaImage.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);
-            }
             if (properties.getLeftSvgaAvatar() != null){
-                leftSvgaImage.setImageDrawable(properties.getLeftSvgaAvatar());
+                SVGADrawable drawable = new SVGADrawable(properties.getLeftSvgaAvatar());
+                leftSvgaImage.setVisibility(View.VISIBLE);
+                leftSvgaImage.setImageDrawable(drawable);
                 leftSvgaImage.startAnimation();
             }
+            rightSvgaImage.setVisibility(View.INVISIBLE);
         }
 
         //// 聊天气泡的点击事件处理

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

@@ -12,6 +12,7 @@ import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
 import com.opensource.svgaplayer.SVGAImageView;
+import com.swago.baseswago.util.AppContext;
 import com.tencent.imsdk.v2.V2TIMManager;
 import com.tencent.imsdk.v2.V2TIMUserFullInfo;
 import com.tencent.imsdk.v2.V2TIMValueCallback;
@@ -159,7 +160,7 @@ public class ConversationCommonHolder extends ConversationBaseHolder {
         }
 
         if (conversation.getLastMessage() != null && conversation.getLastMessage().getTimMessage() != null) {
-            Glide.with(itemView.getContext()).load(conversation.getConversationFaceUrl())
+            Glide.with(AppContext.getContext()).load(conversation.getConversationFaceUrl())
                     .placeholder(R.mipmap.default_avatar)
                     .error(R.mipmap.default_avatar).into(conversationIconView);
 

+ 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


+ 2 - 2
tuikit/src/main/res/layout/message_adapter_item_content.xml

@@ -53,7 +53,7 @@
             android:id="@+id/svgAvatar_left"
             android:layout_width="41dp"
             android:layout_height="41dp"
-            android:visibility="visible"
+            android:visibility="invisible"
             app:autoPlay="true"
             app:loopCount="0"
             android:layout_alignParentLeft="true"
@@ -73,7 +73,7 @@
             android:id="@+id/svgAvatar_right"
             android:layout_width="41dp"
             android:layout_height="41dp"
-            android:visibility="visible"
+            android:visibility="invisible"
             app:autoPlay="true"
             app:loopCount="0"
             android:layout_alignParentRight="true"

+ 104 - 0
user/src/main/java/com/swago/user/store/BaseStoreDFragment.kt

@@ -0,0 +1,104 @@
+package com.swago.user.store
+
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.DialogFragment
+import androidx.fragment.app.FragmentManager
+import androidx.viewbinding.ViewBinding
+import com.gyf.immersionbar.ImmersionBar
+import com.swago.baseswago.R
+import java.lang.reflect.ParameterizedType
+
+/**
+ *@date 2021/8/27 17:00
+ *description:
+ */
+abstract class BaseStoreDFragment<T : ViewBinding> : DialogFragment() {
+
+    private var _binding: T? = null
+    val binding get() = _binding
+
+    private var mAmount = 0.5f
+    private var gravity = Gravity.CENTER
+    private var canCancel = true
+    private var mHeight = ViewGroup.LayoutParams.WRAP_CONTENT
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setStyle(STYLE_NORMAL, R.style.cusDialogStyle)
+    }
+
+    override fun onStart() {
+        super.onStart()
+        //设置宽度
+        val attrs = dialog?.window?.attributes
+        attrs?.width = ViewGroup.LayoutParams.MATCH_PARENT
+        attrs?.height = mHeight
+        dialog?.window?.attributes = attrs
+        dialog?.window?.setGravity(gravity)
+        dialog?.window?.setDimAmount(mAmount)
+        dialog?.setCanceledOnTouchOutside(canCancel)
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        _binding = getViewBindingForFragment(inflater, container)
+        return binding?.root
+    }
+
+    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+        ImmersionBar.with(this).init()
+        initOther()
+        initLiveData()
+    }
+    abstract fun initOther()
+    abstract fun initLiveData()
+    fun setGravity(gravity: Int){
+        this.gravity = gravity
+    }
+
+    fun setDimAmount(amount: Float) {
+        mAmount = amount
+    }
+
+    fun setCanCancel(canCancel:Boolean){
+        this.canCancel = canCancel
+    }
+
+    fun setHeightMatchParent(){
+        mHeight = ViewGroup.LayoutParams.MATCH_PARENT
+    }
+
+    @Suppress("UNCHECKED_CAST")
+    fun getViewBindingForFragment(layoutInflater: LayoutInflater, container: ViewGroup?): T {
+        val type = javaClass.genericSuperclass as ParameterizedType
+        val aClass = type.actualTypeArguments[0] as Class<*>
+        val method = aClass.getDeclaredMethod("inflate", LayoutInflater::class.java)
+        return method.invoke(null, layoutInflater) as T
+    }
+
+    override fun show(manager: FragmentManager, tag: String?) {
+        try {
+            //在每个add事务前增加一个remove事务,防止连续的add
+            manager.beginTransaction().remove(this).commit()
+            super.show(manager,tag)
+        } catch (e: Exception) {
+            //同一实例使用不同的tag会异常,这里捕获一下
+            e.printStackTrace()
+        }
+    }
+
+
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+        _binding = null
+    }
+}

+ 65 - 28
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -3,15 +3,18 @@ package com.swago.user.store
 import android.os.Bundle
 import android.view.Gravity
 import android.view.View
+import android.view.View.OnClickListener
 import android.widget.Toast
 import androidx.activity.viewModels
 import androidx.fragment.app.viewModels
 import com.opensource.svgaplayer.SVGADrawable
 import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGASoundManager
 import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.LogUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.loadUrl
 import com.swago.user.R
@@ -20,23 +23,26 @@ import com.swago.user.vm.StoreVm
 import java.io.File
 import java.net.URL
 
-class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
+class StoreBuyDialog : BaseStoreDFragment<DialogStoreDetailBinding>() {
     private val storeVm by viewModels<StoreVm>()
 
     private var svgaParser: SVGAParser? = null
-    var storeBean: StoreItemBean ?= null
-    var buySuccessFun:(()->Unit)? = null
+    var storeBean: StoreItemBean? = null
+    var storeType: Int = 0
+    var buySuccessFun: (() -> Unit)? = null
+
     init {
         setGravity(Gravity.BOTTOM)
         setDimAmount(0.5f)
         setCanCancel(true)
     }
 
-    companion object{
-        fun newInstance(bean: StoreItemBean): StoreBuyDialog {
+    companion object {
+        fun newInstance(bean: StoreItemBean, storeType: Int): StoreBuyDialog {
             val dialog = StoreBuyDialog()
             val bundle = Bundle()
-            bundle.putParcelable("data" , bean)
+            bundle.putParcelable("data", bean)
+            bundle.putInt("storeType", storeType)
             dialog.arguments = bundle
             return dialog
         }
@@ -47,40 +53,63 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         svgaParser = SVGAParser(activity)
         arguments?.let {
             storeBean = it.getParcelable("data")
+            storeType = it.getInt("storeType", 0)
         }
         storeBean?.let {
-            binding.tvName.text = it.product_name
-            binding.tvCoin.text = "${it.product_coin}"
-            if (!it.product_svg_url.isNullOrEmpty() && it.product_svg_url?.endsWith(".svga") == true){
-                binding.ivIcon.visibility = View.GONE
-                svgaParser?.decodeFromURL(URL(it.product_svg_url), object : SVGAParser.ParseCompletion{
-                    override fun onComplete(videoItem: SVGAVideoEntity) {
-                        val drawable = SVGADrawable(videoItem)
-                        binding.svgContent.setImageDrawable(drawable)
-                        binding.svgContent.startAnimation()
-                    }
+            binding?.tvName?.text = it.product_name
+            binding?.tvCoin?.text = "${it.product_coin}"
+            if (storeType == 1) {
+                binding?.ivIcon?.visibility = View.GONE
+                binding?.svgContent?.visibility = View.VISIBLE
+                binding?.svgAvatar?.visibility = View.GONE
+                it.product_svg_url?.let { svgUrl ->
+                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion {
+                        override fun onComplete(videoItem: SVGAVideoEntity) {
+                            val drawable = SVGADrawable(videoItem)
+                            binding?.svgContent?.setImageDrawable(drawable)
+                            binding?.svgContent?.startAnimation()
 
-                    override fun onError() {
 
-                    }
-                })
-            } else {
-                binding.ivIcon.visibility = View.VISIBLE
-                it.product_url?.let { imageUrl ->
-                    binding.ivIcon.loadUrl(AppContext.getContext(),imageUrl)
+                        }
+
+                        override fun onError() {
+                        }
+                    })
                 }
-            }
 
+            } else if (storeType == 2) {
+                binding?.ivIcon?.visibility = View.GONE
+                binding?.svgContent?.visibility = View.GONE
+                binding?.svgAvatar?.visibility = View.VISIBLE
+                it.product_svg_url?.let { svgUrl ->
+                    svgaParser?.decodeFromURL(URL(svgUrl), object : SVGAParser.ParseCompletion {
+                        override fun onComplete(videoItem: SVGAVideoEntity) {
+                            val drawable = SVGADrawable(videoItem)
+                            binding?.svgAvatar?.setImageDrawable(drawable)
+                            binding?.svgAvatar?.startAnimation()
+                        }
 
+                        override fun onError() {
+                        }
+                    })
+                }
 
+            } else {
+                binding?.svgContent?.visibility = View.GONE
+                binding?.svgAvatar?.visibility = View.GONE
+                binding?.ivIcon?.visibility = View.VISIBLE
+                it.product_url?.let { imageUrl ->
+                    binding?.ivIcon?.loadUrl(AppContext.getContext(), imageUrl)
+                }
+            }
         }
     }
 
     override fun initLiveData() {
-        binding.tvBuy.setOnClickListener(object: NoDoubleClickListener(){
+        binding?.tvBuy?.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
                 storeBean?.let {
-                    if (it.product_status ==1){
+                    if (it.product_status == 1) {
                         Toast.makeText(
                             AppContext.getContext(),
                             AppContext.getContext().resources.getString(R.string.this_product_has_been_purchased),
@@ -89,11 +118,19 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
                         return@let
                     }
                     storeVm.buyProduct(it.id)
-                    buySuccessFun?.invoke()
-                    dismissAllowingStateLoss()
                 }
 
             }
         })
+        binding?.svgContent?.setOnClickListener {
+            dismissAllowingStateLoss()
+        }
+
+        storeVm.buyProductSuccess.observe(this) {
+            if (it) {
+                buySuccessFun?.invoke()
+            }
+            dismissAllowingStateLoss()
+        }
     }
 }

+ 20 - 1
user/src/main/java/com/swago/user/store/StoreItemAdapter.kt

@@ -17,7 +17,26 @@ class StoreItemAdapter(private val type: Int) : BaseQuickAdapter<StoreItemBean,
             setVisible(R.id.tv_time , type == 2)
 
             item?.let {
-                setVisible(R.id.tvUsing , type ==2 && item.product_status == 1)
+                if(type == 1) {
+                    when(item.product_status){
+                        1 ->{
+                            setVisible(R.id.tvUsing , true)
+                            setText(R.id.tvUsing, R.string.already_owned)
+                        }
+                        2 ->{
+                            setVisible(R.id.tvUsing , true)
+                            setText(R.id.tvUsing, R.string.already_owned)
+                        }
+                        else -> {
+                            setVisible(R.id.tvUsing , false)
+                        }
+
+                    }
+
+                } else if (type == 2){
+                    setText(R.id.tvUsing, R.string.using)
+                    setVisible(R.id.tvUsing , item.product_status == 1)
+                }
                 setText(R.id.tv_name ,item.product_name)
                 if (type == 1){
                     setText(R.id.tv_coin ,"${item.product_coin}")

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

@@ -280,7 +280,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         enterAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(enterAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(enterAdapter.data[position],1).apply {
                     this.buySuccessFun = {
                         enterAdapter.data[position].product_status = 1
                         enterAdapter.notifyItemChanged(position)
@@ -298,7 +298,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         avatarAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(avatarAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(avatarAdapter.data[position],2).apply {
                     this.buySuccessFun = {
                         avatarAdapter.data[position].product_status = 1
                         avatarAdapter.notifyItemChanged(position)
@@ -316,7 +316,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         badgeAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(badgeAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(badgeAdapter.data[position],3).apply {
                     this.buySuccessFun = {
                         badgeAdapter.data[position].product_status = 1
                         badgeAdapter.notifyItemChanged(position)
@@ -334,7 +334,7 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         }
         bubbleAdapter.setOnItemClickListener { _, _, position ->
             if (type == 1){
-                StoreBuyDialog.newInstance(bubbleAdapter.data[position]).apply {
+                StoreBuyDialog.newInstance(bubbleAdapter.data[position],4).apply {
                     this.buySuccessFun = {
                         bubbleAdapter.data[position].product_status = 1
                         bubbleAdapter.notifyItemChanged(position)

+ 8 - 1
user/src/main/java/com/swago/user/vm/StoreVm.kt

@@ -30,17 +30,24 @@ class StoreVm(application: Application) : BaseViewModel(application){
         }
     }
 
+    val buyProductSuccess by lazy {
+        MutableLiveData<Boolean>()
+    }
+
     fun buyProduct(productId:Long){
         requestData2 {
             requestData {
                 ApiManager.userApi.buyProduct(productId)
+                buyProductSuccess.value = true
                 Toast.makeText(
                     AppContext.getContext(),
                     AppContext.getContext().resources.getString(R.string.purchase_successful),
                     Toast.LENGTH_SHORT
                 ).show()
             }
-
+            requestError {
+               buyProductSuccess.value = false
+            }
         }
     }
 

+ 38 - 7
user/src/main/res/layout/dialog_store_detail.xml

@@ -11,9 +11,13 @@
             android:layout_height="0dp"
             app:autoPlay="true"
             app:fillMode="Forward"
-            app:layout_constraintDimensionRatio="h,1:1"
+            android:visibility="gone"
+            tools:visibility="visible"
+            app:layout_constraintDimensionRatio="h,1:1.5"
             app:layout_constraintBottom_toTopOf="@+id/cl_bottom"
-            app:layout_constraintTop_toTopOf="parent"
+            android:layout_marginBottom="-80dp"
+            android:layout_marginStart="-80dp"
+            android:layout_marginEnd="-80dp"
             app:loopCount="0" />
 
         <androidx.constraintlayout.widget.ConstraintLayout
@@ -24,26 +28,53 @@
             android:paddingBottom="24dp"
             app:layout_constraintBottom_toBottomOf="parent">
 
-            <ImageView
-                android:id="@+id/ivIcon"
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:id="@+id/clIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
                 android:layout_marginTop="12dp"
-                app:layout_constraintTop_toTopOf="parent"/>
+                app:layout_constraintTop_toTopOf="parent">
+                <ImageView
+                    android:id="@+id/ivIcon"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:visibility="gone"
+                    tools:visibility="gone"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"/>
+
+                <com.opensource.svgaplayer.SVGAImageView
+                    android:id="@+id/svg_avatar"
+                    android:layout_width="200dp"
+                    android:layout_height="200dp"
+                    app:autoPlay="true"
+                    app:fillMode="Forward"
+                    android:visibility="gone"
+                    tools:visibility="gone"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:loopCount="0" />
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+
 
             <com.swago.baseswago.cusview.MediumTextView
                 android:id="@+id/tv_name"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:maxWidth="120dp"
+                android:maxWidth="280dp"
                 android:textColor="#ffffff"
                 android:textSize="16sp"
                 android:layout_marginTop="@dimen/dp_10"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/ivIcon"
+                app:layout_constraintTop_toBottomOf="@+id/clIcon"
                 tools:text="fgg" />
 
             <com.swago.baseswago.cusview.MediumTextView

+ 3 - 1
user/src/main/res/layout/item_store.xml

@@ -64,12 +64,14 @@
             android:textColor="#A3FFFFFF"/>
         <TextView
             android:id="@+id/tvUsing"
-            android:layout_width="51dp"
+            android:layout_width="wrap_content"
             android:layout_height="18dp"
             android:textSize="@dimen/sp_12"
             android:textColor="@color/_ffffff"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintLeft_toLeftOf="parent"
+            android:paddingStart="2dp"
+            android:paddingEnd="2dp"
             android:text="Using"
             android:gravity="center"
             android:visibility="gone"