menu-item History visibility accordingly to settings

This commit is contained in:
Karol Kaminski 2020-01-14 19:30:36 +01:00
parent 9d773d6e8a
commit a228e702da
2 changed files with 12 additions and 0 deletions

View File

@ -449,6 +449,16 @@ public class MainActivity extends AppCompatActivity {
sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply(); sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply();
NavigationHelper.openMainActivity(this); 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 @Override

View File

@ -11,5 +11,7 @@ public class Constants {
public static final String KEY_THEME_CHANGE = "key_theme_change"; 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_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; public static final int NO_SERVICE_ID = -1;
} }