Stop playback when deleting record on locked mode.
This commit is contained in:
parent
a11941714d
commit
bd2ed4c58a
|
@ -631,6 +631,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun handleEndRecordingVoiceMessage(isCancelled: Boolean) {
|
||||
voiceMessageHelper.stopPlayback()
|
||||
if (isCancelled) {
|
||||
voiceMessageHelper.deleteRecording()
|
||||
} else {
|
||||
|
|
|
@ -93,6 +93,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||
*/
|
||||
fun pauseRecording() {
|
||||
voiceRecorder.stopRecord()
|
||||
stopRecordingAmplitudes()
|
||||
}
|
||||
|
||||
fun deleteRecording() {
|
||||
|
@ -112,6 +113,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||
|
||||
fun startOrPausePlayback(id: String, file: File) {
|
||||
stopPlayback()
|
||||
stopRecordingAmplitudes()
|
||||
if (playbackTracker.getPlaybackState(id) is VoiceMessagePlaybackTracker.Listener.State.Playing) {
|
||||
playbackTracker.pausePlayback(id)
|
||||
} else {
|
||||
|
@ -145,7 +147,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||
startPlaybackTicker(id)
|
||||
}
|
||||
|
||||
private fun stopPlayback() {
|
||||
fun stopPlayback() {
|
||||
mediaPlayer?.stop()
|
||||
stopPlaybackTicker()
|
||||
}
|
||||
|
|
|
@ -415,6 +415,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||
val formattedTimerText = DateUtils.formatElapsedTime((state.playbackTime / 1000).toLong())
|
||||
views.voicePlaybackTime.text = formattedTimerText
|
||||
}
|
||||
is VoiceMessagePlaybackTracker.Listener.State.Paused,
|
||||
is VoiceMessagePlaybackTracker.Listener.State.Idle -> {
|
||||
views.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_play)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue