From db5ed48dbb529c8bd0b0871724c821b666157aba Mon Sep 17 00:00:00 2001 From: TobiGr Date: Fri, 11 Aug 2023 23:12:47 +0200 Subject: [PATCH] Fix some sonar warnings and make some smaller improvements --- .../java/org/schabi/newpipe/player/PlayQueueActivity.java | 8 +++----- .../org/schabi/newpipe/settings/tabs/TabsManager.java | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java index cd71c64e9..4baadf69f 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java @@ -585,11 +585,9 @@ public final class PlayQueueActivity extends AppCompatActivity } private void onPlaybackParameterChanged(@Nullable final PlaybackParameters parameters) { - if (parameters != null) { - if (menu != null && player != null) { - final MenuItem item = menu.findItem(R.id.action_playback_speed); - item.setTitle(formatSpeed(parameters.speed)); - } + if (parameters != null && menu != null && player != null) { + final MenuItem item = menu.findItem(R.id.action_playback_speed); + item.setTitle(formatSpeed(parameters.speed)); } } diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/TabsManager.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/TabsManager.java index c885b803c..7dcbee56f 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/TabsManager.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/TabsManager.java @@ -73,10 +73,8 @@ public final class TabsManager { private SharedPreferences.OnSharedPreferenceChangeListener getPreferenceChangeListener() { return (sp, key) -> { - if (savedTabsKey.equals(key)) { - if (savedTabsChangeListener != null) { - savedTabsChangeListener.onTabsChanged(); - } + if (savedTabsKey.equals(key) && savedTabsChangeListener != null) { + savedTabsChangeListener.onTabsChanged(); } }; }