31 Commits 8cffdb2b89 ... f88db1a1c0

Tác giả SHA1 Thông báo Ngày
  tongmengxiao f88db1a1c0 fix: 多人入场动画展示 5 tháng trước cách đây
  tongmengxiao 2f2c3ba9af fix: 麦位 5 tháng trước cách đây
  tongmengxiao 40616e2e89 feat: delete push 5 tháng trước cách đây
  tongmengxiao cd32a50ad8 fix: 商城bug 5 tháng trước cách đây
  tongmengxiao 170eddda16 fix: 麦位占位图 5 tháng trước cách đây
  tongmengxiao 9002513611 fix: 内存泄露 person dialog 5 tháng trước cách đây
  tongmengxiao b7023d4cec fix: invisible 5 tháng trước cách đây
  tongmengxiao 00e9fe3cd4 fix: join animal peek 5 tháng trước cách đây
  tongmengxiao 615173c766 feat: person leak 5 tháng trước cách đây
  tongmengxiao 6aee69ca93 fix: message info 5 tháng trước cách đây
  tongmengxiao 34cce02f0b fix: buyProduct success 5 tháng trước cách đây
  tongmengxiao 4df5895987 fix: bug 5 tháng trước cách đây
  tongmengxiao 5bc23b3621 fix: using 6 tháng trước cách đây
  tongmengxiao d606ca8d23 feat: game send 6 tháng trước cách đây
  tongmengxiao 0e494db6a1 fix: chat text 6 tháng trước cách đây
  tongmengxiao a4f9008ada fix: 商品状态 6 tháng trước cách đây
  tongmengxiao 9af186164f fix: bug 6 tháng trước cách đây
  tongmengxiao 6602f16e34 feat:chat 默认背景图 6 tháng trước cách đây
  tongmengxiao 203f94e779 feat: android ios chat 6 tháng trước cách đây
  tongmengxiao fd36dceac8 feat:私聊背景图 6 tháng trước cách đây
  tongmengxiao bed8a4cbab feat: delete toastutils 6 tháng trước cách đây
  tongmengxiao 62b2697e8c feat: 聊天气泡 6 tháng trước cách đây
  tongmengxiao c03be2b9fb feat: home refresh 6 tháng trước cách đây
  tongmengxiao 9a01c6d64d feat: 头像框 6 tháng trước cách đây
  tongmengxiao b74ae9f34c feat: home refresh 6 tháng trước cách đây
  tongmengxiao 2d67f4aea7 feat: 分辨率 6 tháng trước cách đây
  tongmengxiao f5bf0641c6 feat : 头像 6 tháng trước cách đây
  tongmengxiao 419ce5c3dd feat: 头像框 6 tháng trước cách đây
  tongmengxiao b87204c958 feat: 聊天气泡 6 tháng trước cách đây
  tongmengxiao cefc28baa3 feat: glide 6 tháng trước cách đây
  tongmengxiao 2ac0b9dd58 feat: 选中装扮 6 tháng trước cách đây
93 tập tin đã thay đổi với 2074 bổ sung286 xóa
  1. 0 1
      app/src/main/java/com/swago/app/SwagoApp.kt
  2. BIN
      baseswago/src/main/assets/avatar.svga
  3. 44 6
      baseswago/src/main/java/com/swago/baseswago/PersonDataDFragment.kt
  4. 1 1
      baseswago/src/main/java/com/swago/baseswago/agora/AgoraManager.kt
  5. 5 0
      baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt
  6. 2 0
      baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt
  7. 2 3
      baseswago/src/main/java/com/swago/baseswago/dialog/HandleDialogFragment.kt
  8. 2 2
      baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt
  9. 12 0
      baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt
  10. 44 0
      baseswago/src/main/java/com/swago/baseswago/model/MomentModel.java
  11. 45 0
      baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java
  12. 3 0
      baseswago/src/main/java/com/swago/baseswago/model/im/RoomChatMsgBean.java
  13. 5 0
      baseswago/src/main/java/com/swago/baseswago/model/im/UserJoinRoomBean.java
  14. 47 0
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java
  15. 27 1
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomUserModel.java
  16. 5 2
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSeatModel.kt
  17. 2 1
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/AudioSendGiftModel.kt
  18. 1 0
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioModel.kt
  19. 2 1
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/IMAudioSeatUpdateModel.kt
  20. 1 0
      baseswago/src/main/java/com/swago/baseswago/model/live/audio/MaiUserModel.kt
  21. 9 0
      baseswago/src/main/java/com/swago/baseswago/model/live/gift/IMGiftModel.java
  22. 7 1
      baseswago/src/main/java/com/swago/baseswago/model/mine/StoreProductModel.kt
  23. 85 0
      baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt
  24. 50 0
      baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt
  25. 24 0
      baseswago/src/main/java/com/swago/baseswago/util/StringUtils.kt
  26. 10 47
      baseswago/src/main/java/com/swago/glide.kt
  27. 42 14
      baseswago/src/main/res/layout/dialog_person_data.xml
  28. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.png
  29. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_lock.webp
  30. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.png
  31. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_audio_seat.webp
  32. 12 1
      baseswago/src/main/res/values-ar/strings.xml
  33. 11 0
      baseswago/src/main/res/values-in/strings.xml
  34. 11 0
      baseswago/src/main/res/values-ms/strings.xml
  35. 12 1
      baseswago/src/main/res/values-zh/strings.xml
  36. 12 1
      baseswago/src/main/res/values/strings.xml
  37. 50 5
      home/src/main/java/com/swago/home/ChatDetailActivity.kt
  38. 25 5
      home/src/main/java/com/swago/home/MessageFragment.kt
  39. 21 2
      home/src/main/java/com/swago/home/MineFragment.kt
  40. 7 2
      home/src/main/java/com/swago/home/innerhome/FollowFragment.kt
  41. 7 2
      home/src/main/java/com/swago/home/innerhome/HotFragment.kt
  42. 7 2
      home/src/main/java/com/swago/home/innerhome/NewFragment.kt
  43. 14 2
      home/src/main/res/layout/fragment_mine.xml
  44. BIN
      home/src/main/res/mipmap-xxhdpi/icon_my_store.png
  45. 25 0
      room/src/main/java/com/swago/room/adapter/AudienceAdapter.kt
  46. 78 6
      room/src/main/java/com/swago/room/adapter/RoomChatAdapter.kt
  47. 29 1
      room/src/main/java/com/swago/room/adapter/RoomUserAdapter.kt
  48. 55 0
      room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt
  49. 77 32
      room/src/main/java/com/swago/room/base/BaseComFragment.kt
  50. 28 0
      room/src/main/java/com/swago/room/bean/UserRoomModel.kt
  51. 0 1
      room/src/main/java/com/swago/room/dialog/AudienceListDialog.kt
  52. 29 10
      room/src/main/java/com/swago/room/dialog/MessageListDialog.kt
  53. 18 3
      room/src/main/java/com/swago/room/dialog/SendMsgDialog.kt
  54. 14 10
      room/src/main/java/com/swago/room/game/GamePlayDialog.kt
  55. 9 0
      room/src/main/java/com/swago/room/gift/GiftDialog.kt
  56. 25 0
      room/src/main/java/com/swago/room/gift/audio/MaiUserAdapter.kt
  57. 57 0
      room/src/main/java/com/swago/room/gift/control/XSvgPlayer.kt
  58. 16 0
      room/src/main/java/com/swago/room/giftdandao/GiftDanDaoView.kt
  59. 6 0
      room/src/main/java/com/swago/room/hongbao/RedEnvelopResultDialog.kt
  60. 82 0
      room/src/main/java/com/swago/room/manager/JoinAnimalManager.kt
  61. 49 0
      room/src/main/java/com/swago/room/manager/JoinRoomManager.kt
  62. 13 2
      room/src/main/java/com/swago/room/vm/MsgVm.kt
  63. 3 0
      room/src/main/java/com/swago/room/vm/RoomVm.kt
  64. 21 0
      room/src/main/java/com/swago/room/widget/ComHeaderView.kt
  65. 6 0
      room/src/main/java/com/swago/room/widget/UserShowAnchorCloseView.kt
  66. 1 0
      room/src/main/res/layout/activity_anchor_room.xml
  67. 30 8
      room/src/main/res/layout/item_audio_seat.xml
  68. 33 9
      room/src/main/res/layout/item_dialog_audience.xml
  69. 11 1
      room/src/main/res/layout/item_mai_user.xml
  70. 18 2
      room/src/main/res/layout/item_room_user.xml
  71. 30 8
      room/src/main/res/layout/layout_user_header_view.xml
  72. 31 10
      room/src/main/res/layout/view_item_gift.xml
  73. 11 1
      room/src/main/res/layout/view_user_join_room.xml
  74. 17 0
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/base/ChatManagerKit.java
  75. 30 0
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/interfaces/IMessageProperties.java
  76. 42 0
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/MessageLayoutUI.java
  77. 52 9
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/message/holder/MessageContentHolder.java
  78. 5 1
      tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/conversation/holder/ConversationCommonHolder.java
  79. BIN
      tuikit/src/main/res/drawable-xxhdpi/bg_chat_purple.9.png
  80. BIN
      tuikit/src/main/res/drawable-xxhdpi/bg_chat_white.9.png
  81. 21 1
      tuikit/src/main/res/layout/conversation_adapter.xml
  82. 19 0
      tuikit/src/main/res/layout/forward_message_adapter_item_content.xml
  83. 3 3
      tuikit/src/main/res/layout/message_adapter_content_text.xml
  84. 26 5
      tuikit/src/main/res/layout/message_adapter_item_content.xml
  85. BIN
      user/src/main/assets/jojo_audio.svga
  86. 104 0
      user/src/main/java/com/swago/user/store/BaseStoreDFragment.kt
  87. 75 28
      user/src/main/java/com/swago/user/store/StoreBuyDialog.kt
  88. 26 2
      user/src/main/java/com/swago/user/store/StoreItemAdapter.kt
  89. 87 13
      user/src/main/java/com/swago/user/store/StoreListActivity.kt
  90. 26 2
      user/src/main/java/com/swago/user/vm/StoreVm.kt
  91. 8 8
      user/src/main/res/layout/activity_store_list.xml
  92. 46 6
      user/src/main/res/layout/dialog_store_detail.xml
  93. 16 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缓存

BIN
baseswago/src/main/assets/avatar.svga


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

@@ -9,6 +9,9 @@ import android.widget.Toast
 import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.launcher.ARouter
 import com.bumptech.glide.Glide
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.permissionx.guolindev.PermissionX
 import com.swago.baseswago.baseroom.SwagoRoomManager
 import com.swago.baseswago.constant.ARouteConstant
@@ -17,9 +20,13 @@ import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.dialog.HandleDialogFragment
 import com.swago.baseswago.dialog.ReportDialog
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.BitmapUtils
 import com.swago.baseswago.util.IMUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.UserInfo
