From 2e771cd65ab1eff2cb090351a4083d1d129fe53a Mon Sep 17 00:00:00 2001 From: GGAutomaton <32899400+GGAutomaton@users.noreply.github.com> Date: Mon, 4 Apr 2022 23:58:39 +0800 Subject: [PATCH 01/28] Fix crash when rotating device on unsupported channels --- .../fragments/list/channel/ChannelFragment.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index 869503b5bed..6ad81132002 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -77,6 +77,8 @@ public class ChannelFragment extends BaseListInfoFragment Date: Sun, 17 Apr 2022 22:23:03 +0800 Subject: [PATCH 02/28] fix issue #7563 --- .../local/playlist/LocalPlaylistFragment.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index 0eb56d7169c..7cd2a3ec169 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -414,14 +414,21 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) { } else { final Iterator streamStatesIter = recordManager .loadLocalStreamStateBatch(playlist).blockingGet().iterator(); - while (playlistIter.hasNext()) { final PlaylistStreamEntry playlistItem = playlistIter.next(); final int indexInHistory = Collections.binarySearch(historyStreamIds, playlistItem.getStreamId()); - - final boolean hasState = streamStatesIter.next() != null; - if (indexInHistory < 0 || hasState) { + final StreamStateEntity streamStateEntity = streamStatesIter.next(); + final long duration = playlistItem.toStreamInfoItem().getDuration(); + boolean isFinished = false; + if (streamStateEntity != null) { + isFinished = streamStateEntity.isFinished(duration); + } + final boolean isNotWatchedItem = (streamStateEntity != null + && !isFinished); + if (indexInHistory < 0) { + notWatchedItems.add(playlistItem); + } else if (isNotWatchedItem) { notWatchedItems.add(playlistItem); } else if (!thumbnailVideoRemoved && playlistManager.getPlaylistThumbnail(playlistId) From 047fe21c143fd945de34aa01c5efa4df033cb977 Mon Sep 17 00:00:00 2001 From: kt programs Date: Sat, 30 Apr 2022 17:43:30 +0800 Subject: [PATCH 03/28] Fix hiding player controls when playing from media button DefaultControlDispatcher was removed in ExoPlayer 2.16.0, so the class extending it that handled play/pause was removed in #8020. The new solution is to use an instance of ForwardingPlayer. Call sessionConnector.setPlayer with an instance of ForwardingPlayer that overrides play() and pause() and calls the callback methods. --- .../newpipe/player/helper/MediaSessionManager.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java index c12ba754ad4..a8735dc08bc 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java @@ -13,6 +13,7 @@ import androidx.annotation.Nullable; import androidx.media.session.MediaButtonReceiver; +import com.google.android.exoplayer2.ForwardingPlayer; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector; @@ -55,7 +56,17 @@ public MediaSessionManager(@NonNull final Context context, sessionConnector = new MediaSessionConnector(mediaSession); sessionConnector.setQueueNavigator(new PlayQueueNavigator(mediaSession, callback)); - sessionConnector.setPlayer(player); + sessionConnector.setPlayer(new ForwardingPlayer(player) { + @Override + public void play() { + callback.play(); + } + + @Override + public void pause() { + callback.pause(); + } + }); } @Nullable From a67927c29ce5e3f60ed628fb307bda3333e28774 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 1 May 2022 21:56:49 +0200 Subject: [PATCH 04/28] Fix dialogs having incorrect color when opened via RouterActivity --- app/src/main/res/values/styles.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7c126558079..894e70bad92 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -131,10 +131,6 @@ +