Browse Source

fix: 主播底部弹窗 game背景图

tongmengxiao 6 tháng trước cách đây
mục cha
commit
d7da59782d

+ 26 - 7
room/src/main/java/com/swago/room/anchor/AnchorRoomFragment.kt

@@ -17,6 +17,7 @@ import com.swago.room.R
 import com.swago.room.base.BaseComFragment
 import com.swago.room.databinding.FragmentBaseComBinding
 import com.swago.room.dialog.AudioNoticeDialog
+import com.swago.room.dialog.FooterMoreDialog
 import com.swago.room.game.GameListDialog
 import com.swago.room.gift.GiftDialog
 import com.swago.room.hongbao.RedEnvelopeDialog
@@ -93,17 +94,14 @@ class AnchorRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
             openLianMaiListDialog()
         }
 
-        footerView?.clearJiFen = {
-            ChoiceDialogFragment.newInstance(AppContext.getContext().resources.getString(R.string.ji_fen_to_zero)).apply {
-                this.sureFun = {
-                    roomVm.clearJiFen()
-                }
-            }.show(childFragmentManager,"ChoiceDialogFragment")
-        }
         footerView?.openAudioNoticeDialogFun = {
             AudioNoticeDialog.newInstance().show(childFragmentManager,"AudioNoticeDialog")
         }
 
+        footerView?.openLocalMusicFun = {
+            openMusicDialog()
+        }
+
         footerView?.openGiftPanelFun = {
             //打开礼物列表
             SwagoRoomManager.iRoomInfo?.let {
@@ -176,6 +174,27 @@ class AnchorRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
     }
 
 
+    private fun openMoreDialog(){
+        FooterMoreDialog.newInstance(unReadNum).apply {
+            openMessageFun = {
+                openMessageListDialog()
+            }
+            openShareFun = {
+                openShareDialog()
+            }
+            openMusicFun = {
+                openMusicDialog()
+            }
+            clearJifenFun = {
+                ChoiceDialogFragment.newInstance(AppContext.getContext().resources.getString(R.string.ji_fen_to_zero)).apply {
+                    this.sureFun = {
+                        roomVm.clearJiFen()
+                    }
+                }.show(this@AnchorRoomFragment.childFragmentManager,"ChoiceDialogFragment")
+            }
+        }.show(childFragmentManager , "FooterMoreDialog")
+    }
+
     override fun changeRoom(iRoomInfo: IRoomInfo) {
         super.changeRoom(iRoomInfo)
     }

+ 0 - 14
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -783,20 +783,6 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         dialog?.show(childFragmentManager, "SendMsgDialog")
     }
 
-    fun openMoreDialog(){
-        FooterMoreDialog.newInstance(unReadNum).apply {
-            openMessageFun = {
-                openMessageListDialog()
-            }
-            openShareFun = {
-                openShareDialog()
-            }
-            openMusicFun = {
-                openMusicDialog()
-            }
-        }.show(childFragmentManager , "FooterMoreDialog")
-    }
-
     fun openMessageListDialog() {
         msgListDialog = MessageListDialog.newInstance()
         msgListDialog?.show(childFragmentManager, "MessageListDialog")

+ 13 - 1
room/src/main/java/com/swago/room/dialog/FooterMoreDialog.kt

@@ -19,6 +19,7 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
     var openMessageFun:(()->Unit)? = null
     var openShareFun:(()->Unit)? = null
     var openMusicFun:(()->Unit)? = null
+    var clearJifenFun:(()->Unit)? = null
 
     init {
         setGravity(Gravity.BOTTOM)
@@ -50,6 +51,13 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
                 binding.tvNum.visibility = View.GONE
             }
         }
+        SwagoRoomManager.iRoomInfo?.let{
+            if (it.getRoomType() == 2){
+                binding.ivClearJifen.visibility = View.VISIBLE
+            } else if (it.getRoomType() == 1){
+                binding.ivVideoMusic.visibility = View.VISIBLE
+            }
+        }
         binding.ivMessage.setOnClickListener {
             openMessageFun?.invoke()
             dismissAllowingStateLoss()
@@ -58,9 +66,13 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
             openShareFun?.invoke()
             dismissAllowingStateLoss()
         }
-        binding.ivMusic.setOnClickListener{
+        binding.ivVideoMusic.setOnClickListener{
             openMusicFun?.invoke()
             dismissAllowingStateLoss()
         }
+        binding.ivClearJifen.setOnClickListener {
+            clearJifenFun?.invoke()
+            dismissAllowingStateLoss()
+        }
     }
 }

+ 17 - 1
room/src/main/java/com/swago/room/game/GamePlayDialog.kt

@@ -10,6 +10,7 @@ import android.widget.FrameLayout
 import com.alibaba.android.arouter.launcher.ARouter
 import android.widget.ImageView
 import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.constraintlayout.widget.ConstraintSet
 import androidx.lifecycle.lifecycleScope
 import com.google.gson.Gson
 import com.swago.baseswago.baseroom.IRoomActiveListener
@@ -101,6 +102,10 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
                     binding.ivBg.setBackgroundResource(R.mipmap.bg_lucky_piggy)
                 "8" ->
                     binding.ivBg.setBackgroundResource(R.mipmap.bg_magical_piggy)
+                "9" ->{
+                    setDimensionRatio("H,75:74")
+                    binding.ivBg.setBackgroundResource(R.mipmap.bg_tigers)
+                }
             }
             url = it.getString(URL, "")
             if (url.startsWith("file://")){
@@ -114,7 +119,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)
@@ -248,6 +257,13 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
 
     override fun initLiveData() {}
 
+    private fun setDimensionRatio(ratio: String) {
+        val constraintLayout = binding.cl
+        val constraintSet = ConstraintSet()
+        constraintSet.clone(constraintLayout)
+        constraintSet.setDimensionRatio(binding.ivBg.id, ratio)
+        constraintSet.applyTo(constraintLayout)
+    }
 
     inner class JSLoad {
 

+ 1 - 1
room/src/main/java/com/swago/room/music/MusicVm.kt

@@ -20,7 +20,7 @@ class MusicVm(application: Application) : BaseViewModel(application) {
     val selection = "${MediaStore.Audio.Media.SIZE} >= ? " +
             "and ${MediaStore.Audio.Media.DURATION} >= ? " +
             "and ${MediaStore.Audio.Artists.ARTIST} != ?"
-    val electionArgs = arrayOf("1000000", "200000", "Unknown Artist")
+    val electionArgs = arrayOf("1000", "30000", "Unknown Artist")
     val sortOrder = "${MediaStore.Audio.Media._ID} DESC"
 
     val musicListData by lazy {

+ 4 - 0
room/src/main/java/com/swago/room/music/MyMusicAdapter.kt

@@ -1,6 +1,7 @@
 package com.swago.room.music
 
 import android.view.View
+import android.widget.ImageView
 import com.chad.library.adapter.base.BaseQuickAdapter
 import com.chad.library.adapter.base.BaseViewHolder
 import com.opensource.svgaplayer.SVGAImageView
@@ -16,11 +17,14 @@ class MyMusicAdapter :
             setText(R.id.tvDuration, String.format("%02d:%02d", item.duration / 60000, (item.duration % 60000) / 1000))
             addOnClickListener(R.id.ivRecall)
             val svgaImageView = itemView.findViewById<SVGAImageView>(R.id.svgaImageView)
+            val ivPlay = itemView.findViewById<ImageView>(R.id.ivPlay)
             if (item.getIsPlaying()){
                 svgaImageView.visibility = View.VISIBLE
+                ivPlay.setImageResource(R.mipmap.ic_music_play)
                 svgaImageView.startAnimation()
             } else {
                 svgaImageView.visibility = View.INVISIBLE
+                ivPlay.setImageResource(R.mipmap.ic_music_stop)
                 svgaImageView.stopAnimation()
             }
         }

+ 4 - 4
room/src/main/java/com/swago/room/widget/AnchorFooterView.kt

@@ -35,9 +35,9 @@ class AnchorFooterView : ConstraintLayout, IFooter, IRoomActiveListener {
     var switchCameraFun:(()->Unit)? = null
     var openPKFun:(()->Unit)? = null
     var openLianMaiFun:(()->Unit)? = null
-    var clearJiFen:(()->Unit)? = null
     var openAudioNoticeDialogFun:(()->Unit)? = null
     var openGiftPanelFun:(()->Unit)? = null
+    var openLocalMusicFun:(()->Unit)? = null
     var isMute = false
 
     constructor(context: Context) : this(context, null)
@@ -131,9 +131,9 @@ class AnchorFooterView : ConstraintLayout, IFooter, IRoomActiveListener {
             }
         })
 
-        binding.ivClearJifen.setOnClickListener(object : NoDoubleClickListener() {
+        binding.ivAudioMusic.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
-                clearJiFen?.invoke()
+                openLocalMusicFun?.invoke()
             }
         })
 
@@ -166,7 +166,7 @@ class AnchorFooterView : ConstraintLayout, IFooter, IRoomActiveListener {
             binding.ivPK.visibility = View.GONE
             binding.ivLianMai.visibility = View.GONE
             binding.ivMute.visibility = View.GONE
-            binding.ivClearJifen.visibility = View.VISIBLE
+            binding.ivAudioMusic.visibility = View.VISIBLE
             binding.ivNotice.visibility = View.VISIBLE
             binding.ivGift.visibility = View.VISIBLE
         }

