From 39a5c8bdfb08a9e5b60b479dbd9968efd331687a Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Wed, 29 Mar 2023 13:39:29 +0200 Subject: [PATCH] fix: reset video stream sizes on audio track selection --- .../java/org/schabi/newpipe/download/DownloadDialog.java | 1 + .../java/org/schabi/newpipe/util/StreamItemAdapter.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 2295c3c7a..7dd482b21 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -261,6 +261,7 @@ public class DownloadDialog extends DialogFragment final StreamSizeWrapper audioStreams = getWrappedAudioStreams(); final var secondaryStreams = new SparseArrayCompat>(4); final List videoStreams = wrappedVideoStreams.getStreamsList(); + wrappedVideoStreams.resetSizes(); for (int i = 0; i < videoStreams.size(); i++) { if (!videoStreams.get(i).isVideoOnly()) { diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamItemAdapter.java b/app/src/main/java/org/schabi/newpipe/util/StreamItemAdapter.java index 74de45720..4bcdfd02a 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamItemAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamItemAdapter.java @@ -235,7 +235,7 @@ public class StreamItemAdapter extends BaseA this.unknownSize = context == null ? "--.-" : context.getString(R.string.unknown_content); - Arrays.fill(streamSizes, -2); + resetSizes(); } /** @@ -269,6 +269,10 @@ public class StreamItemAdapter extends BaseA .onErrorReturnItem(true); } + public void resetSizes() { + Arrays.fill(streamSizes, -2); + } + public static StreamSizeWrapper empty() { //noinspection unchecked return (StreamSizeWrapper) EMPTY;