设置
This commit is contained in:
@@ -282,7 +282,7 @@ class LiveVideoActivity : AppCompatActivity(), SurfaceHolder.Callback {
|
||||
|
||||
if (isVoiceEnabled) {
|
||||
mediaPlayer?.setVolume(1.0f, 1.0f)
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_open)
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
|
||||
Toast.makeText(this, "声音已开启", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
mediaPlayer?.setVolume(0.0f, 0.0f)
|
||||
@@ -335,14 +335,14 @@ class LiveVideoActivity : AppCompatActivity(), SurfaceHolder.Callback {
|
||||
binding.consoleBar.visibility = View.VISIBLE
|
||||
|
||||
// 麦克风切换成开启状态
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_open)
|
||||
binding.ivVoice.setImageResource(com.example.defenseapplication.R.drawable.voice_on_open)
|
||||
isVoiceEnabled = true
|
||||
|
||||
// 启动语音录制
|
||||
startVoiceRecording()
|
||||
|
||||
// 启动麦克风脉冲动画
|
||||
startMicPulseAnimation()
|
||||
//startMicPulseAnimation()
|
||||
|
||||
Toast.makeText(this, "开始控制模式", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
@@ -367,22 +367,22 @@ class LiveVideoActivity : AppCompatActivity(), SurfaceHolder.Callback {
|
||||
|
||||
Toast.makeText(this, "停止控制模式", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun startMicPulseAnimation() {
|
||||
micPulseAnimation = ScaleAnimation(
|
||||
1.0f, 1.3f,
|
||||
1.0f, 1.3f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f
|
||||
).apply {
|
||||
duration = 500
|
||||
repeatCount = Animation.INFINITE
|
||||
repeatMode = Animation.REVERSE
|
||||
interpolator = LinearInterpolator()
|
||||
}
|
||||
binding.ivVoice.startAnimation(micPulseAnimation)
|
||||
}
|
||||
|
||||
|
||||
// private fun startMicPulseAnimation() {
|
||||
// micPulseAnimation = ScaleAnimation(
|
||||
// 1.0f, 1.3f,
|
||||
// 1.0f, 1.3f,
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f
|
||||
// ).apply {
|
||||
// duration = 500
|
||||
// repeatCount = Animation.INFINITE
|
||||
// repeatMode = Animation.REVERSE
|
||||
// interpolator = LinearInterpolator()
|
||||
// }
|
||||
// binding.ivVoice.startAnimation(micPulseAnimation)
|
||||
// }
|
||||
|
||||
private fun stopMicPulseAnimation() {
|
||||
micPulseAnimation?.let {
|
||||
binding.ivVoice.clearAnimation()
|
||||
|
||||
Reference in New Issue
Block a user