+ 17 - 1
room/src/main/res/layout/dialog_footer_more.xml

@@ -56,12 +56,28 @@
         android:layout_height="40dp"/>
 
         <ImageView
-            android:id="@+id/ivMusic"
+            android:id="@+id/ivClearJifen"
             android:layout_marginStart="16dp"
             android:background="@drawable/shape_80000000_20"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintStart_toEndOf="@+id/ivShare"
+            android:src="@mipmap/ic_clear_jifen"
+            android:visibility="gone"
+            tools:visibility="visible"
+            android:padding="6dp"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_width="40dp"
+            android:layout_height="40dp"/>
+
+        <ImageView
+            android:id="@+id/ivVideoMusic"
+            android:layout_marginStart="16dp"
+            android:background="@drawable/shape_80000000_20"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/ivClearJifen"
             android:src="@mipmap/live_music"
+            android:visibility="gone"
+            tools:visibility="visible"
             android:padding="6dp"
             android:layout_marginTop="@dimen/dp_10"
             android:layout_width="40dp"

+ 25 - 14
room/src/main/res/layout/item_my_music.xml

@@ -6,17 +6,12 @@
     android:layout_width="match_parent"
     android:layout_height="70dp">
 
-    <com.opensource.svgaplayer.SVGAImageView
-        android:id="@+id/svgaImageView"
-        android:layout_height="18dp"
-        android:layout_width="18dp"
-        app:source="music.svga"
-        app:autoPlay="true"
-        app:loopCount="0"
-        android:visibility="invisible"
-        android:background="#fff"
-        android:layout_marginTop="-16dp"
-        android:layout_marginStart="16dp"
+    <ImageView
+        android:id="@+id/ivPlay"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingStart="16dp"
+        android:src="@mipmap/ic_music_stop"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"/>
@@ -25,8 +20,9 @@
         android:id="@+id/tvName"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        app:layout_constraintLeft_toRightOf="@+id/svgaImageView"
-        app:layout_constraintTop_toTopOf="@+id/svgaImageView"
+        app:layout_constraintLeft_toRightOf="@+id/ivPlay"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_marginTop="16dp"
         android:layout_marginEnd="@dimen/dp_40"
         android:lines="1"
         android:maxWidth="200dp"
@@ -36,11 +32,26 @@
         android:textColor="#131b23"
         android:layout_marginStart="@dimen/dp_10"/>
 
+    <com.opensource.svgaplayer.SVGAImageView
+        android:id="@+id/svgaImageView"
+        android:layout_height="18dp"
+        android:layout_width="18dp"
+        app:source="music.svga"
+        app:autoPlay="true"
+        app:loopCount="0"
+        android:visibility="invisible"
+        android:background="#fff"
+        android:layout_marginTop="16dp"
+        android:layout_marginStart="16dp"
+        app:layout_constraintStart_toEndOf="@+id/tvName"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent"/>
+
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tvDuration"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        app:layout_constraintLeft_toRightOf="@+id/svgaImageView"
+        app:layout_constraintLeft_toRightOf="@+id/ivPlay"
         app:layout_constraintTop_toBottomOf="@+id/tvName"
         android:layout_marginStart="@dimen/dp_10"
         android:layout_marginTop="@dimen/dp_4"

+ 3 - 3
room/src/main/res/layout/layout_anchor_footer_view.xml

@@ -105,7 +105,7 @@
         android:layout_marginEnd="10dp"
         android:background="@drawable/shape_80000000_20"
         app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintEnd_toStartOf="@+id/ivClearJifen"
+        app:layout_constraintEnd_toStartOf="@+id/ivAudioMusic"
         android:src="@mipmap/live_notice"
         android:padding="7dp"
         android:visibility="gone"
@@ -114,12 +114,12 @@
         android:layout_height="40dp"/>
 
     <ImageView
-        android:id="@+id/ivClearJifen"
+        android:id="@+id/ivAudioMusic"
         android:layout_marginEnd="10dp"
         android:background="@drawable/shape_80000000_20"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintEnd_toStartOf="@+id/ivMute"
-        android:src="@mipmap/ic_clear_jifen"
+        android:src="@mipmap/live_music"
         android:padding="7dp"
         android:visibility="gone"
         tools:visibility="visible"

BIN
room/src/main/res/mipmap-xxhdpi/bg_tigers.jpg


BIN
room/src/main/res/mipmap-xxhdpi/ic_music_play.png


BIN
room/src/main/res/mipmap-xxhdpi/ic_music_stop.png