[BugFix]点击返回键时如果是初始状态不切换底部按钮

This commit is contained in:
wushaocheng
2023-01-13 18:13:12 +08:00
parent d4b3160591
commit ecce0f35c0
2 changed files with 10 additions and 3 deletions

View File

@@ -118,7 +118,6 @@ class SoundViewModel : BaseViewModel() {
private fun showRecordingState() {
audioState = STATE_RECORD_RECORDING
_refreshLiveData.value = audioState
_startChronometerLiveData.value = null
audioRecorder =
audioManager?.getAudioRecorder(BaseApp.getContext(), object : IAudioRecordCallback {
override fun onRecordReady() {
@@ -127,6 +126,7 @@ class SoundViewModel : BaseViewModel() {
override fun onRecordStart(audioFile: File, recordType: RecordType) {
Log.d(TAG, "onRecordStart : " + audioFile.path + "type: " + recordType.name)
_startChronometerLiveData.value = null
}
override fun onRecordSuccess(
@@ -224,7 +224,9 @@ class SoundViewModel : BaseViewModel() {
}
// 正在播放:停止播放
AudioPlayerHelper.get().onPause()
_refreshPlayStatusLiveData.value = false // onPause() 停止播放并显示停止状态(播放按钮)
if(audioState != STATE_RECORD_NORMAL) {
_refreshPlayStatusLiveData.value = false // onPause() 停止播放并显示停止状态(播放按钮)
}
}
/**
@@ -233,7 +235,6 @@ class SoundViewModel : BaseViewModel() {
fun releaseResource() {
audioManager?.release()
AudioPlayerHelper.get().onDestroy()
_refreshPlayStatusLiveData.value = false // onDestroy() 停止播放并显示停止状态(播放按钮)
}
/**

View File

@@ -162,4 +162,10 @@ public class RoundProgressView extends View {
mProgress = progress;
postInvalidate();//重绘
}
//设置总进度
public void setTotalProgress(int totalProgress) {
mTotalProgress = totalProgress;
}
}