+import com.swago.loadUrl
+import com.swago.loadUrlNoPlaceHolder
+import java.net.URL
 
 /**
  *@date 2021/8/27 17:14
@@ -36,6 +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
@@ -44,6 +52,9 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
     var openGiftDialog:((nickName:String,userId:String)->Unit)? = null
     var openGiftIconDialog:((nickName:String,userId:String,nickIcon:String)->Unit)? = null
     var sendMsgInRoom:((nickName:String)->Unit)? = null
+    val svgaParser by lazy {
+        SVGAParser(activity)
+    }
 
     companion object{
         fun newInstance(uid:String,isAnchor:Boolean=false,inRoom:Boolean=false,roomId:String="",isMessage:Boolean=false): PersonDataDFragment {
@@ -117,7 +128,8 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
                                 if (allGranted) {
                                     ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
                                         .withString("account",account)
-                                        .withString("chatName",binding.tvName.text.toString()).navigation()
+                                        .withString("chatName",binding.tvName.text.toString())
+                                        .withString("headSpecial" , headSpecial).navigation()
                                     dismissAllowingStateLoss()
                                 } else {
                                     Toast.makeText(
@@ -147,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")
                 }
             })
 
@@ -165,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)
@@ -235,9 +250,32 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
             }
 
             isAdmin = it.is_room_admin == 1
-        }
 
+            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)
+                        binding.svgAvatar.setImageDrawable(drawable)
+                        binding.svgAvatar.startAnimation()
+                    }
 
+                    override fun onError() {
+                    }
+                })
+            }
+            if (TextUtils.isEmpty(it.android_badge_special)){
+                binding.ivBadge.visibility = View.GONE
+            } else {
+                activity?.let { activity ->
+                    Glide.with(activity)
+                        .load(it.android_badge_special)
+                        .override(200)
+                        .into(binding.ivBadge)
+                    binding.ivBadge.visibility = View.VISIBLE
+                }
+
+            }
+        }
         userVm.followStateLiveData.observe(this) {
             if (isFollow == 0) {
                 isFollow = 1

+ 1 - 1
baseswago/src/main/java/com/swago/baseswago/agora/AgoraManager.kt

@@ -245,7 +245,7 @@ object AgoraManager {
 
 
     fun setVideoConfiguration(
-        vd: VideoEncoderConfiguration.VideoDimensions = VideoEncoderConfiguration.VD_480x360,
+        vd: VideoEncoderConfiguration.VideoDimensions = VideoEncoderConfiguration.VD_640x480,
         fps: VideoEncoderConfiguration.FRAME_RATE = VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15
     ) {
         mRtcEngine?.setVideoEncoderConfiguration(

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

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

+ 2 - 0
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -91,4 +91,6 @@ object UrlConstant {
     var lottieResourcePath =
         AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "lottie"
     var lottieDownloadUrl = ""
+    var specialResourcePath =
+        AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "swagoFile"
 }

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

+ 12 - 0
baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt

@@ -131,12 +131,24 @@ interface UserApi {
     @POST("/v1/user/coin/product/list")
     suspend fun getProductList(): StoreProductModel
 
+    /**
+     * 购买
+     * */
     @FormUrlEncoded
     @POST("/v1/user/buy/product")
     suspend fun buyProduct(@Field("product_id") product_id: Long):Any
 
+    /**
+     * 装扮列表
+     * */
     @POST("/v1/user/exist/product/list")
     suspend fun exitProductList():StoreProductModel
 
+    /**
+     * 选中装扮
+     * */
+    @FormUrlEncoded
+    @POST("/v1/user/exist/product/chose")
+    suspend fun choseProduct(@Field("product_id") product_id: Long):Any
 
 }

+ 44 - 0
baseswago/src/main/java/com/swago/baseswago/model/MomentModel.java

