From 02f48ccc7f4e0338557a47bc24d0993e2b4a71ff Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Thu, 22 Mar 2018 18:44:03 -0700 Subject: [PATCH] -Removed duplicate dialog open instances in service player activity. --- .../newpipe/player/ServicePlayerActivity.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java index 994aa60e8..239c9c8d3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -433,12 +433,10 @@ public abstract class ServicePlayerActivity extends AppCompatActivity player.onShuffleClicked(); } else if (view.getId() == playbackSpeedButton.getId()) { - PlaybackParameterDialog.newInstance(player.getPlaybackSpeed(), - player.getPlaybackPitch()).show(getSupportFragmentManager(), getTag()); + openPlaybackParameterDialog(); } else if (view.getId() == playbackPitchButton.getId()) { - PlaybackParameterDialog.newInstance(player.getPlaybackSpeed(), - player.getPlaybackPitch()).show(getSupportFragmentManager(), getTag()); + openPlaybackParameterDialog(); } else if (view.getId() == metadata.getId()) { scrollToSelected(); @@ -450,9 +448,15 @@ public abstract class ServicePlayerActivity extends AppCompatActivity } //////////////////////////////////////////////////////////////////////////// - // Playback Parameters Listener + // Playback Parameters //////////////////////////////////////////////////////////////////////////// + private void openPlaybackParameterDialog() { + if (player == null) return; + PlaybackParameterDialog.newInstance(player.getPlaybackSpeed(), + player.getPlaybackPitch()).show(getSupportFragmentManager(), getTag()); + } + @Override public void onPlaybackParameterChanged(float playbackTempo, float playbackPitch) { if (player != null) player.setPlaybackParameters(playbackTempo, playbackPitch);