From 4fbd1182c2f3ddf86c9f742d1934081ea8a9bfa2 Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Tue, 26 Jun 2018 10:19:16 -0700 Subject: [PATCH 1/2] -Fixed minimizing to popup player does not destroying existing player when drawing over app permission is not granted. --- .../java/org/schabi/newpipe/player/MainVideoPlayer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 8a4fb62da..8a5844a43 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -219,11 +219,10 @@ public final class MainVideoPlayer extends AppCompatActivity getWindow().getAttributes().screenBrightness); if (playerImpl == null) return; - if (isBackPressed) { - playerImpl.destroy(); - } else { + if (!isBackPressed) { playerImpl.minimize(); } + playerImpl.destroy(); isInMultiWindow = false; isBackPressed = false; @@ -465,7 +464,8 @@ public final class MainVideoPlayer extends AppCompatActivity onFullScreenButtonClicked(); break; case PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_NONE: - destroy(); + default: + // No action break; } } From ef16145695dff523ffc3e09a938fcc71116ac96d Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Tue, 26 Jun 2018 10:21:43 -0700 Subject: [PATCH 2/2] -Fixed player new share intent causing main player crash due to player activity in background. --- app/src/main/java/org/schabi/newpipe/player/BasePlayer.java | 4 ++-- .../main/java/org/schabi/newpipe/player/MainVideoPlayer.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 4c3d70421..818f01bc0 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -1147,11 +1147,11 @@ public abstract class BasePlayer implements @Player.RepeatMode public int getRepeatMode() { - return simpleExoPlayer.getRepeatMode(); + return simpleExoPlayer == null ? Player.REPEAT_MODE_OFF : simpleExoPlayer.getRepeatMode(); } public void setRepeatMode(@Player.RepeatMode final int repeatMode) { - simpleExoPlayer.setRepeatMode(repeatMode); + if (simpleExoPlayer != null) simpleExoPlayer.setRepeatMode(repeatMode); } public float getPlaybackSpeed() { diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 8a5844a43..df9f520e9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -153,7 +153,10 @@ public final class MainVideoPlayer extends AppCompatActivity protected void onNewIntent(Intent intent) { if (DEBUG) Log.d(TAG, "onNewIntent() called with: intent = [" + intent + "]"); super.onNewIntent(intent); - playerImpl.handleIntent(intent); + if (intent != null) { + playerState = null; + playerImpl.handleIntent(intent); + } } @Override