@@ -33,6 +33,10 @@ public class MomentModel implements Parcelable {
     private int is_cup;
     private int user_broadcast_type; //直播间类型(1视频2语音)
     private int broadcast_password_status;//是否密码房(1是0否)
+    private String head_special;
+    private String badge_special;
+    private String join_special;
+    private String chat_special;
 
     public MomentModel(){
 
@@ -55,6 +59,10 @@ public class MomentModel implements Parcelable {
         is_cup = in.readInt();
         user_broadcast_type = in.readInt();
         broadcast_password_status = in.readInt();
+        head_special = in.readString();
+        badge_special = in.readString();
+        join_special = in.readString();
+        chat_special = in.readString();
     }
 
     @Override
@@ -75,6 +83,10 @@ public class MomentModel implements Parcelable {
         dest.writeInt(is_cup);
         dest.writeInt(user_broadcast_type);
         dest.writeInt(broadcast_password_status);
+        dest.writeString(head_special);
+        dest.writeString(badge_special);
+        dest.writeString(join_special);
+        dest.writeString(chat_special);
     }
 
     @Override
@@ -237,4 +249,36 @@ public class MomentModel implements Parcelable {
     public void setBroadcast_password_status(int broadcast_password_status) {
         this.broadcast_password_status = broadcast_password_status;
     }
+
+    public String getHead_special() {
+        return head_special;
+    }
+
+    public void setHead_special(String head_special) {
+        this.head_special = head_special;
+    }
+
+    public String getBadge_special() {
+        return badge_special;
+    }
+
+    public void setBadge_special(String badge_special) {
+        this.badge_special = badge_special;
+    }
+
+    public String getJoin_special() {
+        return join_special;
+    }
+
+    public void setJoin_special(String join_special) {
+        this.join_special = join_special;
+    }
+
+    public String getChat_special() {
+        return chat_special;
+    }
+
+    public void setChat_special(String chat_special) {
+        this.chat_special = chat_special;
+    }
 }

+ 45 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -98,6 +98,11 @@ public class UserInfoModel {
      * 是否充值用户
      */
     private int is_recharge;
+    private String android_join_special;
+    private String android_head_special;
+    private String android_badge_special;
+    private String android_chat_special;
+    private String ios_chat_special;
 
     public String getUser_constellation() {
         return user_constellation;
@@ -394,4 +399,44 @@ public class UserInfoModel {
     public void setIs_recharge(int is_recharge) {
         this.is_recharge = is_recharge;
     }
+
+    public String getAndroid_join_special() {
+        return android_join_special;
+    }
+
+    public void setAndroid_join_special(String android_join_special) {
+        this.android_join_special = android_join_special;
+    }
+
+    public String getAndroid_head_special() {
+        return android_head_special;
+    }
+
+    public void setAndroid_head_special(String android_head_special) {
+        this.android_head_special = android_head_special;
+    }
+
+    public String getAndroid_badge_special() {
+        return android_badge_special;
+    }
+
+    public void setAndroid_badge_special(String android_badge_special) {
+        this.android_badge_special = android_badge_special;
+    }
+
+    public String getAndroid_chat_special() {
+        return android_chat_special;
+    }
+
+    public void setAndroid_chat_special(String android_chat_special) {
+        this.android_chat_special = android_chat_special;
+    }
+
+    public String getIos_chat_special() {
+        return ios_chat_special;
+    }
+
+    public void setIos_chat_special(String ios_chat_special) {
+        this.ios_chat_special = ios_chat_special;
+    }
 }

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

@@ -15,6 +15,9 @@ public class RoomChatMsgBean implements IRoomChat {
     public String sendName="";
     public String content="";
     public String roomId="";
+    public String ios_chat_special="";
+    public String android_chat_special="";
+    public String badge_special="";
     public int senderLevel;
     public int isBenefit;
     public int isPrettyAccount;

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

@@ -29,6 +29,11 @@ public class UserJoinRoomBean implements IRoomChat {
     public int isCrown;
     public int isCup;
     public int isFans;
+    public String androidJoinSpecial="";
+    public String androidHeadSpecial="";
+    public String androidBadgeSpecial="";
+    public String androidChatSpecial="";
+    public String iosChatSpecial="";
 
     @NonNull
     @Override

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

@@ -55,6 +55,13 @@ public class RoomModel {
 
     private String broadcast_bg_url;
 
+    private String join_special;
+    private String head_special;
+    private String badge_special;
+    private String chat_special;
+
+    private String broadcast_head_special;
+
     private CusNewMsgBean<RoomUserChangeModel> join_im_data;
 
     public String getRtc_token() {
@@ -280,4 +287,44 @@ public class RoomModel {
     public void setJoin_im_data(CusNewMsgBean<RoomUserChangeModel> join_im_data) {
         this.join_im_data = join_im_data;
     }
+
+    public String getJoin_special() {
+        return join_special;
+    }
+
+    public void setJoin_special(String join_special) {
+        this.join_special = join_special;
+    }
+
+    public String getHead_special() {
+        return head_special;
+    }
+
+    public void setHead_special(String head_special) {
+        this.head_special = head_special;
+    }
+
+    public String getBadge_special() {
+        return badge_special;
+    }
+
+    public void setBadge_special(String badge_special) {
+        this.badge_special = badge_special;
+    }
+
+    public String getChat_special() {
+        return chat_special;
+    }
+
+    public void setChat_special(String chat_special) {
+        this.chat_special = chat_special;
+    }
+
+    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;
+    }
 }

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

@@ -54,8 +54,10 @@ public class RoomUserModel {
         private int is_official;
         private int is_crown;
         private int is_cup;
-
         private String contribute_val;
+        private String android_head_special;
+        private String head_special;
+        private String ios_head_special;
 
         public String getUser_id() {
             return user_id;
@@ -169,5 +171,29 @@ public class RoomUserModel {
         public void setContribute_val(String contribute_val) {
             this.contribute_val = contribute_val;
         }
+
+        public String getAndroid_head_special() {
+            return android_head_special;
+        }
+
+        public void setAndroid_head_special(String android_head_special) {
+            this.android_head_special = android_head_special;
+        }
+
+        public String getIos_head_special() {
+            return ios_head_special;
+        }
+
+        public void setIos_head_special(String ios_head_special) {
+            this.ios_head_special = ios_head_special;
+        }
+
+        public String getHead_special() {
+            return head_special;
+        }
+
+        public void setHead_special(String head_special) {
+            this.head_special = head_special;
+        }
     }
 }

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

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

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

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

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

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

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

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

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

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

+ 7 - 1
baseswago/src/main/java/com/swago/baseswago/model/mine/StoreProductModel.kt

@@ -10,25 +10,31 @@ data class StoreProductModel(
 data class StoreItemBean (
     val product_name: String?,
     val product_url: String?,
+    val product_svg_url: String?,
     val product_category: Int,
     val product_coin: Long,
+    val expire_at: Long,
     val id: Long,
-    val product_status: Int
+    var product_status: Int
 ) :Parcelable{
     constructor(parcel: Parcel) : this(
+        parcel.readString(),
         parcel.readString(),
         parcel.readString(),
         parcel.readInt(),
         parcel.readLong(),
         parcel.readLong(),
+        parcel.readLong(),
         parcel.readInt()
     )
 
     override fun writeToParcel(parcel: Parcel, flags: Int) {
         parcel.writeString(product_name)
         parcel.writeString(product_url)
+        parcel.writeString(product_svg_url)
         parcel.writeInt(product_category)
         parcel.writeLong(product_coin)
+        parcel.writeLong(expire_at)
         parcel.writeLong(id)
         parcel.writeInt(product_status)
     }

+ 85 - 0
baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt

@@ -0,0 +1,85 @@
+package com.swago.baseswago.util
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.graphics.drawable.Drawable
+import android.text.TextUtils
+import com.bumptech.glide.Glide
+import com.bumptech.glide.load.DataSource
+import com.bumptech.glide.load.engine.GlideException
+import com.bumptech.glide.request.RequestListener
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.target.Target
+import com.bumptech.glide.request.transition.Transition
+import com.swago.baseswago.constant.UrlConstant
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+
+object BitmapUtils {
+    fun loadFile(context: Context, url:String?, response: ((resource: Bitmap?) -> Unit)?=null){
+        if (TextUtils.isEmpty(url)){
+            response?.invoke(null)
+            return
+        }
+        val arrayData = url?.split("/")
+        val stringBuffer = StringBuffer()
+        arrayData?.forEach {
+            stringBuffer.append(it)
+        }
+        val path = "${UrlConstant.specialResourcePath}/${stringBuffer}"
+        val pathFile =
+            File(path)
+        if (pathFile.exists()){
+
+            response?.invoke(BitmapFactory.decodeFile(path).apply { density = 480 })
+            return
+        }
+        Glide.with(context)
+            .asBitmap()
+            .load(url)
+            .listener(object : RequestListener<Bitmap>{
+                override fun onLoadFailed(
+                    p0: GlideException?,
+                    p1: Any?,
+                    p2: Target<Bitmap>?,
+                    p3: Boolean
+                ): Boolean {
+                    response?.invoke(null)
+                    return false
+                }
+
+                override fun onResourceReady(
+                    bitmap: Bitmap?,
+                    p1: Any?,
+                    p2: Target<Bitmap>?,
+                    p3: DataSource?,
+                    p4: Boolean
+                ): Boolean {
+                    return false
+                }
+            } )
+            .into(object : CustomTarget<Bitmap>() {
+                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
+                    resource.density = 480
+                    var outputStream: FileOutputStream? = null
+                    try {
+                        outputStream = FileOutputStream(pathFile)
+                        resource.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
+                        outputStream.flush()
+                    } catch (e: IOException) {
+                        e.printStackTrace()
+                    } finally {
+                        outputStream?.close()
+                    }
+                    response?.invoke(resource.apply { density = 480 })
+                }
+
+                override fun onLoadCleared(placeholder: Drawable?) {
+
+                }
+            })
+    }
+}

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

@@ -0,0 +1,50 @@
+package com.swago.baseswago.util
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.graphics.NinePatch
+import android.graphics.drawable.Drawable
+import android.graphics.drawable.NinePatchDrawable
+import android.text.TextUtils
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.CustomTarget
+import com.bumptech.glide.request.transition.Transition
+import java.io.File
+import java.io.FileInputStream
+
+object DianJiuUtil {
+    fun loadDian9Tu(context: Context, url: String, drawable: (e: NinePatchDrawable?) -> Unit){
+        if (context is Activity){
+            if (context.isDestroyed)
+                return
+        }
+        if (TextUtils.isEmpty(url)){
+            drawable.invoke(null)
+            return
+        }
+        Glide.with(context)
+            .asFile()
+            .load(url)
+            .into(object : CustomTarget<File>() {
+                override fun onResourceReady(resource: File, transition: Transition<in File>?) {
+                    val fileInputStream = FileInputStream(resource)
+                    ninePatchImageDrawable(context , BitmapFactory.decodeStream(fileInputStream) , drawable)
+                }
+
+                override fun onLoadCleared(placeholder: Drawable?) {
+
+                }
+            })
+    }
+
+    fun ninePatchImageDrawable(context: Context, bitmap: Bitmap, drawable: (e: NinePatchDrawable?) -> Unit) {
+        bitmap.density = 480
+        val chunk = bitmap.ninePatchChunk
+        if (NinePatch.isNinePatchChunk(chunk)){
+            drawable.invoke(NinePatchDrawable(context.resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null))
+        }
+        drawable.invoke(null)
+    }
+}

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

+ 10 - 47
baseswago/src/main/java/com/swago/glide.kt

@@ -1,12 +1,6 @@
 package com.swago
 
-import android.app.Activity
 import android.content.Context
-import android.graphics.Bitmap
-import android.graphics.BitmapFactory
-import android.graphics.NinePatch
-import android.graphics.drawable.Drawable
-import android.graphics.drawable.NinePatchDrawable
 import android.os.Build
 import android.text.BidiFormatter
 import android.text.TextDirectionHeuristics
@@ -14,15 +8,10 @@ import android.widget.ImageView
 import androidx.annotation.DrawableRes
 import androidx.annotation.RequiresApi
 import com.bumptech.glide.Glide
+import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
-import com.bumptech.glide.request.target.CustomTarget
-import com.bumptech.glide.request.transition.Transition
 import com.swago.baseswago.R
 import jp.wasabeef.glide.transformations.BlurTransformation
-import java.io.File
-import java.io.FileInputStream
-import java.io.FileNotFoundException
-import java.io.IOException
 import java.util.*
 
 /**
@@ -47,6 +36,15 @@ fun ImageView.loadUrl(context: Context,url:String){
         .into(this)
 }
 
+fun ImageView.loadUrlCache(context: Context,url:String){
+    Glide.with(context)
+        .load(url)
+        .centerCrop()
+        .diskCacheStrategy(DiskCacheStrategy.ALL)
+        .placeholder(R.mipmap.default_avatar)
+        .error(R.mipmap.default_avatar)
+        .into(this)
+}
 fun ImageView.loadUrlNoPlaceHolder(context: Context,url:String){
     Glide.with(context)
         .load(url)
@@ -84,39 +82,4 @@ fun CharSequence.formatAr(): CharSequence {
         this,
         TextDirectionHeuristics.LOCALE
     )
-}
-
-fun loadDian9Tu(context: Context, imageView: ImageView, url: String){
-    if (context is Activity){
-        if (context.isDestroyed)
-            return
-    }
-    Glide.with(context)
-        .asFile()
-        .load(url)
-        .into(object : CustomTarget<File>() {
-            override fun onResourceReady(resource: File, transition: Transition<in File>?) {
-                try {
-                    FileInputStream(resource).use { inputStream ->
-                        val bitmap = BitmapFactory.decodeStream(inputStream)
-                        imageView.setNinePatchImage(context , bitmap)
-                    }
-                } catch (e: FileNotFoundException) {
-                    e.printStackTrace()
-                } catch (e: IOException) {
-                    e.printStackTrace()
-                }
-            }
-
-            override fun onLoadCleared(placeholder: Drawable?) {
-
-            }
-        })
-}
-
-fun ImageView.setNinePatchImage(context: Context, bitmap: Bitmap) {
-    val chunk = bitmap.ninePatchChunk
-    val ninePatch = NinePatch(bitmap, chunk, null)
-    val ninePatchDrawable = NinePatchDrawable(context.resources, ninePatch)
-    this.setImageDrawable(ninePatchDrawable)
 }

+ 42 - 14
baseswago/src/main/res/layout/dialog_person_data.xml

@@ -176,11 +176,22 @@
                 app:layout_constraintBottom_toBottomOf="@+id/tvLevelView"
                 app:layout_constraintTop_toTopOf="@+id/tvLevelView"
                 app:layout_constraintStart_toEndOf="@+id/tvAgent"
-               app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/ivBadge"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"/>
 
-
+            <ImageView
+                android:id="@+id/ivBadge"
+                android:textColor="#fff"
+                android:layout_marginStart="5dp"
+                android:visibility="gone"
+                tools:visibility="visible"
+                app:layout_constraintBottom_toBottomOf="@+id/tvLevelView"
+                app:layout_constraintTop_toTopOf="@+id/tvLevelView"
+                app:layout_constraintStart_toEndOf="@+id/tvOfficial"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
             <LinearLayout
                 android:id="@+id/llFollow"
                 android:layout_width="wrap_content"
@@ -329,15 +340,35 @@
 
         </androidx.constraintlayout.widget.ConstraintLayout>
 
-
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clAvatar"
             android:layout_width="80dp"
             android:layout_height="80dp"
-            android:src="@mipmap/default_avatar"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toTopOf="parent" >
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:src="@mipmap/default_avatar"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"/>
+
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="80dp"
+                android:layout_height="80dp"
+                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>
 
         <ImageView
             android:id="@+id/ivSex"
@@ -346,8 +377,8 @@
             android:layout_marginStart="10dp"
             android:layout_marginTop="5dp"
             tools:src="@mipmap/info_female"
-            app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
-            app:layout_constraintEnd_toEndOf="@+id/ivAvatar" />
+            app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+            app:layout_constraintEnd_toEndOf="@+id/clAvatar" />
 
 
         <ImageView
@@ -356,13 +387,10 @@
             android:layout_height="wrap_content"
             android:src="@mipmap/onlive"
             android:visibility="gone"
-            app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
-            app:layout_constraintStart_toStartOf="@+id/ivAvatar"
+            app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
+            app:layout_constraintStart_toStartOf="@+id/clAvatar"
             tools:visibility="visible" />
 
-
-
-
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

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


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

@@ -310,7 +310,18 @@
     <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>
+    <string name="avatar_frame">إطار الصورة الرمزية</string>
+    <string name="badge">شارة</string>
+    <string name="chat_bubble">فقاعة الدردشة</string>
+    <string name="more">أكثر</string>
+    <string name="take_back">استرجع</string>
+    <string name="this_product_has_been_purchased">لقد تم شراء هذا المنتج</string>
+    <string name="purchase_successful">تم الشراء بنجاح</string>
+    <string name="no_time_limit">لا يوجد حد زمني</string>
+    <string name="already_owned">مملوكة</string>
+    <string name="using">استخدام</string>
 </resources>

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

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

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

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

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

@@ -310,7 +310,18 @@
     <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>
+    <string name="avatar_frame">头像框</string>
+    <string name="badge">徽章</string>
+    <string name="chat_bubble">聊天气泡</string>
+    <string name="more">更多</string>
+    <string name="take_back">收回</string>
+    <string name="this_product_has_been_purchased">该商品已经购买</string>
+    <string name="purchase_successful">购买成功</string>
+    <string name="no_time_limit">不限时间</string>
+    <string name="already_owned">已拥有</string>
+    <string name="using">使用中</string>
 </resources>

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

@@ -332,7 +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="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>

+ 50 - 5
home/src/main/java/com/swago/home/ChatDetailActivity.kt

@@ -1,20 +1,24 @@
 package com.swago.home
 
 import android.os.Bundle
+import android.text.TextUtils
 import android.view.View
 import androidx.activity.viewModels
 import androidx.core.content.ContextCompat
-import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.alibaba.android.arouter.launcher.ARouter
 import com.google.gson.Gson
 import com.gyf.immersionbar.ImmersionBar
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.UserVm
-import com.swago.baseswago.dialog.ReportBlockDialogFragment
 import com.swago.baseswago.activity.BaseXActivity
 import com.swago.baseswago.constant.ARouteConstant
+import com.swago.baseswago.dialog.ReportBlockDialogFragment
+import com.swago.baseswago.util.DianJiuUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.SpUtil
 import com.swago.baseswago.util.UserInfo
@@ -24,6 +28,8 @@ import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo
 import com.tencent.qcloud.tim.uikit.modules.chat.layout.message.MessageLayout
 import com.tencent.qcloud.tim.uikit.modules.message.MessageInfo
 import com.tencent.qcloud.tim.uikit.utils.ToastUtil
+import java.net.URL
+
 
 /**
  *@date 2021/8/24 15:01
@@ -41,6 +47,13 @@ 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)
@@ -52,12 +65,12 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
     }
 
     override fun loadData() {
-
     }
 
     override fun initOther() {
         ARouter.getInstance().inject(this)
 
+        svgaParser = SVGAParser(this)
         val chatInfo = ChatInfo()
         chatInfo.type = V2TIMConversation.V2TIM_C2C
         chatInfo.chatName = chatName
@@ -81,8 +94,8 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
             SpUtil.putString("user_info", Gson().toJson(it))
         }
 
-        val messageRecyclerView = binding.chatLayout.messageLayout
-        messageRecyclerView.setOnItemClickListener(object : MessageLayout.OnItemLongClickListener{
+        messageRecyclerView = binding.chatLayout.messageLayout
+        messageRecyclerView?.setOnItemClickListener(object : MessageLayout.OnItemLongClickListener{
             override fun onMessageLongClick(view: View?, position: Int, messageInfo: MessageInfo?) {
 
             }
@@ -111,6 +124,32 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
 
             }
         })
+
+        if (!TextUtils.isEmpty(headSpecial)){
+            svgaParser?.decodeFromURL(URL(headSpecial), object :SVGAParser.ParseCompletion{
+                override fun onComplete(videoItem: SVGAVideoEntity) {
+                    messageRecyclerView?.leftSvgaAvatar = videoItem
+                }
+
+                override fun onError() {
+
+                }
+            })
+
+        }
+
+        if (UserInfo.getUserInfo() != null && !TextUtils.isEmpty(UserInfo.getUserInfo()?.android_head_special)){
+            UserInfo.getUserInfo()?.android_head_special?.let {
+                svgaParser?.decodeFromURL(URL(it), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        messageRecyclerView?.rightSvgaAvatar = videoItem
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            }
+        }
     }
 
     override fun initLiveData() {
@@ -122,5 +161,11 @@ class ChatDetailActivity  : BaseXActivity<ActivityChatDetailBinding>() {
         userVm.getUserInfo()
     }
 
+    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
     }
 }

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

@@ -5,6 +5,9 @@ import androidx.fragment.app.viewModels
 import com.alibaba.android.arouter.launcher.ARouter
 import com.bumptech.glide.Glide
 import com.google.gson.Gson
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.PayVm
 import com.swago.baseswago.R
 import com.swago.baseswago.UserVm
@@ -15,6 +18,7 @@ import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.model.ConfigModel
 import com.swago.baseswago.util.*
 import com.swago.home.databinding.FragmentMineBinding
+import java.net.URL
 
 /**
  *@date 2021/11/20 10:32
@@ -24,10 +28,12 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
 
     private val userVm by viewModels<UserVm>()
     private val payVm by viewModels<PayVm>()
-
-    override fun loadData() {}
+    private var svgaParser:SVGAParser? = null
+    override fun loadData() {
+    }
 
     override fun initOther() {
+        svgaParser = SVGAParser(activity)
         if (SwagoInfo.isGooglePackage()){
             binding.tvXWithdrawal.visibility = View.GONE
         }else{
@@ -210,6 +216,19 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
             }else{
                 binding.tvModifyPassword.visibility = View.GONE
             }
+
+            if (!it.android_head_special.isNullOrEmpty()){
+                svgaParser?.decodeFromURL(URL(it.android_head_special), object :SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        binding.svgAvatar.setImageDrawable(drawable)
+                        binding.svgAvatar.startAnimation()
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            }
         }
 
         payVm.benefitLiveData.observe(this){

+ 7 - 2
home/src/main/java/com/swago/home/innerhome/FollowFragment.kt

@@ -14,6 +14,7 @@ import com.swago.baseswago.fragment.BaseListFragment
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.model.MomentModel
 import com.swago.baseswago.model.home.HomeModel
+import com.swago.baseswago.util.SpUtil
 import com.swago.home.databinding.FragmentFollowBinding
 import com.swago.home.databinding.FragmentHotBinding
 
@@ -39,6 +40,7 @@ class FollowFragment : BaseListFragment<FragmentHotBinding, MomentModel>(){
     }
 
     override fun initViewData() {
+        SpUtil.putString("followCloseRoomed" , "0")
         binding.rvLabel.visibility = View.GONE
         smartRecyclerView.recyclerView?.addItemDecoration(ComGridItemDecoration())
         adapter.setOnItemClickListener { _, _, position ->
@@ -75,8 +77,11 @@ class FollowFragment : BaseListFragment<FragmentHotBinding, MomentModel>(){
 
     override fun onResume() {
         super.onResume()
-        if (!isFirstLoadData){
-            smartRecyclerView.startRefresh()
+        val followCloseRoomed = SpUtil.readString("followCloseRoomed")
+        if (followCloseRoomed != "0"){
+            adapter.data.removeAll { it.id == followCloseRoomed }
+            adapter.notifyDataSetChanged()
+            SpUtil.putString("followCloseRoomed" , "0")
         }
         isFirstLoadData = false
     }

+ 7 - 2
home/src/main/java/com/swago/home/innerhome/HotFragment.kt

@@ -13,6 +13,7 @@ import com.swago.baseswago.cusview.SwagoRecyclerView
 import com.swago.baseswago.fragment.BaseListFragment
 import com.swago.baseswago.model.MomentModel
 import com.swago.baseswago.model.home.BannerModel
+import com.swago.baseswago.util.SpUtil
 import com.swago.baseswago.util.SwagoInfo
 import com.swago.home.databinding.FragmentHotBinding
 import com.swago.home.databinding.LayoutViewHeaderBinding
@@ -60,6 +61,7 @@ class HotFragment : BaseListFragment<FragmentHotBinding, MomentModel>() {
 
 
     override fun initViewData() {
+        SpUtil.putString("hotCloseRoomed" , "0")
         UrlConstant.getConfigModel()?.let {
             if (!it.language_lables.isNullOrEmpty()){
                 matchLanguageId = when(SwagoInfo.languageId){
@@ -159,8 +161,11 @@ class HotFragment : BaseListFragment<FragmentHotBinding, MomentModel>() {
 
     override fun onResume() {
         super.onResume()
-        if (!isFirstLoadData){
-            smartRecyclerView.startRefresh()
+        val hotCloseRoomed = SpUtil.readString("hotCloseRoomed")
+        if (hotCloseRoomed != "0"){
+            adapter.data.removeAll { it.id == hotCloseRoomed }
+            adapter.notifyDataSetChanged()
+            SpUtil.putString("hotCloseRoomed" , "0")
         }
         isFirstLoadData = false
     }

+ 7 - 2
home/src/main/java/com/swago/home/innerhome/NewFragment.kt

@@ -13,6 +13,7 @@ import com.swago.baseswago.fragment.BaseListFragment
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.model.MomentModel
 import com.swago.baseswago.model.home.HomeModel
+import com.swago.baseswago.util.SpUtil
 import com.swago.baseswago.util.SwagoInfo
 import com.swago.home.databinding.FragmentHotBinding
 import com.swago.home.databinding.FragmentNewBinding
@@ -48,6 +49,7 @@ class NewFragment  : BaseListFragment<FragmentHotBinding, MomentModel>(){
     }
 
     override fun initViewData() {
+        SpUtil.putString("newCloseRoomed" , "0")
         UrlConstant.getConfigModel()?.let {
             if (!it.language_lables.isNullOrEmpty()){
                 matchLanguageId = when(SwagoInfo.languageId){
@@ -117,8 +119,11 @@ class NewFragment  : BaseListFragment<FragmentHotBinding, MomentModel>(){
 
     override fun onResume() {
         super.onResume()
-        if (!isFirstLoadData){
-            smartRecyclerView.startRefresh()
+        val newCloseRoomed = SpUtil.readString("newCloseRoomed")
+        if (newCloseRoomed != "0"){
+            adapter.data.removeAll { it.id == newCloseRoomed }
+            adapter.notifyDataSetChanged()
+            SpUtil.putString("newCloseRoomed" , "0")
         }
         isFirstLoadData = false
     }

+ 14 - 2
home/src/main/res/layout/fragment_mine.xml

@@ -48,6 +48,18 @@
         app:layout_constraintStart_toStartOf="parent"
         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"
         android:layout_width="wrap_content"
@@ -342,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"
@@ -357,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


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

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

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

@@ -2,6 +2,7 @@ package com.swago.room.adapter
 
 import android.graphics.Bitmap
 import android.graphics.Color
+import android.graphics.drawable.NinePatchDrawable
 import android.os.Build
 import android.text.*
 import android.text.method.LinkMovementMethod
@@ -11,12 +12,12 @@ import android.text.style.ImageSpan
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.widget.ImageView
 import android.widget.TextView
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.core.content.ContextCompat
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
-import com.swago.baseswago.baseroom.SwagoRoomManager
 import com.swago.baseswago.cusview.LiangView
 import com.swago.baseswago.cusview.SwagoLevelView
 import com.swago.baseswago.im.IRoomChat
@@ -25,6 +26,9 @@ import com.swago.baseswago.model.im.FollowSuccessMsgBean
 import com.swago.baseswago.model.im.IMLevelUpMsgBean
 import com.swago.baseswago.model.im.RoomChatMsgBean
 import com.swago.baseswago.model.im.UserJoinRoomBean
+import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.BitmapUtils
+import com.swago.baseswago.util.DianJiuUtil
 import com.swago.formatAr
 import com.swago.room.R
 import com.swago.room.adapter.bitmap.CenterAlignImageSpan
@@ -48,6 +52,7 @@ class RoomChatAdapter :
 
     companion object {
         const val LEVEL_KEY = "level"
+        const val BADGE_KEY = "badge"
         const val PRETTY_KEY = "pretty"//靓号
         const val VIP_KEY = "vip"//每日首冲
         const val IS_OFFICIAL = "official"
@@ -60,6 +65,7 @@ class RoomChatAdapter :
 
     init {
         localImageKey.add(LEVEL_KEY)
+        localImageKey.add(BADGE_KEY)
         localImageKey.add(PRETTY_KEY)
         localImageKey.add(VIP_KEY)
         localImageKey.add(IS_OFFICIAL)
@@ -72,6 +78,9 @@ class RoomChatAdapter :
 
     var showUserInfoDialog: ((iChatMsg: IRoomChat) -> Unit)? = null
 
+    fun setChatAndBadge(chatDrawable: NinePatchDrawable , badgeBitmap: Bitmap){
+
+    }
 
     override fun convert(helper: BaseViewHolder, item: IRoomChat) {
         var count = 0
@@ -137,6 +146,12 @@ class RoomChatAdapter :
                             .append("'> ")
                     }
 
+                    if (item is RoomChatMsgBean && !item.badge_special.isNullOrEmpty()) {
+                        count++
+                        sb.append("<img src='" + "file:///xx/")
+                            .append(BADGE_KEY).append(".png")
+                            .append("'> ")
+                    }
                     count++
                     sb.append("<img src='" + "file:///xx/")
                         .append(LEVEL_KEY).append(".png")
@@ -149,7 +164,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
 
                     if (span.length < item.getSenderName().length + count) {
@@ -190,6 +205,15 @@ class RoomChatAdapter :
                     }else{
                         setBackgroundRes(R.id.tvContent, R.drawable.shape_20000000_14)
                     }
+                    mContext?.let {
+                        if (item is RoomChatMsgBean&&!item.android_chat_special.isNullOrEmpty()){
+                            DianJiuUtil.loadDian9Tu(it ,item.android_chat_special ){ drawable ->
+                                drawable?.let { drawable ->
+                                    tvContent.background = drawable
+                                }
+                            }
+                        }
+                    }
                 }
 
                 RoomMsgType.SYSTEM_MESSAGE -> {
@@ -274,7 +298,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
                     if (span.length < item.getSenderName().length + count) {
                         span.setSpan(
@@ -366,6 +390,13 @@ class RoomChatAdapter :
                             .append("'> ")
                     }
 
+                    if (item is UserJoinRoomBean && !item.androidBadgeSpecial.isNullOrEmpty()) {
+                        count++
+                        sb.append("<img src='" + "file:///xx/")
+                            .append(BADGE_KEY).append(".png")
+                            .append("'> ")
+                    }
+
                     count++
                     sb.append("<img src='" + "file:///xx/")
                         .append(LEVEL_KEY).append(".png")
@@ -378,7 +409,7 @@ class RoomChatAdapter :
                     val glideImageGetter = HtmlImageGetter(mContext, tvContent, 14, localImageKey)
                     val fromHtml = Html.fromHtml(sb.toString(), glideImageGetter, null)
                     span = SpannableString(fromHtml)
-                    setHtml(span, helper, item)
+                    setHtml(span, helper, item,tvContent)
 
                     if (span.length < item.getSenderName().length + count) {
                         span.setSpan(
@@ -432,8 +463,19 @@ class RoomChatAdapter :
                         }
                     }
 
+                    mContext?.let {
+                        if (item is UserJoinRoomBean&&!item.androidChatSpecial.isNullOrEmpty()){
+                            DianJiuUtil.loadDian9Tu(it ,item.androidChatSpecial ){ drawable ->
+                                drawable?.let { drawable ->
+                                    tvContent.background = drawable
+                                }
+                            }
+                        }
+                    }
+
                 }
             }
+
             tvContent.movementMethod = LinkMovementMethod.getInstance()
             tvContent.highlightColor = Color.TRANSPARENT
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -445,7 +487,7 @@ class RoomChatAdapter :
     }
 
 
-    private fun setHtml(span: SpannableString, helper: BaseViewHolder, item: IRoomChat) {
+    private fun setHtml(span: SpannableString, helper: BaseViewHolder, item: IRoomChat, tvContent:TextView) {
         try {
             val imageSpans = span.getSpans(0, span.length, ImageSpan::class.java)
             var i = 0
@@ -526,7 +568,32 @@ class RoomChatAdapter :
                         end,
                         Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
                     )
-                }else {
+                }else if (imageSpan.source != null && imageSpan!!.source!!.contains(BADGE_KEY)) {
+                    if(item is UserJoinRoomBean && !TextUtils.isEmpty(item.androidBadgeSpecial)){
+                        BitmapUtils.loadFile(AppContext.getContext(),item.androidBadgeSpecial){
+                            it?.let {
+                                span.setSpan(
+                                    setBadge(it, helper.itemView as ViewGroup),
+                                    start,
+                                    end,
+                                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
+                            }
+
+                        }
+                    } else if (item is RoomChatMsgBean && !TextUtils.isEmpty(item.badge_special)){
+                        BitmapUtils.loadFile(AppContext.getContext(),item.badge_special){
+                            it?.let {
+                                span.setSpan(
+                                    setBadge(it, helper.itemView as ViewGroup),
+                                    start,
+                                    end,
+                                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
+                            }
+
+                        }
+                    }
+
+            }else {
                     span.setSpan(newImageSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
                 }
                 span.removeSpan(imageSpan)
@@ -723,6 +790,11 @@ class RoomChatAdapter :
         return CustomImageSpan(mContext, bm, CustomImageSpan.ALIGN_FONTCENTER)
     }
 
+    private fun setBadge(bitmap: Bitmap,viewGroup: ViewGroup): CustomImageSpan {
+        val imageView = ImageView(mContext)
+        viewGroup.addView(imageView)
+        return CustomImageSpan(mContext, bitmap, CustomImageSpan.ALIGN_FONTCENTER)
+    }
 
     private fun setLevel(iSenderLevel: Int, viewGroup: ViewGroup): CustomImageSpan {
         var level = iSenderLevel.toString()

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

@@ -1,24 +1,52 @@
 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
+import com.opensource.svgaplayer.SVGADrawable
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.model.live.RoomUserModel
+import com.swago.baseswago.util.UserInfo
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
+import java.net.URL
 
 /**
  *@date 2021/10/23 09:56
  *description:
  */
 class RoomUserAdapter : BaseQuickAdapter<RoomUserModel.ListBean,BaseViewHolder>(R.layout.item_room_user, arrayListOf()) {
-
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
     override fun convert(helper: BaseViewHolder, item: RoomUserModel.ListBean) {
         helper.apply {
             val ivAvatar = itemView.findViewById<CircleImageView>(R.id.ivAvatar)
+            val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
             Glide.with(itemView.context).load(item.user_head_img_url)
                 .placeholder(R.mipmap.default_avatar)
                 .error(R.mipmap.default_avatar).into(ivAvatar)
+
+            if (!item.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)
+                        svgAvatar.startAnimation()
+                    }
+
+                    override fun onError() {
+                    }
+                })
+            } else{
+                svgAvatar.visibility = View.INVISIBLE
+            }
+
         }
     }
 }

+ 55 - 0
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -1,17 +1,40 @@
 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
+import com.opensource.svgaplayer.SVGAImageView
+import com.opensource.svgaplayer.SVGAParser
+import com.opensource.svgaplayer.SVGAVideoEntity
 import com.swago.baseswago.cusview.SwagoImageView
 import com.swago.baseswago.model.live.audio.AudioSeatModel
+import com.swago.baseswago.util.LogUtil
 import com.swago.room.R
+import java.net.URL
 
 class AudioSeatAdapter :
     BaseQuickAdapter<AudioSeatModel, BaseViewHolder>(R.layout.item_audio_seat, arrayListOf()) {
+    private val svgaParser by lazy {
+        SVGAParser(mContext)
+    }
+
+    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)
@@ -23,6 +46,8 @@ class AudioSeatAdapter :
                         itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                             .loadImage(R.mipmap.ic_audio_seat)
                     }
+                    svgaVideoEntityMap[adapterPosition] = null
+                    svgAvatar.visibility = View.INVISIBLE
                 } else {
                     itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                         .loadImage(it.user_head_img_url ?: "")
@@ -48,9 +73,39 @@ 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()
+                                }
+
+                                override fun onError() {
+                                }
+                            })
+                        } else {
+                            svgaVideoEntityMap[adapterPosition]?.let { oldSeat ->
+                                val drawable = SVGADrawable(oldSeat.drawable)
+                                svgAvatar.setImageDrawable(drawable)
+                                svgAvatar.startAnimation()
+                            }
+
+                        }
+
+                    } else {
+                        svgaVideoEntityMap[adapterPosition] = null
+                        svgAvatar.visibility = View.INVISIBLE
+                    }
+
                 }
             }
         }
 
     }
