Fix long name jitter as voice note position updates.

This commit is contained in:
Alex Hart
2021-10-05 10:37:09 -03:00
parent 5b99f590f8
commit ff76c5fca5
3 changed files with 30 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ class VoiceNotePlayerView @JvmOverloads constructor(
private val playPauseToggleView: LottieAnimationView
private val infoView: TextView
private val durationView: TextView
private val speedView: PlaybackSpeedToggleTextView
private val closeButton: View
@@ -49,6 +50,7 @@ class VoiceNotePlayerView @JvmOverloads constructor(
playPauseToggleView = findViewById(R.id.voice_note_player_play_pause_toggle)
infoView = findViewById(R.id.voice_note_player_info)
durationView = findViewById(R.id.voice_note_player_duration)
speedView = findViewById(R.id.voice_note_player_speed)
closeButton = findViewById(R.id.voice_note_player_close)
@@ -116,7 +118,11 @@ class VoiceNotePlayerView @JvmOverloads constructor(
animateToggleToPause()
}
infoView.text = context.getString(R.string.VoiceNotePlayerView__s_dot_s, state.name, formatDuration(state.playbackDuration - state.playbackPosition))
if (infoView.text != state.name) {
infoView.text = state.name
}
durationView.text = context.getString(R.string.VoiceNotePlayerView__dot_s, formatDuration(state.playbackDuration - state.playbackPosition))
speedView.setCurrentSpeed(state.playbackSpeed)
}