Browse Source

feat: delete faceshow

tongmengxiao 5 months ago
parent
commit
cfcdd6cb20

+ 1 - 42
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -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))
@@ -345,25 +334,6 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
             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******************************/

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

@@ -1,58 +0,0 @@
-package com.swago.room.dialog
-
-import android.os.Bundle
-import android.os.CountDownTimer
-import android.view.Gravity
-import com.swago.baseswago.R
-import com.swago.baseswago.dialog.BaseXDFragment
-import com.swago.baseswago.util.AppContext
-import com.swago.room.databinding.DialogHouseGoLiveBinding
-import com.swago.room.databinding.DialogNoFaceShowBinding
-
-class NoFaceShowDialog : BaseXDFragment<DialogNoFaceShowBinding>() {
-
-    private lateinit var countDownTimer: CountDownTimer
-    private val totalTimeInMillis: Long = 60000
-
-    init {
-        setGravity(Gravity.CENTER)
-        setDimAmount(0.5f)
-        setCanCancel(false)
-    }
-
-
-    companion object {
-        fun newInstance(): NoFaceShowDialog {
-            val args = Bundle()
-            val fragment = NoFaceShowDialog()
-            fragment.arguments = args
-            return fragment
-        }
-    }
-
-    override fun initOther() {
-        countDownTimer = object : CountDownTimer(totalTimeInMillis, 1000) {
-            override fun onTick(millisUntilFinished: Long) {
-                val secondsRemaining = millisUntilFinished / 1000
-                binding.tvTime.text =
-                   "00:${secondsRemaining}"
-            }
-
-            override fun onFinish() {
-            }
-
-        }
-        countDownTimer.start()
-
-    }
-
-    override fun initLiveData() {
-
-    }
-
-    override fun onDestroyView() {
-        super.onDestroyView()
-        countDownTimer.cancel()
-    }
-
-}

+ 0 - 86
room/src/main/res/layout/dialog_no_face_show.xml

@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    app:layout_constraintTop_toTopOf="parent"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools">
-
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:background="@drawable/shape_white_20"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginStart="40dp"
-        android:layout_marginEnd="40dp"
-        android:paddingBottom="30dp"
-        android:layout_marginTop="@dimen/dp_40"
-        app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-
-    <com.swago.baseswago.cusview.BoldTextView
-        android:id="@+id/tv_close_title"
-        android:text="@string/system_not_detect_face"
-        android:textColor="#0F172A"
-        android:textSize="18sp"
-        android:textStyle="bold"
-        android:lines="2"
-        android:gravity="center"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginTop="40dp"/>
-
-    <com.swago.baseswago.cusview.MediumTextView
-        android:id="@+id/tv_hint"
-        android:text="@string/live_broadcasrt_will_closed_countdown"
-        android:textColor="#0F172A"
-        android:textSize="14sp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        android:layout_marginTop="12dp"
-        android:gravity="center"
-        app:layout_constraintTop_toBottomOf="@+id/tv_close_title"/>
-
-    <com.swago.baseswago.cusview.BoldTextView
-        android:id="@+id/tv_time"
-        android:layout_width="match_parent"
-        android:layout_height="44dp"
-        android:layout_marginTop="12dp"
-        app:layout_constraintTop_toBottomOf="@+id/tv_hint"
-        app:layout_constraintEnd_toEndOf="parent"
-        android:layout_marginEnd="20dp"
-        android:textColor="#DC2626"
-        android:textSize="26sp"
-        android:text="00:00"
-        android:gravity="center"
-        android:layout_marginBottom="30dp"
-        android:layout_marginStart="30dp"/>
-
-    </androidx.constraintlayout.widget.ConstraintLayout>
-
-    <ImageView
-        android:id="@+id/iv_bg"
-        android:layout_width="match_parent"
-        android:layout_height="100dp"
-        android:background="@mipmap/bg_close_live"
-        android:layout_marginStart="40dp"
-        android:layout_marginEnd="40dp"
-        android:layout_marginTop="@dimen/dp_40"
-        app:layout_constraintTop_toTopOf="parent"/>
-
-    <ImageView
-        android:id="@+id/ivAvatar"
-        android:layout_width="80dp"
-        android:layout_height="80dp"
-        android:src="@mipmap/ic_no_face"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"/>
-
-</androidx.constraintlayout.widget.ConstraintLayout>

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