Fix long name jitter as voice note position updates.
This commit is contained in:
parent
5b99f590f8
commit
ff76c5fca5
3 changed files with 30 additions and 7 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,23 +20,40 @@
|
|||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/voice_note_player_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:minHeight="36dp"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="13dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
||||
android:textColor="@color/signal_icon_tint_primary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/voice_note_player_speed_touch_target"
|
||||
app:layout_constraintEnd_toStartOf="@id/voice_note_player_duration"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@id/voice_note_player_play_pause_toggle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Miles Morales in Some strange spider-man group · 5:20" />
|
||||
tools:text="Miles Morales Admiration Station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/voice_note_player_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="36dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="13dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/signal_icon_tint_primary"
|
||||
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/voice_note_player_speed_touch_target"
|
||||
app:layout_constraintStart_toEndOf="@id/voice_note_player_info"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="· 1:00" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/voice_note_player_speed_touch_target"
|
||||
|
|
|
@ -3759,7 +3759,7 @@
|
|||
<string name="ContactFilterView__search_name_or_number">Search name or number</string>
|
||||
|
||||
<!-- VoiceNotePlayerView -->
|
||||
<string name="VoiceNotePlayerView__s_dot_s">%1$s · %2$s</string>
|
||||
<string name="VoiceNotePlayerView__dot_s">· %1$s</string>
|
||||
<string name="VoiceNotePlayerView__stop_voice_message">Stop voice message</string>
|
||||
<string name="VoiceNotePlayerView__change_voice_message_speed">Change voice message speed</string>
|
||||
<string name="VoiceNotePlayerView__pause_voice_message">Pause voice message</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue