|
@@ -3,7 +3,6 @@ package com.swago.room.anchor
|
|
|
import android.Manifest
|
|
|
import android.content.Intent
|
|
|
import android.os.Build
|
|
|
-import android.os.CountDownTimer
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import android.view.WindowManager
|
|
@@ -33,7 +32,6 @@ import com.swago.baseswago.model.live.pk.StartPKModel
|
|
|
import com.swago.baseswago.model.live.pk.StopPKModel
|
|
|
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
|
|
@@ -47,7 +45,6 @@ import com.swago.room.dialog.AnchorCloseDialog
|
|
|
import com.swago.room.dialog.CanStartLiveDialog
|
|
|
import com.swago.room.dialog.ForceCloseRoomDialog
|
|
|
import com.swago.room.dialog.LiveRestrictionsDialog
|
|
|
-import com.swago.room.dialog.NoFaceShowDialog
|
|
|
import com.swago.room.enum.RoomType
|
|
|
import com.swago.room.lianmai.LianMaiManager
|
|
|
import com.swago.room.lianmai.LianMaiVm
|
|
@@ -88,7 +85,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
private var anchorRoomFragment: AnchorRoomFragment? = null
|
|
|
|
|
|
private var anchorCloseDialog: AnchorCloseDialog? = null
|
|
|
- private var noFaceShowDialog: NoFaceShowDialog? = null
|
|
|
|
|
|
//开播类型 0视频房 1语音房
|
|
|
private var roomType = RoomType.VIDEO
|
|
@@ -102,10 +98,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
private var selectedBgUrl = ""
|
|
|
private var checkPassword = false
|
|
|
|
|
|
- private lateinit var countDownTimer: CountDownTimer
|
|
|
- private var startFaceShowTimer = true
|
|
|
- private var liveNoFaceTime:Long = 600000
|
|
|
-
|
|
|
override fun initLiveData() {
|
|
|
PKStateManager.resetData()
|
|
|
roomVm.init()
|
|
@@ -123,7 +115,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
AgoraManager.setVideoAudio(pullVideo = true, pullAudio = true, pushVideo = true, pushAudio = true)
|
|
|
AgoraManager.setupLocalVideo(this, binding.flLocal)
|
|
|
AgoraManager.enableAudioVolumeIndication()
|
|
|
- AgoraManager.enableFaceDetection(true)
|
|
|
anchorRoomFragment = fragments[1] as AnchorRoomFragment
|
|
|
binding.viewPager.adapter = adapter
|
|
|
|
|
@@ -172,8 +163,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
if (roomType == RoomType.AUDIO) return
|
|
|
AgoraManager.setVideoAudio(pullVideo = false, pullAudio = true, pushVideo = false, pushAudio = true)
|
|
|
roomType = RoomType.AUDIO
|
|
|
- startFaceShowTimer = true
|
|
|
- countDownTimer.cancel()
|
|
|
binding.viewAudio.visibility = View.VISIBLE
|
|
|
binding.viewVideo.visibility = View.INVISIBLE
|
|
|
binding.tvVideo.setTextColor(ContextCompat.getColor(AppContext.getContext(),R.color._d4ffffff))
|
|
@@ -307,7 +296,7 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
}
|
|
|
|
|
|
roomVm.anchorCloseLiveData.observe(this) {
|
|
|
- anchorCloseDialog = AnchorCloseDialog.newInstance(it)
|
|
|
+ anchorCloseDialog = AnchorCloseDialog.newInstance(it,roomType.type,checkPassword)
|
|
|
anchorCloseDialog?.show(supportFragmentManager, "AnchorCloseDialog")
|
|
|
}
|
|
|
|
|
@@ -342,28 +331,9 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
}
|
|
|
})
|
|
|
binding.cbPassword.setOnCheckedChangeListener { _, isChecked ->
|
|
|
- binding.cbPassword.text = if (isChecked) "Password ·NO" else "Password ·OFF"
|
|
|
+ binding.cbPassword.text = if (isChecked) getString(R.string.lock_room_on) else getString(R.string.lock_room_off)
|
|
|
checkPassword = isChecked
|
|
|
}
|
|
|
- countDownTimer = object : CountDownTimer(liveNoFaceTime, 60000) {
|
|
|
- override fun onTick(millisUntilFinished: Long) {
|
|
|
- LogUtil.d("millisUntilFinished${millisUntilFinished / 1000}")
|
|
|
- if (millisUntilFinished/1000 in 58L..60L ){
|
|
|
- LogUtil.d("millisUntilFinished:show")
|
|
|
- if (noFaceShowDialog == null){
|
|
|
- noFaceShowDialog = NoFaceShowDialog.newInstance()
|
|
|
- }
|
|
|
- noFaceShowDialog?.show(supportFragmentManager , "NoFaceShowDialog")
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- override fun onFinish() {
|
|
|
- roomVm.uploadBroadcast()
|
|
|
- noFaceShowDialog?.dismissAllowingStateLoss()
|
|
|
- SwagoRoomManager.closeRoom()
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -422,7 +392,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
anchorCloseDialog = null
|
|
|
- noFaceShowDialog = null
|
|
|
PKStateManager.removePKListener(this)
|
|
|
AudioRoomManager.removeListener(this)
|
|
|
agoraService?.let { stopService(it) }
|
|
@@ -470,17 +439,7 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
imageHeight: Int,
|
|
|
faces: Array<out IRtcEngineEventHandler.AgoraFacePositionInfo>?
|
|
|
) {
|
|
|
- LogUtil.d("onFacePositionChanged${faces?.size}")
|
|
|
- if (faces.isNullOrEmpty()){
|
|
|
- if (startFaceShowTimer){
|
|
|
- countDownTimer.start()
|
|
|
- startFaceShowTimer = false
|
|
|
- }
|
|
|
- } else {
|
|
|
- startFaceShowTimer = true
|
|
|
- countDownTimer.cancel()
|
|
|
- noFaceShowDialog?.dismissAllowingStateLoss()
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**************************PK******************************/
|