From 694418d30dd3bedd817a56687096f892c0904db8 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 21 Mar 2023 16:58:36 +0100 Subject: [PATCH] fix: update stream sizes when audio track changed --- .../org/schabi/newpipe/download/DownloadDialog.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 5d3679471..2295c3c7a 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -433,9 +433,6 @@ public class DownloadDialog extends DialogFragment dialogBinding.audioTrackSpinner.setAdapter(audioTrackAdapter); dialogBinding.audioTrackSpinner.setSelection(selectedAudioStreamIndex); - - dialogBinding.audioStreamSpinner.setAdapter(audioStreamsAdapter); - dialogBinding.audioStreamSpinner.setSelection(selectedAudioIndex); } private void setupAudioSpinner() { @@ -445,6 +442,8 @@ public class DownloadDialog extends DialogFragment dialogBinding.qualitySpinner.setVisibility(View.GONE); setRadioButtonsState(true); + dialogBinding.audioStreamSpinner.setAdapter(audioStreamsAdapter); + dialogBinding.audioStreamSpinner.setSelection(selectedAudioIndex); dialogBinding.audioStreamSpinner.setVisibility(View.VISIBLE); dialogBinding.audioTrackSpinner.setVisibility( wrappedAudioTracks.size() > 1 ? View.VISIBLE : View.GONE); @@ -619,8 +618,12 @@ public class DownloadDialog extends DialogFragment onItemSelectedSetFileName(); break; case R.id.audio_track_spinner: + final boolean trackChanged = selectedAudioStreamIndex != position; selectedAudioStreamIndex = position; - updateSecondaryStreams(); + if (trackChanged) { + updateSecondaryStreams(); + fetchStreamsSize(); + } break; case R.id.audio_stream_spinner: selectedAudioIndex = position;