视频组件优化
This commit is contained in:
@@ -53,7 +53,7 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
setContentView(binding.root)
|
||||
ImmersionBar.with(this)
|
||||
.statusBarDarkFont(true)
|
||||
.titleBar(binding.exoPlayContextId)
|
||||
.transparentStatusBar()
|
||||
.init()
|
||||
|
||||
deviceId = intent.getStringExtra("device_id")
|
||||
@@ -128,11 +128,15 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
val playerView = findPlayerView(binding.exoPlayContextId)
|
||||
playerView?.setControllerVisibilityListener { visibility ->
|
||||
if (visibility == View.VISIBLE) {
|
||||
binding.ivBack.visibility = View.VISIBLE
|
||||
binding.muteBar.visibility = View.VISIBLE
|
||||
binding.functionBar.visibility = View.VISIBLE
|
||||
binding.ivDownload.visibility = View.VISIBLE
|
||||
binding.ivDelete.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.ivBack.visibility = View.GONE
|
||||
binding.muteBar.visibility = View.GONE
|
||||
binding.functionBar.visibility = View.GONE
|
||||
binding.ivDownload.visibility = View.GONE
|
||||
binding.ivDelete.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,6 +259,10 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
binding.ivBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
|
||||
binding.expandImg.setOnClickListener {
|
||||
showDatePicker()
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.activity.OnBackPressedCallback
|
||||
import chuangyuan.ycj.videolibrary.listener.VideoInfoListener
|
||||
import chuangyuan.ycj.videolibrary.video.VideoPlayerManager
|
||||
import android.view.View
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
class LiveVideoActivity : BaseActivity() {
|
||||
private lateinit var binding: LiveVideoActivityBinding
|
||||
@@ -291,11 +292,9 @@ class LiveVideoActivity : BaseActivity() {
|
||||
isVoiceEnabled = !isVoiceEnabled
|
||||
|
||||
if (isVoiceEnabled) {
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
|
||||
Toast.makeText(this, R.string.sound_on, Toast.LENGTH_SHORT).show()
|
||||
Glide.with(this).asGif().load(com.example.defenseapplication.R.drawable.voice_on_open).into(binding.ivVoice)
|
||||
} else {
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice)
|
||||
Toast.makeText(this, R.string.sound_off, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,10 +303,8 @@ class LiveVideoActivity : BaseActivity() {
|
||||
|
||||
if (isLightOn) {
|
||||
binding.ivLight.setImageResource(com.example.defenseapplication.R.drawable.light_on_open)
|
||||
Toast.makeText(this, R.string.light_on, Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
binding.ivLight.setImageResource(com.example.defenseapplication.R.drawable.light_on)
|
||||
Toast.makeText(this, R.string.light_off, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,12 +338,10 @@ class LiveVideoActivity : BaseActivity() {
|
||||
binding.llAlarmLog.visibility = View.GONE
|
||||
binding.consoleBar.visibility = View.VISIBLE
|
||||
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
|
||||
Glide.with(this).asGif().load(com.example.defenseapplication.R.drawable.voice_on_open).into(binding.ivVoice)
|
||||
isVoiceEnabled = true
|
||||
|
||||
startVoiceRecording()
|
||||
|
||||
Toast.makeText(this, R.string.start_control_mode, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun stopRecordingMode() {
|
||||
@@ -361,8 +356,6 @@ class LiveVideoActivity : BaseActivity() {
|
||||
|
||||
stopVoiceRecording()
|
||||
stopMicPulseAnimation()
|
||||
|
||||
Toast.makeText(this, R.string.stop_control_mode, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun stopMicPulseAnimation() {
|
||||
|
||||
5
app/src/main/res/drawable/selector_down.xml
Normal file
5
app/src/main/res/drawable/selector_down.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/down2" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/down" />
|
||||
</selector>
|
||||
5
app/src/main/res/drawable/selector_left.xml
Normal file
5
app/src/main/res/drawable/selector_left.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/left2" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/left" />
|
||||
</selector>
|
||||
5
app/src/main/res/drawable/selector_right.xml
Normal file
5
app/src/main/res/drawable/selector_right.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/right2" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/right" />
|
||||
</selector>
|
||||
5
app/src/main/res/drawable/selector_up.xml
Normal file
5
app/src/main/res/drawable/selector_up.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/up2" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/up" />
|
||||
</selector>
|
||||
@@ -19,16 +19,29 @@
|
||||
android:layout_height="280dp"
|
||||
android:background="@android:color/transparent"
|
||||
app:use_controller="true" />
|
||||
<!-- 右上角按钮区域 - 下载和删除横向排列 -->
|
||||
|
||||
<!-- 自定义顶部栏 - 返回、下载、删除在同一行 -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="20dp"
|
||||
android:id="@+id/functionBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|end"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_gravity="top"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBack"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/back_white"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivDownload"
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/consoleBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFFFFF"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
|
||||
Reference in New Issue
Block a user