Fix bad timer display

This commit is contained in:
Benoit Marty 2021-07-09 21:21:45 +02:00
parent 2c1335a2f5
commit a69ac965b6

View file

@ -69,7 +69,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
private var lastX: Float = 0f private var lastX: Float = 0f
private var lastY: Float = 0f private var lastY: Float = 0f
private var recordingTime: Int = 0 private var recordingTime: Int = -1
private var amplitudeList = emptyList<Int>() private var amplitudeList = emptyList<Int>()
private val recordingTimer = Timer() private val recordingTimer = Timer()
private var recordingTimerTask: TimerTask? = null private var recordingTimerTask: TimerTask? = null
@ -266,7 +266,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
} }
private fun showRecordingTimer() { private fun showRecordingTimer() {
val formattedTimerText = DateUtils.formatElapsedTime((recordingTime).toLong()) val formattedTimerText = DateUtils.formatElapsedTime(recordingTime.toLong())
if (recordingState == RecordingState.LOCKED) { if (recordingState == RecordingState.LOCKED) {
views.voicePlaybackTime.apply { views.voicePlaybackTime.apply {
post { post {
@ -294,7 +294,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
private fun stopRecordingTimer() { private fun stopRecordingTimer() {
recordingTimerTask?.cancel() recordingTimerTask?.cancel()
recordingTime = 0 recordingTime = -1
} }
private fun showRecordingViews() { private fun showRecordingViews() {