全屏视频自定义
This commit is contained in:
@@ -9,6 +9,7 @@ import com.example.defenseapplication.databinding.ActivityStartBinding
|
||||
import com.example.defenseapplication.login.LoginActivity
|
||||
import com.example.defenseapplication.utils.ApiConfig
|
||||
import com.example.defenseapplication.utils.UserinfoUtil
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
|
||||
class StartActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityStartBinding
|
||||
@@ -17,6 +18,10 @@ class StartActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityStartBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
ImmersionBar.with(this)
|
||||
.statusBarDarkFont(true)
|
||||
.titleBar(null)
|
||||
.init()
|
||||
|
||||
// 延迟2秒后再判断登录状态
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener
|
||||
import com.example.defenseapplication.view.MyGSYVideoPlayer
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -48,6 +49,10 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = AlarmLogActivityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
ImmersionBar.with(this)
|
||||
.statusBarDarkFont(true)
|
||||
.titleBar(null)
|
||||
.init()
|
||||
audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
|
||||
deviceId = intent.getStringExtra("device_id")
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.example.defenseapplication.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import com.example.defenseapplication.R
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer
|
||||
|
||||
class MyGSYVideoPlayerLive @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
@@ -17,4 +20,66 @@ class MyGSYVideoPlayerLive @JvmOverloads constructor(
|
||||
override fun updateStartImage() {
|
||||
startButton.visibility = View.GONE
|
||||
}
|
||||
override fun startWindowFullscreen(
|
||||
context: Context?,
|
||||
actionBar: Boolean,
|
||||
statusBar: Boolean
|
||||
): GSYBaseVideoPlayer {
|
||||
|
||||
val player = super.startWindowFullscreen(
|
||||
context,
|
||||
actionBar,
|
||||
statusBar
|
||||
) as MyGSYVideoPlayerLive
|
||||
|
||||
// 隐藏GSY自带UI
|
||||
player.backButton.visibility = View.GONE
|
||||
player.titleTextView.visibility = View.GONE
|
||||
player.startButton.visibility = View.GONE
|
||||
player.fullscreenButton.visibility = View.GONE
|
||||
|
||||
player.findViewById<View>(
|
||||
com.shuyu.gsyvideoplayer.R.id.current
|
||||
)?.visibility = View.GONE
|
||||
|
||||
player.findViewById<View>(
|
||||
com.shuyu.gsyvideoplayer.R.id.total
|
||||
)?.visibility = View.GONE
|
||||
|
||||
player.findViewById<View>(
|
||||
com.shuyu.gsyvideoplayer.R.id.progress
|
||||
)?.visibility = View.GONE
|
||||
|
||||
player.findViewById<View>(
|
||||
com.shuyu.gsyvideoplayer.R.id.layout_bottom
|
||||
)?.visibility = View.GONE
|
||||
|
||||
player.findViewById<View>(
|
||||
com.shuyu.gsyvideoplayer.R.id.layout_top
|
||||
)?.visibility = View.GONE
|
||||
|
||||
// 加载你的全屏覆盖层
|
||||
val overlay = LayoutInflater.from(context)
|
||||
.inflate(
|
||||
R.layout.layout_my_player,
|
||||
player,
|
||||
false
|
||||
)
|
||||
|
||||
player.addView(overlay)
|
||||
|
||||
// 找按钮
|
||||
overlay.findViewById<View>(R.id.btnAi)
|
||||
?.setOnClickListener {
|
||||
|
||||
}
|
||||
|
||||
overlay.findViewById<View>(R.id.btnCapture)
|
||||
?.setOnClickListener {
|
||||
|
||||
}
|
||||
|
||||
return player
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user