From a228e702daee7024ac88f3cbfadba031ce5b6951 Mon Sep 17 00:00:00 2001 From: Karol Kaminski Date: Tue, 14 Jan 2020 19:30:36 +0100 Subject: [PATCH] menu-item History visibility accordingly to settings --- app/src/main/java/org/schabi/newpipe/MainActivity.java | 10 ++++++++++ .../main/java/org/schabi/newpipe/util/Constants.java | 2 ++ 2 files changed, 12 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 2dfbb9c69..cce02f526 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -449,6 +449,16 @@ public class MainActivity extends AppCompatActivity { sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply(); NavigationHelper.openMainActivity(this); } + + if (sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) { + if (DEBUG) Log.d(TAG, "do not show History-menu as its disabled in settings"); + drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(true); + } + + if (!sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) { + if (DEBUG) Log.d(TAG, "show History-menu as its enabled in settings"); + drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(false); + } } @Override diff --git a/app/src/main/java/org/schabi/newpipe/util/Constants.java b/app/src/main/java/org/schabi/newpipe/util/Constants.java index b01b6df6a..50350651d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Constants.java +++ b/app/src/main/java/org/schabi/newpipe/util/Constants.java @@ -11,5 +11,7 @@ public class Constants { public static final String KEY_THEME_CHANGE = "key_theme_change"; public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change"; + public static final String KEY_ENABLE_WATCH_HISTORY = "enable_watch_history"; + public static final int NO_SERVICE_ID = -1; }