|
@@ -22,6 +22,7 @@ import com.swago.baseswago.baseroom.SwagoRoomManager
|
|
|
import com.swago.baseswago.baseroom.ui.AbsAnchorActivity
|
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
|
import com.swago.baseswago.dialog.ChoiceDialogFragment
|
|
|
+import com.swago.baseswago.dialog.EnterPasswordDialog
|
|
|
import com.swago.baseswago.model.live.audio.AudioBg
|
|
|
import com.swago.baseswago.model.live.audio.AudioSeatModel
|
|
|
import com.swago.baseswago.model.live.audio.IMAudioModel
|
|
@@ -94,6 +95,7 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
//语音房背景选中第几张
|
|
|
private var selectedBgIndex = 0
|
|
|
private var selectedBgUrl = ""
|
|
|
+ private var checkPassword = false
|
|
|
|
|
|
override fun initLiveData() {
|
|
|
PKStateManager.resetData()
|
|
@@ -181,14 +183,30 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
.permissions(Manifest.permission.POST_NOTIFICATIONS)
|
|
|
.request { allGranted, grantedList, deniedList ->
|
|
|
if (allGranted) {
|
|
|
- binding.tvStartLive.isEnabled = false
|
|
|
- val userModel = UserRoomModel()
|
|
|
- userModel.roomType = roomType
|
|
|
- userModel.selectedBgUrl = selectedBgUrl
|
|
|
- SwagoRoomManager.changeRoom(userModel)
|
|
|
- if (roomType == RoomType.VIDEO){
|
|
|
- anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ if (checkPassword){
|
|
|
+ EnterPasswordDialog.newInstance(1).apply {
|
|
|
+ this.settingPassword = {password ->
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ userModel.selectedBgUrl = selectedBgUrl
|
|
|
+ userModel.password = password
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.show(supportFragmentManager , "EnterPasswordDialog")
|
|
|
+ } else {
|
|
|
+ binding.tvStartLive.isEnabled = false
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ userModel.selectedBgUrl = selectedBgUrl
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
binding.tvStartLive.isEnabled = true
|
|
|
Toast.makeText(
|
|
@@ -199,14 +217,30 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- binding.tvStartLive.isEnabled = false
|
|
|
- val userModel = UserRoomModel()
|
|
|
- userModel.roomType = roomType
|
|
|
- userModel.selectedBgUrl = selectedBgUrl
|
|
|
- SwagoRoomManager.changeRoom(userModel)
|
|
|
- if (roomType == RoomType.VIDEO){
|
|
|
- anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ if (checkPassword){
|
|
|
+ EnterPasswordDialog.newInstance(1).apply {
|
|
|
+ this.settingPassword = {password ->
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ userModel.selectedBgUrl = selectedBgUrl
|
|
|
+ userModel.password = password
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.show(supportFragmentManager , "EnterPasswordDialog")
|
|
|
+ } else {
|
|
|
+ binding.tvStartLive.isEnabled = false
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ userModel.selectedBgUrl = selectedBgUrl
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -287,6 +321,10 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+ binding.cbPassword.setOnCheckedChangeListener { _, isChecked ->
|
|
|
+ binding.cbPassword.text = if (isChecked) "Password ·NO" else "Password ·OFF"
|
|
|
+ checkPassword = isChecked
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|