[m1]
[声音的部分调整]
This commit is contained in:
yangyakun
2023-02-06 10:47:56 +08:00
parent 382fd6b95d
commit 272b1c16e8

View File

@@ -362,9 +362,13 @@ class BusPassengerFunctionSoftFragment :
tv_current_voice_value.text = "$progress%"
if (fromUser) {
mMaxVolume?.let {
var currnetValue = ((progress.toFloat() / 100) * it).toInt()
if(currnetValue <=0){
currnetValue = 1;
}
mAudioManager?.setStreamVolume(
AudioManager.STREAM_MUSIC,
((progress.toFloat() / 100) * it).toInt(),
currnetValue,
AudioManager.FLAG_SHOW_UI
)
}
@@ -389,8 +393,14 @@ class BusPassengerFunctionSoftFragment :
val mCurrentVolume = mAudioManager?.getStreamVolume(AudioManager.STREAM_MUSIC)
mMaxVolume?.let { max ->
mCurrentVolume?.let { current ->
val fl = current.toFloat() / max * 100
sb_voice_bar.progress = fl.toInt()
if(current==1){
sb_voice_bar.progress = 5
tv_current_voice_value.text= "5%"
}else {
val fl = current.toFloat() / max * 100
sb_voice_bar.progress = fl.toInt()
tv_current_voice_value.text= "${fl.toInt()}%"
}
}
}