浏览代码

fix: 多人入场动画展示

tongmengxiao 5 月之前
父节点
当前提交
ae1caa3a70

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

+ 6 - 5
room/src/main/java/com/swago/room/audio/AudioSeatAdapter.kt

@@ -21,14 +21,14 @@ class AudioSeatAdapter :
     }
 
     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,
-        8 to null
+        7 to null
     )
 
     override fun convert(helper: BaseViewHolder?, item: AudioSeatModel?) {
@@ -79,7 +79,7 @@ class AudioSeatAdapter :
                             svgaParser.decodeFromURL(URL(it.head_special), object :SVGAParser.ParseCompletion{
                                 override fun onComplete(videoItem: SVGAVideoEntity) {
                                     val drawable = SVGADrawable(videoItem)
-                                    svgaVideoEntityMap[adapterPosition] = OldSeatModel(drawable,it.head_special)
+                                    svgaVideoEntityMap[adapterPosition] = OldSeatModel(videoItem,it.head_special)
                                     svgAvatar.setImageDrawable(drawable)
                                     svgAvatar.startAnimation()
                                 }
@@ -89,7 +89,8 @@ class AudioSeatAdapter :
                             })
                         } else {
                             svgaVideoEntityMap[adapterPosition]?.let { oldSeat ->
-                                svgAvatar.setImageDrawable(oldSeat.drawable)
+                                val drawable = SVGADrawable(oldSeat.drawable)
+                                svgAvatar.setImageDrawable(drawable)
                                 svgAvatar.startAnimation()
                             }
 
@@ -106,5 +107,5 @@ class AudioSeatAdapter :
 
     }
 
-    data class  OldSeatModel(val drawable: SVGADrawable,val url:String?)
+    data class  OldSeatModel(val drawable: SVGAVideoEntity,val url:String?)
 }

+ 5 - 3
room/src/main/java/com/swago/room/dialog/AudienceListDialog.kt

@@ -68,9 +68,11 @@ class AudienceListDialog : BaseListDialogFragment<DialogAudienceListBinding,Room
            if (it == null){
                smartRecyclerView.onFetchDataError()
            }else{
-               smartRecyclerView.onFetchDataFinish(it.list,true)
-
-
+               if (!it.list.isNullOrEmpty()){
+                   smartRecyclerView.onFetchDataFinish(it.list,true)
+               } else {
+                   adapter.loadMoreEnd()
+               }
            }
        }
 

+ 13 - 0
room/src/main/java/com/swago/room/gift/control/XSvgPlayer.kt

@@ -33,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)
@@ -98,8 +100,10 @@ class XSvgPlayer : ConstraintLayout {
         }
         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
@@ -117,6 +121,7 @@ class XSvgPlayer : ConstraintLayout {
                 }
 
                 override fun onError() {
+                    callbackExecuted = true
                     binding?.apply {
                         isPlaying = false
                         LogUtil.d("svgPlayer","onError--$isPlaying")
@@ -126,6 +131,14 @@ class XSvgPlayer : ConstraintLayout {
                 }
             })
 
+            handler.postDelayed({
+                if (!callbackExecuted){
+                    playJoinRoomSvga(userJoinRoomBean)
+                    LogUtil.d("JoinAnimalManager","callbackExecuted")
+                }
+
+            },7000)
+
         }
     }
 

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

@@ -171,6 +171,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"