+
+    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)
     }
 

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

@@ -193,4 +193,32 @@ class UserRoomModel : IRoomInfo {
     override fun getPassStatus(): Int {
         return momentModel?.broadcast_password_status ?: 0
     }
+
+    override fun getJoinSpecial(): String {
+        return roomModel?.join_special ?: ""
+    }
+
+    override fun getHeadSpecial(): String {
+        return if (RoleType.user == SwagoRoomManager.roleType) {
+            roomModel?.broadcast_head_special ?: ""
+        } else {
+            roomModel?.head_special ?: ""
+        }
+    }
+
+    override fun getBadgeSpecial(): String {
+        return if (RoleType.user == SwagoRoomManager.roleType) {
+            momentModel?.badge_special ?: ""
+        } else {
+            roomModel?.badge_special ?: ""
+        }
+    }
+
+    override fun getChatSpecial(): String {
+        return if (RoleType.user == SwagoRoomManager.roleType) {
+            momentModel?.chat_special ?: ""
+        } else {
+            roomModel?.chat_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
+    }
 }

+ 18 - 3
room/src/main/java/com/swago/room/dialog/SendMsgDialog.kt

@@ -5,6 +5,7 @@ import android.text.Editable
 import android.text.TextWatcher
 import android.view.Gravity
 import android.view.View
+import android.widget.Toast
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.core.content.ContextCompat
 import androidx.fragment.app.viewModels
@@ -22,7 +23,6 @@ import com.swago.room.util.IMSender
 import com.swago.room.vm.RoomOtherVm
 import com.tencent.imsdk.v2.V2TIMMessage
 import com.tencent.imsdk.v2.V2TIMValueCallback
-import com.tencent.qcloud.tim.uikit.utils.ToastUtil
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 import org.json.JSONObject
@@ -157,6 +157,9 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
                             roomChatMsgBean.isCup = it.is_cup
                             roomChatMsgBean.isAdmin = SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0
                             roomChatMsgBean.isFans = SwagoRoomManager.iRoomInfo?.getIsFans()?:0
+                            roomChatMsgBean.android_chat_special = it.android_chat_special
+                            roomChatMsgBean.ios_chat_special = it.ios_chat_special
+                            roomChatMsgBean.badge_special = it.android_badge_special
 
                             val jsonObject = JSONObject()
                             jsonObject.put("senderId", it.id)
@@ -172,6 +175,9 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
                             jsonObject.put("isCup", it.is_cup)
                             jsonObject.put("isAdmin", SwagoRoomManager.iRoomInfo?.getRoomAdmin()?:0)
                             jsonObject.put("isFans", SwagoRoomManager.iRoomInfo?.getIsFans()?:0)
+                            jsonObject.put("android_chat_special", it.android_chat_special)
+                            jsonObject.put("ios_chat_special", it.ios_chat_special)
+                            jsonObject.put("badge_special", it.android_badge_special)
 
                             val jsonObjectType = JSONObject()
                             jsonObjectType.put("type", room_chat_text)
@@ -189,7 +195,11 @@ class SendMsgDialog : BaseXDFragment<DialogSendMsgBinding>() {
 
                                         override fun onError(code: Int, desc: String?) {
                                             if (code == 10016){
-                                                ToastUtil.toastShortMessage(AppContext.getContext().getString(R.string.you_been_banned))
+                                                Toast.makeText(
+                                                    AppContext.getContext(),
+                                                    AppContext.getContext().resources.getString(R.string.you_been_banned),
+                                                    Toast.LENGTH_SHORT
+                                                ).show()
                                             }
 
                                         }
@@ -207,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
+    }
 }

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

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

