Explorar o código

feat: person leak

tongmengxiao hai 6 meses
pai
achega
615173c766

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

@@ -163,7 +163,7 @@ class PersonDataDFragment : BaseXDFragment<DialogPersonDataBinding>() {
                         if (!TextUtils.isEmpty(uid)){
                             userVm.getOtherUserInfo(uid,roomId)
                         }
-                    }.show(parentFragmentManager,"HandleDialogFragment")
+                    }.show(childFragmentManager,"HandleDialogFragment")
                 }
             })
 

+ 25 - 34
home/src/main/res/layout/fragment_mine.xml

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

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

@@ -20,6 +20,7 @@ class AudioSeatAdapter :
     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)
@@ -31,8 +32,8 @@ class AudioSeatAdapter :
                         itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                             .loadImage(R.mipmap.ic_audio_seat)
                     }
+                    svgAvatar.visibility = View.INVISIBLE
                 } else {
-                    val svgAvatar = itemView.findViewById<SVGAImageView>(R.id.svgAvatar)
                     itemView.findViewById<SwagoImageView>(R.id.ivImageView)
                         .loadImage(it.user_head_img_url ?: "")
                     setText(R.id.tvName, it.user_name)

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

@@ -473,26 +473,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).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")
+                    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")
         }
@@ -522,16 +522,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)
 
-                }
+            }
         }
 
         //直播间配置
@@ -641,6 +641,10 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             userVm.getUserInfo()
         }
 
+        msgVm.joinRoomFun = {
+            binding.xSvgaPlayer.playJoinRoomSvga(it.androidJoinSpecial)
+        }
+
         userVm.userInfoLiveData.observe(this) {
             UserInfo.setUserInfo(it)
             SpUtil.putString("user_info", Gson().toJson(it))

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

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

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

@@ -91,6 +91,7 @@ class GiftDanDaoView : FrameLayout {
                 .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)
@@ -100,6 +101,8 @@ class GiftDanDaoView : FrameLayout {
                     override fun onError() {
                     }
                 })
+            } else {
+                svgAvatar.visibility =View.GONE
             }
 
             tvSenderName.text = imGiftModel.senderName

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

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

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

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

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

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

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

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

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

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