|
@@ -1,30 +1,28 @@
|
|
package com.swago.room.anchor
|
|
package com.swago.room.anchor
|
|
|
|
|
|
|
|
+import android.Manifest
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
-import android.os.Bundle
|
|
|
|
-import android.util.Log
|
|
|
|
|
|
+import android.os.Build
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
import android.view.WindowManager
|
|
import android.view.WindowManager
|
|
|
|
+import android.widget.Toast
|
|
import androidx.activity.viewModels
|
|
import androidx.activity.viewModels
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
import androidx.core.content.ContextCompat
|
|
import androidx.core.content.ContextCompat
|
|
import androidx.lifecycle.lifecycleScope
|
|
import androidx.lifecycle.lifecycleScope
|
|
-import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
|
-import androidx.recyclerview.widget.RecyclerView
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
import com.gyf.immersionbar.ImmersionBar
|
|
import com.gyf.immersionbar.ImmersionBar
|
|
|
|
+import com.permissionx.guolindev.PermissionX
|
|
import com.swago.baseswago.SwagoAdapter
|
|
import com.swago.baseswago.SwagoAdapter
|
|
import com.swago.baseswago.agora.AgoraManager
|
|
import com.swago.baseswago.agora.AgoraManager
|
|
import com.swago.baseswago.agora.ISwagoIRtcEngineEventHandler
|
|
import com.swago.baseswago.agora.ISwagoIRtcEngineEventHandler
|
|
import com.swago.baseswago.baseroom.IRoomInfo
|
|
import com.swago.baseswago.baseroom.IRoomInfo
|
|
-import com.swago.baseswago.baseroom.RoleType
|
|
|
|
import com.swago.baseswago.baseroom.SwagoRoomManager
|
|
import com.swago.baseswago.baseroom.SwagoRoomManager
|
|
import com.swago.baseswago.baseroom.ui.AbsAnchorActivity
|
|
import com.swago.baseswago.baseroom.ui.AbsAnchorActivity
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
import com.swago.baseswago.constant.ARouteConstant
|
|
import com.swago.baseswago.dialog.ChoiceDialogFragment
|
|
import com.swago.baseswago.dialog.ChoiceDialogFragment
|
|
import com.swago.baseswago.model.live.audio.AudioBg
|
|
import com.swago.baseswago.model.live.audio.AudioBg
|
|
-import com.swago.baseswago.model.live.audio.AudioBgModel
|
|
|
|
import com.swago.baseswago.model.live.audio.AudioSeatModel
|
|
import com.swago.baseswago.model.live.audio.AudioSeatModel
|
|
import com.swago.baseswago.model.live.audio.IMAudioModel
|
|
import com.swago.baseswago.model.live.audio.IMAudioModel
|
|
import com.swago.baseswago.model.live.pk.ProcessPKModel
|
|
import com.swago.baseswago.model.live.pk.ProcessPKModel
|
|
@@ -35,10 +33,8 @@ import com.swago.baseswago.util.AppContext
|
|
import com.swago.baseswago.util.DpPxUtil
|
|
import com.swago.baseswago.util.DpPxUtil
|
|
import com.swago.baseswago.util.NoDoubleClickListener
|
|
import com.swago.baseswago.util.NoDoubleClickListener
|
|
import com.swago.baseswago.util.UserInfo
|
|
import com.swago.baseswago.util.UserInfo
|
|
-import com.swago.loadUrl
|
|
|
|
import com.swago.loadUrlNoPlaceHolder
|
|
import com.swago.loadUrlNoPlaceHolder
|
|
import com.swago.room.R
|
|
import com.swago.room.R
|
|
-import com.swago.room.adapter.GameAdapter
|
|
|
|
import com.swago.room.audio.AudioRoomManager
|
|
import com.swago.room.audio.AudioRoomManager
|
|
import com.swago.room.audio.IAudioRoomListener
|
|
import com.swago.room.audio.IAudioRoomListener
|
|
import com.swago.room.base.NoContentFragment
|
|
import com.swago.room.base.NoContentFragment
|
|
@@ -179,13 +175,38 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
|
|
|
binding.tvStartLive.setOnClickListener(object : NoDoubleClickListener() {
|
|
binding.tvStartLive.setOnClickListener(object : NoDoubleClickListener() {
|
|
override fun onClick() {
|
|
override fun onClick() {
|
|
- binding.tvStartLive.isEnabled = false
|
|
|
|
- val userModel = UserRoomModel()
|
|
|
|
- userModel.roomType = roomType
|
|
|
|
- userModel.selectedBgUrl = selectedBgUrl
|
|
|
|
- SwagoRoomManager.changeRoom(userModel)
|
|
|
|
- if (roomType == RoomType.VIDEO){
|
|
|
|
- anchorRoomFragment?.setAudioRvState(false)
|
|
|
|
|
|
+
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
|
+ PermissionX.init(this@AnchorRoomActivity)
|
|
|
|
+ .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)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ binding.tvStartLive.isEnabled = true
|
|
|
|
+ Toast.makeText(
|
|
|
|
+ AppContext.getContext(),
|
|
|
|
+ "These permissions are denied: $deniedList",
|
|
|
|
+ Toast.LENGTH_LONG
|
|
|
|
+ ).show()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ binding.tvStartLive.isEnabled = false
|
|
|
|
+ val userModel = UserRoomModel()
|
|
|
|
+ userModel.roomType = roomType
|
|
|
|
+ userModel.selectedBgUrl = selectedBgUrl
|
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|