Quellcode durchsuchen

feat: 小黑屋开播

tongmengxiao vor 5 Monaten
Ursprung
Commit
5ec93d7db5

+ 3 - 1
baseswago/src/main/java/com/swago/baseswago/model/im/HouseOpenLiveData.kt

@@ -4,5 +4,7 @@ data class HouseOpenLiveData(
     val roomId:String = "",
     val anchorId:String = "",
     val anchorName:String = "",
-    val anchorAvatar:String = ""
+    val anchorAvatar:String = "",
+    val broadcast_password_status:Int = 0,
+    val user_broadcast_type:Int = 0
 )

+ 5 - 2
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -348,15 +348,18 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
         countDownTimer = object : CountDownTimer(liveNoFaceTime, 60000) {
             override fun onTick(millisUntilFinished: Long) {
                 LogUtil.d("millisUntilFinished${millisUntilFinished / 1000}")
-                if (millisUntilFinished/1000 == 60L ){
+                if (millisUntilFinished/1000 in 58L..60L ){
                     LogUtil.d("millisUntilFinished:show")
-                    noFaceShowDialog = NoFaceShowDialog.newInstance()
+                    if (noFaceShowDialog == null){
+                        noFaceShowDialog = NoFaceShowDialog.newInstance()
+                    }
                     noFaceShowDialog?.show(supportFragmentManager , "NoFaceShowDialog")
                 }
             }
 
             override fun onFinish() {
                 roomVm.uploadBroadcast()
+                noFaceShowDialog?.dismissAllowingStateLoss()
                 SwagoRoomManager.closeRoom()
             }
 

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

@@ -579,10 +579,6 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             binding.bannerWishGift.setData(wishGiftData)
         }
 
-        msgVm.openHouseOpenLiveDialog = {
-            HouseGoLiveDialog.newInstance(it.anchorAvatar).show(parentFragmentManager,"HouseGoLiveDialog")
-        }
-
         msgVm.changeNameChangeFun = {
             userVm.getUserInfo()
         }

+ 6 - 2
room/src/main/java/com/swago/room/dialog/HouseGoLiveDialog.kt

@@ -3,6 +3,7 @@ package com.swago.room.dialog
 import android.os.Bundle
 import android.os.CountDownTimer
 import android.view.Gravity
+import com.bumptech.glide.Glide
 import com.swago.baseswago.R
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.util.AppContext
@@ -30,12 +31,15 @@ class HouseGoLiveDialog : BaseXDFragment<DialogHouseGoLiveBinding>() {
 
     override fun initOther() {
         arguments?.let {
-            val msg = it.getString("avatar", "")
-            binding.tvHint.text = msg
+            val avatar = it.getString("avatar", "")
+            Glide.with(this).load(avatar)
+                .placeholder(com.swago.room.R.mipmap.default_avatar)
+                .error(com.swago.room.R.mipmap.default_avatar).into(binding.ivAvatar)
         }
 
         binding.tvGoLive.setOnClickListener {
             goLive?.invoke()
+            dismissAllowingStateLoss()
         }
     }
 

+ 5 - 0
room/src/main/java/com/swago/room/dialog/NoFaceShowDialog.kt

@@ -50,4 +50,9 @@ class NoFaceShowDialog : BaseXDFragment<DialogNoFaceShowBinding>() {
 
     }
 
+    override fun onDestroyView() {
+        super.onDestroyView()
+        countDownTimer.cancel()
+    }
+
 }

+ 17 - 2
room/src/main/java/com/swago/room/user/UserRoomActivity.kt

@@ -1,6 +1,5 @@
 package com.swago.room.user
 
-import android.util.Log
 import android.view.View
 import android.view.ViewGroup
 import android.view.WindowManager
@@ -34,7 +33,11 @@ import com.swago.baseswago.model.live.pk.ProcessPKModel
 import com.swago.baseswago.model.live.pk.PunishPKModel
 import com.swago.baseswago.model.live.pk.StartPKModel
 import com.swago.baseswago.model.live.pk.StopPKModel
-import com.swago.baseswago.util.*
+import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.DpPxUtil
+import com.swago.baseswago.util.LogUtil
+import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.UserInfo
 import com.swago.loadUrlNoPlaceHolder
 import com.swago.room.R
 import com.swago.room.audio.AudioRoomManager
@@ -42,6 +45,7 @@ import com.swago.room.audio.IAudioRoomListener
 import com.swago.room.base.NoContentFragment
 import com.swago.room.bean.UserRoomModel
 import com.swago.room.data.RoomDataManager
+import com.swago.room.dialog.HouseGoLiveDialog
 import com.swago.room.enum.RoomType
 import com.swago.room.lianmai.ILianMaiListener
 import com.swago.room.lianmai.LianMaiManager
@@ -233,6 +237,17 @@ class UserRoomActivity : AbsUserActivity<ActivityAbsRoomUserBinding, UserRoomMod
         lianMaiVm.anchorRefuseUserLianMai = {
             setRvState(true)
         }
+
+        msgVm.openHouseOpenLiveFun = {
+            HouseGoLiveDialog.newInstance(it.anchorAvatar).apply {
+                this.goLive = {
+                    data?.get(position)?.user_broadcast_status = 1
+                    data?.get(position)?.user_broadcast_type = it.user_broadcast_type
+                    data?.get(position)?.broadcast_password_status = it.broadcast_password_status
+                    scrollToPosition(position)
+                }
+            }.show(supportFragmentManager,"HouseGoLiveDialog")
+        }
     }
 
     override fun changeRoom(iRoomInfo: IRoomInfo) {

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

@@ -151,7 +151,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
     /**
      * 开播(小黑屋)
      */
-    var openHouseOpenLiveDialog:((houseOpenLiveData: HouseOpenLiveData)->Unit)? = null
+    var openHouseOpenLiveFun:((houseOpenLiveData: HouseOpenLiveData)->Unit)? = null
 
     var changeNameChangeFun:((data: ChangeNameData) -> Unit)? = null
 
@@ -753,7 +753,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
             SwagoRoomManager.iRoomInfo?.let { iRoomInfo ->
                 it.data?.let {
                     if (it.roomId == iRoomInfo.getRoomId() && iRoomInfo.getRoomType() == RoomType.HOUSE.type && it.anchorId == iRoomInfo.getAnchorId()){
-                        openHouseOpenLiveDialog?.invoke(it)
+                        openHouseOpenLiveFun?.invoke(it)
                     }
                 }
             }

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

@@ -30,7 +30,7 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginTop="40dp"/>
+        android:layout_marginTop="50dp"/>
 
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/tv_hint"