From 12796920a361c63831a8c2644df5a76ec9f50d90 Mon Sep 17 00:00:00 2001 From: Jared Fantaye Date: Sat, 10 Dec 2022 21:56:04 +0100 Subject: [PATCH] Removed the wasPlaying variable --- .../main/java/org/schabi/newpipe/player/Player.java | 8 -------- .../java/org/schabi/newpipe/player/PlayerService.java | 2 -- .../org/schabi/newpipe/player/ui/VideoPlayerUi.java | 11 +++-------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 99d36f66e..95520ba1e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -216,7 +216,6 @@ public final class Player implements PlaybackListener, Listener { // minimized to background but will resume automatically to the original player type private boolean isAudioOnly = false; private boolean isPrepared = false; - private boolean wasPlaying = false; /*////////////////////////////////////////////////////////////////////////// // UIs, listeners and disposables @@ -918,13 +917,6 @@ public final class Player implements PlaybackListener, Listener { error -> Log.e(TAG, "Progress update failure: ", error)); } - public void saveWasPlaying() { - this.wasPlaying = getPlayWhenReady(); - } - - public boolean wasPlaying() { - return wasPlaying; - } //endregion diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java index 33b024e3d..d81301205 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java @@ -86,8 +86,6 @@ public final class PlayerService extends Service { } if (!player.exoPlayerIsNull()) { - player.saveWasPlaying(); - // Releases wifi & cpu, disables keepScreenOn, etc. // We can't just pause the player here because it will make transition // from one stream to a new stream not smooth diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java index 9fb4552b2..afdfbd81d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java @@ -601,8 +601,6 @@ public abstract class VideoPlayerUi extends PlayerUi player.changeState(STATE_PAUSED_SEEK); } - player.saveWasPlaying(); - showControls(0); animate(binding.currentDisplaySeek, true, DEFAULT_CONTROLS_DURATION, AnimationType.SCALE_AND_ALPHA); @@ -617,7 +615,7 @@ public abstract class VideoPlayerUi extends PlayerUi } player.seekTo(seekBar.getProgress()); - if (player.wasPlaying() || player.getExoPlayer().getDuration() == seekBar.getProgress()) { + if (player.getExoPlayer().getDuration() == seekBar.getProgress()) { player.getExoPlayer().play(); } @@ -631,9 +629,8 @@ public abstract class VideoPlayerUi extends PlayerUi if (!player.isProgressLoopRunning()) { player.startProgressLoop(); } - if (player.wasPlaying()) { - showControlsThenHide(); - } + + showControlsThenHide(); } //endregion @@ -1168,8 +1165,6 @@ public abstract class VideoPlayerUi extends PlayerUi binding.qualityTextView.setText(MediaFormat.getNameById(videoStream.getFormatId()) + " " + videoStream.getResolution()); } - - player.saveWasPlaying(); } /**