+ 57 - 0
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,6 +88,60 @@ class XSvgPlayer : ConstraintLayout {
         }
     }
 
+    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")
+            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
+                        svgaImageView.setImageDrawable(drawable)
+                        svgaImageView.loops = 1
+                        svgaImageView.callback = callback
+                        LogUtil.d("svgPlayer","onComplete--$isPlaying")
+                        if (!isPlaying){
+                            svgaImageView.startAnimation()
+                            isPlaying = true
+                        }
+
+                    }
+
+                }
+
+                override fun onError() {
+                    callbackExecuted = true
+                    binding?.apply {
+                        isPlaying = false
+                        LogUtil.d("svgPlayer","onError--$isPlaying")
+                        svgaImageView.visibility = View.GONE
+                        nextSvgPlay?.invoke()
+                    }
+                }
+            })
+
+            handler.postDelayed({
+                if (!callbackExecuted){
+                    playJoinRoomSvga(userJoinRoomBean)
+                    LogUtil.d("JoinAnimalManager","callbackExecuted")
+                }
+
+            },7000)
+
+        }
+    }
+
     fun clear(){
         binding?.apply {
             isPlaying = false

+ 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

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

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

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

+ 49 - 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
@@ -29,6 +30,7 @@ import com.swago.loadUrl
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
 import java.io.File
+import java.net.URL
 import java.util.LinkedList
 
 class JoinRoomManager : IRoomActiveListener {
@@ -46,6 +48,7 @@ class JoinRoomManager : IRoomActiveListener {
     private var clBg: ConstraintLayout? = null
     private var clTwo: ConstraintLayout? = null
     private var clOne: LinearLayout? = null
+    private var svgaAvatar: SVGAImageView? = null
     private var animationSet: AnimatorSet? = null
     private val waitingTime = 1000L
 
@@ -70,6 +73,7 @@ class JoinRoomManager : IRoomActiveListener {
             swagoLevel = view.findViewById(R.id.swagoLevel)
             swagoLevelOne = view.findViewById(R.id.swagoLevelOne)
             joinRoomRootView = view.findViewById(R.id.rootView)
+            svgaAvatar = view.findViewById(R.id.svgAvatar)
             initViewAnimation()
             loopStart()
             SwagoRoomManager.addListener(this@JoinRoomManager)
@@ -120,6 +124,21 @@ class JoinRoomManager : IRoomActiveListener {
                 clBg?.setBackgroundResource(R.mipmap.join_ten_fourteen)
                 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)
+                            svgaAvatar?.setImageDrawable(drawable)
+                            svgaAvatar?.startAnimation()
+                        }
+
+                        override fun onError() {
+                        }
+                    })
+                } else {
+                    svgaAvatar?.visibility = View.INVISIBLE
+                }
             }
             in 15..19 -> {
                 clOne?.visibility = View.GONE
@@ -132,6 +151,21 @@ class JoinRoomManager : IRoomActiveListener {
                 clBg?.setBackgroundResource(R.mipmap.join_fifteen_nineteen)
                 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)
+                            svgaAvatar?.setImageDrawable(drawable)
+                            svgaAvatar?.startAnimation()
+                        }
+
+                        override fun onError() {
+                        }
+                    })
+                } else {
+                    svgaAvatar?.visibility = View.INVISIBLE
+                }
             }
             else -> {
                 clOne?.visibility = View.GONE
@@ -178,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
+                }
             }
         }
     }

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

@@ -56,6 +56,7 @@ import com.swago.baseswago.model.live.WishGift
 import com.swago.baseswago.model.live.audio.*
 import com.swago.baseswago.model.live.gift.IMGiftModel
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.BitmapUtils
 import com.swago.baseswago.util.UserInfo
 import com.swago.room.audio.AudioRoomManager
 import com.swago.room.audio.IAudioRoomListener
@@ -155,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()
     }
@@ -174,9 +180,12 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
             ) {
                 if (SwagoRoomManager.roleType == RoleType.user || it.data?.senderCode != UserInfo.getUserInfo()?.user_account) {
                     it.data?.let {
-                        newChatMsgFun?.invoke(it)
                         updateHotValue?.invoke(it.hotValue)
                         joinRoomManager.addJoinRoomData(it)
+                        joinRoomFun?.invoke(it)
+                        BitmapUtils.loadFile(AppContext.getContext() , it.androidBadgeSpecial){ bitmap ->
+                            newChatMsgFun?.invoke(it)
+                        }
                     }
                 }
             }
@@ -547,7 +556,8 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                             it.maiSeatInfo.integration,
                             it.maiSeatInfo.voiceUserId,
                             it.maiSeatInfo.maiIndex,
-                            0
+                            0,
+                            it.maiSeatInfo.head_special
                         )
                         AudioRoomManager.dispatchUpdateData(audioSeatModel)
                         UserInfo.getUserInfo()?.let { userInfoModel ->
@@ -697,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 {

+ 3 - 0
room/src/main/java/com/swago/room/vm/RoomVm.kt

@@ -103,6 +103,9 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
             requestError {
                 if (it is SwagoException) {
                     if (it.code == 504) {
+                        SpUtil.putString("hotCloseRoomed",iRoomInfo.getRoomId())
+                        SpUtil.putString("newCloseRoomed",iRoomInfo.getRoomId())
+                        SpUtil.putString("followCloseRoomed",iRoomInfo.getRoomId())
                         Toast.makeText(AppContext.getContext(), it.message, Toast.LENGTH_SHORT)
                             .show()
                         if (SwagoRoomManager.iRoomInfo == null){

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

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

+ 6 - 0
room/src/main/java/com/swago/room/widget/UserShowAnchorCloseView.kt

@@ -11,6 +11,7 @@ import com.swago.baseswago.baseroom.SwagoRoomManager
 import com.swago.baseswago.model.im.AnchorRoomClosedBean
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.SpUtil
 import com.swago.room.R
 import com.swago.room.databinding.DialogUserForAnchorCloseBinding
 import jp.wasabeef.glide.transformations.BlurTransformation
@@ -22,6 +23,7 @@ import jp.wasabeef.glide.transformations.BlurTransformation
 class UserShowAnchorCloseView : ConstraintLayout {
 
     private lateinit var binding : DialogUserForAnchorCloseBinding
+    private var anchorRoomClosedBean:AnchorRoomClosedBean?= null
 
     constructor(context: Context) : this(context, null)
     constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
@@ -37,12 +39,16 @@ class UserShowAnchorCloseView : ConstraintLayout {
         binding = DialogUserForAnchorCloseBinding.inflate(LayoutInflater.from(context), this, true)
         binding.tvBack.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
+                SpUtil.putString("hotCloseRoomed",anchorRoomClosedBean?.roomId ?: "0")
+                SpUtil.putString("newCloseRoomed",anchorRoomClosedBean?.roomId ?: "0")
+                SpUtil.putString("followCloseRoomed",anchorRoomClosedBean?.roomId ?: "0")
                 SwagoRoomManager.closeRoom()
             }
         })
     }
 
     fun setData(anchorRoomClosedBean: AnchorRoomClosedBean){
+        this.anchorRoomClosedBean = anchorRoomClosedBean
         RoomTimer.clear()
         binding.tvName.text = anchorRoomClosedBean.senderName
         binding.tvID.text = AppContext.getContext().resources.getString(R.string.id_x)

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

+ 30 - 8
room/src/main/res/layout/item_audio_seat.xml

@@ -6,17 +6,39 @@
     tools:background="#000"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <com.swago.baseswago.cusview.SwagoImageView
-        android:id="@+id/ivImageView"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clAvatar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_width="68dp"
-        android:layout_height="68dp"/>
+        app:layout_constraintTop_toTopOf="parent">
+        <com.swago.baseswago.cusview.SwagoImageView
+            android:id="@+id/ivImageView"
+            android:layout_width="68dp"
+            android:layout_height="68dp"
+            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="68dp"
+            android:layout_height="68dp"
+            android:visibility="invisible"
+            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>
+
 
     <ImageView
         android:id="@+id/ivAudioState"
-        app:layout_constraintEnd_toEndOf="@+id/ivImageView"
-        app:layout_constraintBottom_toBottomOf="@+id/ivImageView"
+        app:layout_constraintEnd_toEndOf="@+id/clAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
         android:src="@mipmap/live_mute"
         android:visibility="invisible"
         tools:visibility="visible"
@@ -34,7 +56,7 @@
         android:ellipsize="end"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/ivImageView"
+        app:layout_constraintTop_toBottomOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 

+ 33 - 9
room/src/main/res/layout/item_dialog_audience.xml

@@ -5,18 +5,42 @@
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <de.hdodenhof.circleimageview.CircleImageView
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clAvatar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_marginStart="16dp"
-        android:id="@+id/ivAvatar"
-        android:layout_width="50dp"
-        android:layout_height="50dp"/>
+        android:layout_marginStart="16dp">
+
+        <de.hdodenhof.circleimageview.CircleImageView
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:id="@+id/ivAvatar"
+            android:layout_width="40dp"
+            android:layout_height="40dp"/>
+
+        <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>
+
+
 
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tvName"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
         android:layout_marginStart="8dp"
         android:layout_marginTop="4dp"
         android:textSize="18dp"
@@ -24,15 +48,15 @@
         tools:text="Chridfsfdsfdfs"
         android:maxLines="1"
         android:maxWidth="150dp"
-        app:layout_constraintTop_toTopOf="@+id/ivAvatar"
+        app:layout_constraintTop_toTopOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
     <com.swago.baseswago.cusview.SwagoLevelView
         android:id="@+id/tvLevel"
         android:layout_marginStart="8dp"
-        app:layout_constraintStart_toEndOf="@+id/ivAvatar"
-        app:layout_constraintBottom_toBottomOf="@+id/ivAvatar"
+        app:layout_constraintStart_toEndOf="@+id/clAvatar"
+        app:layout_constraintBottom_toBottomOf="@+id/clAvatar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 

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

@@ -13,7 +13,17 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
-
+    <com.opensource.svgaplayer.SVGAImageView
+        android:id="@+id/svgAvatar"
+        android:layout_width="38dp"
+        android:layout_height="38dp"
+        android:visibility="visible"
+        app:autoPlay="true"
+        app:loopCount="0"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
     <View
         android:id="@+id/view"
         android:visibility="gone"

+ 18 - 2
room/src/main/res/layout/item_room_user.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="40dp"
     android:layout_height="30dp">
 
@@ -7,7 +8,22 @@
         android:id="@+id/ivAvatar"
         android:layout_marginStart="5dp"
         android:layout_marginEnd="5dp"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
+        android:layout_width="22dp"
+        android:layout_height="22dp"
+        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="30dp"
+        android:layout_height="30dp"
+        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>

+ 30 - 8
room/src/main/res/layout/layout_user_header_view.xml

@@ -18,19 +18,41 @@
         android:background="@drawable/shape_20000000_41"
         android:layout_height="34dp">
 
-        <de.hdodenhof.circleimageview.CircleImageView
-            android:id="@+id/ivAvatar"
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clAvatar"
+            android:layout_width="30dp"
+            android:layout_height="30dp"
             android:layout_marginStart="2dp"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            android:layout_width="30dp"
-            android:layout_height="30dp"/>
+            app:layout_constraintBottom_toBottomOf="parent">
+
+            <de.hdodenhof.circleimageview.CircleImageView
+                android:id="@+id/ivAvatar"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                android:layout_width="22dp"
+                android:layout_height="22dp"/>
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                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>
+
 
         <LinearLayout
             android:id="@+id/ll"
             android:orientation="vertical"
-            app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+            app:layout_constraintStart_toEndOf="@+id/clAvatar"
             android:layout_width="wrap_content"
             android:layout_height="match_parent">
 
@@ -45,7 +67,7 @@
                 android:maxLines="1"
                 android:maxWidth="120dp"
                 app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintStart_toEndOf="@+id/clAvatar"
                 tools:text="NickNamed"
                 app:layout_constraintHorizontal_bias="0"
                 android:layout_width="wrap_content"
@@ -61,7 +83,7 @@
                 android:layout_marginEnd="8dp"
                 android:maxWidth="120dp"
                 app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toEndOf="@+id/ivAvatar"
+                app:layout_constraintStart_toEndOf="@+id/clAvatar"
                 app:layout_constraintHorizontal_bias="0"
                 tools:text="ID:dddddddddd"
                 android:maxLines="1"

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

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

@@ -85,7 +85,17 @@
                 android:layout_width="36dp"
                 android:layout_height="36dp"/>
 
-
+            <com.opensource.svgaplayer.SVGAImageView
+                android:id="@+id/svgAvatar"
+                android:layout_width="44dp"
+                android:layout_height="44dp"
+                android:visibility="invisible"
+                app:autoPlay="true"
+                app:loopCount="0"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                android:layout_marginStart="8dp"/>
             <com.swago.baseswago.cusview.SwagoLevelView
                 android:id="@+id/swagoLevel"
                 android:layout_marginStart="5dp"

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

+ 30 - 0
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 设置头像
@@ -278,4 +280,32 @@ public interface IMessageProperties {
      * @param color
      */
     void setTipsMessageFontColor(int color);
+
+    /**
+     * 获取右边头像框
+     *
+     * @return
+     */
+    SVGAVideoEntity getRightSvgaAvatar();
+
+    /**
+     * 设置右边头像框
+     *
+     * @param drawable
+     */
+    void setRightSvgaAvatar(SVGAVideoEntity drawable);
+
+    /**
+     * 获取左边头像框
+     *
+     * @return
+     */
+    SVGAVideoEntity getLeftSvgaAvatar();
+
+    /**
+     * 设置左边头像框
+     *
+     * @param drawable
+     */
+    void setLeftSvgaAvatar(SVGAVideoEntity drawable);
 }

+ 42 - 0
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;
@@ -104,6 +105,26 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
         properties.setLeftBubble(bubble);
     }
 
+    @Override
+    public SVGAVideoEntity getRightSvgaAvatar() {
+        return properties.getRightSvgaAvatar();
+    }
+
+    @Override
+    public void setRightSvgaAvatar(SVGAVideoEntity drawable) {
+        properties.setRightSvgaAvatar(drawable);
+    }
+
+    @Override
+    public SVGAVideoEntity getLeftSvgaAvatar() {
+        return properties.getLeftSvgaAvatar();
+    }
+
+    @Override
+    public void setLeftSvgaAvatar(SVGAVideoEntity drawable) {
+        properties.setLeftSvgaAvatar(drawable);
+    }
+
     @Override
     public int getNameFontSize() {
         return properties.getNameFontSize();
@@ -285,6 +306,8 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
         private int mChatTimeFontSize;
         private int mChatTimeFontColor;
         private Drawable mChatTimeBubble;
+        private SVGAVideoEntity mMySvgaAvatar;
+        private SVGAVideoEntity mFriendSvgaAvatar;
 
         private Properties() {
 
@@ -481,5 +504,24 @@ public abstract class MessageLayoutUI extends RecyclerView implements IMessageLa
             this.mChatTimeFontColor = color;
         }
 
+        @Override
+        public SVGAVideoEntity getRightSvgaAvatar() {
+            return mMySvgaAvatar;
+        }
+
+        @Override
+        public void setRightSvgaAvatar(SVGAVideoEntity drawable) {
+            this.mMySvgaAvatar = drawable;
+        }
+
+        @Override
+        public SVGAVideoEntity getLeftSvgaAvatar() {
+            return mFriendSvgaAvatar;
+        }
+
+        @Override
+        public void setLeftSvgaAvatar(SVGAVideoEntity drawable) {
+            this.mFriendSvgaAvatar = drawable;
+        }
     }
 }

+ 52 - 9
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;
@@ -10,19 +11,35 @@ import android.widget.ProgressBar;
 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 {
 
     public CircleImageView leftUserIcon;
+    public SVGAImageView leftSvgaImage;
     public CircleImageView rightUserIcon;
+    public SVGAImageView rightSvgaImage;
     public TextView usernameText;
     public LinearLayout msgContentLinear;
     public ProgressBar sendingProgress;
@@ -36,6 +53,8 @@ public abstract class MessageContentHolder extends MessageEmptyHolder {
 
         leftUserIcon = itemView.findViewById(R.id.left_user_icon_view);
         rightUserIcon = itemView.findViewById(R.id.right_user_icon_view);
+        leftSvgaImage = itemView.findViewById(R.id.svgAvatar_left);
+        rightSvgaImage = itemView.findViewById(R.id.svgAvatar_right);
         usernameText = itemView.findViewById(R.id.user_name_tv);
         msgContentLinear = itemView.findViewById(R.id.msg_content_ll);
         statusImage = itemView.findViewById(R.id.message_status_iv);
@@ -114,20 +133,44 @@ public abstract class MessageContentHolder extends MessageEmptyHolder {
             sendingProgress.setVisibility(View.GONE);
         }
 
+        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 {
+                msgContentLinear.setBackgroundResource(R.drawable.bg_chat_white);
+            }
+        }
+
         //// 聊天气泡设置
         if (msg.isSelf()) {
-            if (properties.getRightBubble() != null && properties.getRightBubble().getConstantState() != null) {
-                msgContentFrame.setBackground(properties.getRightBubble().getConstantState().newDrawable());
-            } else {
-                msgContentFrame.setBackgroundResource(R.drawable.chat_bubble_myself);
+            if (properties.getRightSvgaAvatar() != null){
+                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){
+                SVGADrawable drawable = new SVGADrawable(properties.getLeftSvgaAvatar());
+                leftSvgaImage.setVisibility(View.VISIBLE);
+                leftSvgaImage.setImageDrawable(drawable);
+                leftSvgaImage.startAnimation();
             }
+            rightSvgaImage.setVisibility(View.INVISIBLE);
         }
 
         //// 聊天气泡的点击事件处理

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

@@ -11,6 +11,8 @@ import android.widget.LinearLayout;
 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;
@@ -48,6 +50,7 @@ public class ConversationCommonHolder extends ConversationBaseHolder {
     protected TextView tvOfficial;
     protected ImageView ivCrown;
     protected ImageView ivCup;
+    protected SVGAImageView svgaImageView;
 
     public ConversationCommonHolder(View itemView) {
         super(itemView);
@@ -63,6 +66,7 @@ public class ConversationCommonHolder extends ConversationBaseHolder {
         tvOfficial = rootView.findViewById(R.id.tvOfficial);
         ivCrown = rootView.findViewById(R.id.ivCrown);
         ivCup = rootView.findViewById(R.id.ivCup);
+        svgaImageView = rootView.findViewById(R.id.svgAvatar);
     }
 
     public void layoutViews(ConversationInfo conversation, int position) {
@@ -156,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);
 

BIN
tuikit/src/main/res/drawable-xxhdpi/bg_chat_purple.9.png


BIN
tuikit/src/main/res/drawable-xxhdpi/bg_chat_white.9.png


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

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

+ 19 - 0
tuikit/src/main/res/layout/forward_message_adapter_item_content.xml

@@ -52,6 +52,16 @@
             app:default_image="@drawable/default_user_icon"
             app:image_radius="20dp" />
 
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_left"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="visible"
+            app:autoPlay="true"
+            app:loopCount="0"
+            android:layout_alignParentLeft="true"
+            android:layout_marginRight="6.23dp"/>
+
         <com.tencent.qcloud.tim.uikit.component.gatherimage.UserIconView
             android:id="@+id/right_user_icon_view"
             android:layout_width="41dp"
@@ -61,6 +71,15 @@
             android:visibility="gone"
             app:default_image="@drawable/default_user_icon"
             app:image_radius="20dp" />
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_right"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="visible"
+            app:autoPlay="true"
+            app:loopCount="0"
+            android:layout_alignParentLeft="true"
+            android:layout_marginLeft="6.23dp"/>
     </RelativeLayout>
 
     <TextView

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

@@ -3,7 +3,7 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:gravity="center_vertical"
-    android:minHeight="36dp"
+    android:minHeight="31dp"
     android:orientation="horizontal">
 
     <TextView
@@ -14,8 +14,8 @@
         android:textColor="@color/black_font_color"
         android:paddingLeft="7dp"
         android:paddingRight="7dp"
-        android:paddingTop="10dp"
-        android:paddingBottom="10dp"
+        android:paddingTop="7dp"
+        android:paddingBottom="7dp"
         android:maxWidth="276dp"
         android:textSize="16.5sp" />
 </LinearLayout>

+ 26 - 5
tuikit/src/main/res/layout/message_adapter_item_content.xml

@@ -41,22 +41,43 @@
 
         <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/left_user_icon_view"
-            android:layout_width="41dp"
-            android:layout_height="41dp"
+            android:layout_width="36dp"
+            android:layout_height="36dp"
             android:layout_alignParentLeft="true"
             android:layout_marginRight="6.23dp"
+            android:layout_marginTop="@dimen/dp_4"
+            android:layout_marginLeft="2dp"
             android:visibility="gone"
             android:scaleType="centerCrop"/>
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_left"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="invisible"
+            app:autoPlay="true"
+            app:loopCount="0"
+            android:layout_alignParentLeft="true"
+            android:layout_marginRight="6.23dp"/>
 
         <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/right_user_icon_view"
-            android:layout_width="41dp"
-            android:layout_height="41dp"
+            android:layout_width="36dp"
+            android:layout_height="36dp"
             android:layout_alignParentRight="true"
             android:layout_marginLeft="6.23dp"
+            android:layout_marginTop="@dimen/dp_4"
+            android:layout_marginRight="2dp"
             android:scaleType="centerCrop"
             android:visibility="gone"/>
-
+        <com.opensource.svgaplayer.SVGAImageView
+            android:id="@+id/svgAvatar_right"
+            android:layout_width="41dp"
+            android:layout_height="41dp"
+            android:visibility="invisible"
+            app:autoPlay="true"
+            app:loopCount="0"
+            android:layout_alignParentRight="true"
+            android:layout_marginLeft="6.23dp"/>
         <TextView
             android:id="@+id/user_name_tv"
             android:layout_width="wrap_content"

BIN
user/src/main/assets/jojo_audio.svga


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

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

@@ -3,35 +3,46 @@ 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
 import com.swago.user.databinding.DialogStoreDetailBinding
 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 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
         }
@@ -42,48 +53,84 @@ 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}"
-            svgaParser?.let { svgaParser ->
-                svgaParser.decodeFromURL(URL(it.product_url), object : SVGAParser.ParseCompletion{
-                    override fun onComplete(videoItem: SVGAVideoEntity) {
-                        val drawable = SVGADrawable(videoItem)
-                        binding.svgContent.setImageDrawable(drawable)
-                        binding.svgContent.startAnimation()
-                    }
+            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() {
 
-                    }
-                })
+                        }
 
-            }
-        }
-        svgaParser?.let {
-            it.decodeFromAssets("jojo_audio.svga",object : SVGAParser.ParseCompletion{
-                override fun onComplete(videoItem: SVGAVideoEntity) {
-                    val drawable = SVGADrawable(videoItem)
-                    binding.svgContent.setImageDrawable(drawable)
-                    binding.svgContent.startAnimation()
+                        override fun onError() {
+                        }
+                    })
                 }
 
-                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) {
+                        Toast.makeText(
+                            AppContext.getContext(),
+                            AppContext.getContext().resources.getString(R.string.this_product_has_been_purchased),
+                            Toast.LENGTH_SHORT
+                        ).show()
+                        return@let
+                    }
                     storeVm.buyProduct(it.id)
                 }
 
             }
         })
