Fix undownloaded voice note button UI bug.

This commit is contained in:
Cody Henthorne
2026-04-28 16:43:00 -04:00
committed by Greyson Parrelli
parent 9d1714d452
commit a951c7edfe
4 changed files with 69 additions and 48 deletions
@@ -63,6 +63,7 @@ public final class AudioView extends FrameLayout {
@NonNull private final AnimatingToggle controlToggle;
@NonNull private final View progressAndPlay;
@NonNull private final LottieAnimationView playPauseButton;
@NonNull private final View downloadContainer;
@NonNull private final ImageView downloadButton;
@Nullable private final ProgressWheel circleProgress;
@NonNull private final SeekBar seekBar;
@@ -121,13 +122,14 @@ public final class AudioView extends FrameLayout {
throw new IllegalStateException("Unsupported mode: " + mode);
}
this.controlToggle = findViewById(R.id.control_toggle);
this.playPauseButton = findViewById(R.id.play);
this.progressAndPlay = findViewById(R.id.progress_and_play);
this.downloadButton = findViewById(R.id.download);
this.circleProgress = findViewById(R.id.circle_progress);
this.seekBar = findViewById(R.id.seek);
this.duration = findViewById(R.id.duration);
this.controlToggle = findViewById(R.id.control_toggle);
this.playPauseButton = findViewById(R.id.play);
this.progressAndPlay = findViewById(R.id.progress_and_play);
this.downloadContainer = findViewById(R.id.download_container);
this.downloadButton = findViewById(R.id.download);
this.circleProgress = findViewById(R.id.circle_progress);
this.seekBar = findViewById(R.id.seek);
this.duration = findViewById(R.id.duration);
lottieDirection = REVERSE;
this.playPauseButton.setOnClickListener(new PlayPauseClickedListener());
@@ -168,6 +170,7 @@ public final class AudioView extends FrameLayout {
public void setProgressAndPlayBackgroundTint(@ColorInt int color) {
progressAndPlay.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
downloadContainer.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
public Observer<VoiceNotePlaybackState> getPlaybackStateObserver() {
@@ -195,7 +198,7 @@ public final class AudioView extends FrameLayout {
}
if (showControls && audio.isPendingDownload()) {
controlToggle.displayQuick(downloadButton);
controlToggle.displayQuick(downloadContainer);
seekBar.setEnabled(false);
downloadButton.setOnClickListener(new DownloadClickedListener(audio));
if (circleProgress != null) {
+20 -11
View File
@@ -41,16 +41,25 @@
</FrameLayout>
<ImageView
android:id="@+id/download"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:src="@drawable/download_attachment"
android:visibility="gone" />
<FrameLayout
android:id="@+id/download_container"
android:background="@drawable/circle_tintable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/download"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:padding="12dp"
android:src="@drawable/symbol_arrow_down_tint_24" />
</FrameLayout>
</org.thoughtcrime.securesms.components.AnimatingToggle>
@@ -32,16 +32,25 @@
</FrameLayout>
<ImageView
android:id="@+id/download"
<FrameLayout
android:id="@+id/download_container"
android:background="@drawable/circle_tintable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:src="@drawable/download_attachment"
android:visibility="gone" />
android:visibility="gone">
<ImageView
android:id="@+id/download"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:padding="7dp"
android:src="@drawable/symbol_arrow_down_tint_24" />
</FrameLayout>
</org.thoughtcrime.securesms.components.AnimatingToggle>
@@ -16,15 +16,6 @@
android:layout_height="match_parent"
android:background="@drawable/circle_tintable">
<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/circle_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:matProg_barColor="@color/white"
app:matProg_linearProgress="true"
app:matProg_spinSpeed="0.333" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/play"
android:layout_width="match_parent"
@@ -40,16 +31,25 @@
</FrameLayout>
<ImageView
android:id="@+id/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:src="@drawable/download_attachment"
android:visibility="gone" />
<FrameLayout
android:id="@+id/download_container"
android:background="@drawable/circle_tintable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/download"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:contentDescription="@string/audio_view__download_accessibility_description"
android:focusable="true"
android:padding="8dp"
android:src="@drawable/symbol_arrow_down_tint_24" />
</FrameLayout>
</org.thoughtcrime.securesms.components.AnimatingToggle>