+        binding?.svgContent?.setOnClickListener {
+            dismissAllowingStateLoss()
+        }
+
+        storeVm.buyProductSuccess.observe(this) {
+            if (it) {
+                buySuccessFun?.invoke()
+            }
+            dismissAllowingStateLoss()
+        }
     }
 }

+ 26 - 2
user/src/main/java/com/swago/user/store/StoreItemAdapter.kt

@@ -13,12 +13,36 @@ class StoreItemAdapter(private val type: Int) : BaseQuickAdapter<StoreItemBean,
 
     override fun convert(helper: BaseViewHolder?, item: StoreItemBean?) {
         helper?.apply {
-            setVisible(R.id.tvUsing , type != 1)
             setVisible(R.id.tv_coin , type == 1)
+            setVisible(R.id.tv_time , type == 2)
 
             item?.let {
+                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)
-                setText(R.id.tv_coin ,"${item.product_coin}")
+                if (type == 1){
+                    setText(R.id.tv_coin ,"${item.product_coin}")
+                } else if (type == 2){
+                    setText(R.id.tv_time ,if (item.expire_at == 0L)"Unlimited time" else "${item.expire_at}days")
+                }
                 itemView.findViewById<CircleImageView>(R.id.iv_svg).loadUrl(mContext,item.product_url?: "")
             }
 

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

@@ -14,6 +14,7 @@ import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.model.live.audio.PositionBean
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.SpUtil
 import com.swago.user.R
 import com.swago.user.databinding.ActivityStoreListBinding
 import com.swago.user.vm.StoreVm
@@ -178,6 +179,10 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
             if (it.isNullOrEmpty()){
                 binding.clEmpty.visibility = View.VISIBLE
             } else {
+                enterList.clear()
+                avatarList.clear()
+                badgeList.clear()
+                bubbleList.clear()
                 it.forEach { item ->
                     when (item.product_category){
                         1 -> {
@@ -217,64 +222,133 @@ class StoreListActivity : BaseXActivity<ActivityStoreListBinding>() {
         binding.clEnterMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isEnterExpanded = !isEnterExpanded
             if (isEnterExpanded) {
                 enterAdapter.setNewData(enterList)
-                binding.tvEnterMore.text = "Show Less"
+                binding.tvEnterMore.text = getString(R.string.take_back)
                 binding.ivEnterMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 enterAdapter.setNewData(enterList.subList(0, enterList.size.coerceAtMost(3)))
-                binding.tvEnterMore.text = "Show More"
+                binding.tvEnterMore.text = getString(R.string.more)
                 binding.ivEnterMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isEnterExpanded = !isEnterExpanded
         }
 
         binding.clAvatarMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isAvatarExpanded = !isAvatarExpanded
             if (isAvatarExpanded) {
                 avatarAdapter.setNewData(avatarList)
-                binding.tvAvatarMore.text = "Show Less"
+                binding.tvAvatarMore.text = getString(R.string.take_back)
                 binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 avatarAdapter.setNewData(avatarList.subList(0, avatarList.size.coerceAtMost(3)))
-                binding.tvAvatarMore.text = "Show More"
+                binding.tvAvatarMore.text = getString(R.string.more)
                 binding.ivAvatarMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isAvatarExpanded = !isAvatarExpanded
         }
 
         binding.clBadgeMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isBadgeExpanded = !isBadgeExpanded
             if (isBadgeExpanded) {
                 badgeAdapter.setNewData(badgeList)
-                binding.tvBadgeMore.text = "Show Less"
+                binding.tvBadgeMore.text = getString(R.string.take_back)
                 binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 badgeAdapter.setNewData(badgeList.subList(0, badgeList.size.coerceAtMost(3)))
-                binding.tvBadgeMore.text = "Show More"
+                binding.tvBadgeMore.text = getString(R.string.more)
                 binding.ivBadgeMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isBadgeExpanded = !isBadgeExpanded
         }
 
         binding.clBubbleMore.setOnClickListener {
             if (type == 2)
                 return@setOnClickListener
+            isBubbleExpanded = !isBubbleExpanded
             if (isBubbleExpanded) {
                 bubbleAdapter.setNewData(bubbleList)
-                binding.tvBubbleMore.text = "Show Less"
+                binding.tvBubbleMore.text = getString(R.string.take_back)
                 binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_less)
             } else {
                 bubbleAdapter.setNewData(bubbleList.subList(0, bubbleList.size.coerceAtMost(3)))
-                binding.tvBubbleMore.text = "Show More"
+                binding.tvBubbleMore.text = getString(R.string.more)
                 binding.ivBubbleMore.setImageResource(R.mipmap.ic_show_more)
             }
-            isBubbleExpanded = !isBubbleExpanded
         }
         enterAdapter.setOnItemClickListener { _, _, position ->
-            StoreBuyDialog.newInstance(enterAdapter.data[position]).show(supportFragmentManager ,"StoreBuyDialog")
+            if (type == 1){
+                StoreBuyDialog.newInstance(enterAdapter.data[position],1).apply {
+                    this.buySuccessFun = {
+                        enterAdapter.data[position].product_status = 1
+                        enterAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(enterAdapter.data[position].id)
+                enterList.forEachIndexed { index, storeItemBean ->
+                    enterList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                enterList[position].product_status = 1
+                enterAdapter.notifyDataSetChanged()
+            }
+        }
+        avatarAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(avatarAdapter.data[position],2).apply {
+                    this.buySuccessFun = {
+                        avatarAdapter.data[position].product_status = 1
+                        avatarAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(avatarAdapter.data[position].id)
+                avatarList.forEachIndexed { index, storeItemBean ->
+                    avatarList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                avatarList[position].product_status = 1
+                avatarAdapter.notifyDataSetChanged()
+            }
+        }
+        badgeAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(badgeAdapter.data[position],3).apply {
+                    this.buySuccessFun = {
+                        badgeAdapter.data[position].product_status = 1
+                        badgeAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(badgeAdapter.data[position].id)
+                badgeList.forEachIndexed { index, storeItemBean ->
+                    badgeList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                badgeList[position].product_status = 1
+                badgeAdapter.notifyDataSetChanged()
+            }
+        }
+        bubbleAdapter.setOnItemClickListener { _, _, position ->
+            if (type == 1){
+                StoreBuyDialog.newInstance(bubbleAdapter.data[position],4).apply {
+                    this.buySuccessFun = {
+                        bubbleAdapter.data[position].product_status = 1
+                        bubbleAdapter.notifyItemChanged(position)
+                    }
+                }.show(supportFragmentManager ,"StoreBuyDialog")
+            } else if (type == 2){
+                storeVm.chooseProduct(bubbleAdapter.data[position].id)
+                bubbleList.forEachIndexed { index, storeItemBean ->
+                    bubbleList[index].product_status = 0
+                    return@forEachIndexed
+                }
+                bubbleList[position].product_status = 1
+                bubbleAdapter.notifyDataSetChanged()
+            }
         }
     }
 

+ 26 - 2
user/src/main/java/com/swago/user/vm/StoreVm.kt

@@ -1,13 +1,16 @@
 package com.swago.user.vm
 
 import android.app.Application
+import android.widget.Toast
 import androidx.lifecycle.MutableLiveData
 import com.swago.baseswago.inter.ApiManager
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.model.mine.TaskModel
 import com.swago.baseswago.util.ActivityManagerUtil
+import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.BaseViewModel
 import com.swago.baseswago.util.SwagoLoading
+import com.swago.user.R
 
 class StoreVm(application: Application) : BaseViewModel(application){
 
@@ -27,12 +30,24 @@ class StoreVm(application: Application) : BaseViewModel(application){
         }
     }
 
+    val buyProductSuccess by lazy {
+        MutableLiveData<Boolean>()
+    }
+
     fun buyProduct(productId:Long){
-        requestData2 (){
+        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
             }
-
         }
     }
 
@@ -51,4 +66,13 @@ class StoreVm(application: Application) : BaseViewModel(application){
             }
         }
     }
+
+    fun chooseProduct(productId:Long){
+        requestData2 {
+            requestData {
+                ApiManager.userApi.choseProduct(productId)
+            }
+
+        }
+    }
 }

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

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

+ 46 - 6
user/src/main/res/layout/dialog_store_detail.xml

@@ -11,10 +11,14 @@
             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"
-            app:loopCount="1" />
+            android:layout_marginBottom="-80dp"
+            android:layout_marginStart="-80dp"
+            android:layout_marginEnd="-80dp"
+            app:loopCount="0" />
 
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/cl_bottom"
@@ -24,17 +28,53 @@
             android:paddingBottom="24dp"
             app:layout_constraintBottom_toBottomOf="parent">
 
+            <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">
+                <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:layout_marginTop="18dp"
-                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_toTopOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/clIcon"
                 tools:text="fgg" />
 
             <com.swago.baseswago.cusview.MediumTextView

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

@@ -49,14 +49,29 @@
             android:drawableStart="@mipmap/ic_coin_store"
             android:textSize="10sp"
             android:textColor="#A3FFFFFF"/>
+        <com.swago.baseswago.cusview.MediumTextView
+            android:id="@+id/tv_time"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="2dp"
+            android:drawablePadding="2dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tv_name"
+            android:visibility="gone"
+            tools:text="fgg"
+            android:textSize="10sp"
+            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"