Skip to content

Commit

Permalink
Merge pull request #2960 from karkaminski/issue-#2254
Browse files Browse the repository at this point in the history
Issue #2254
  • Loading branch information
Stypox authored Jan 19, 2020
2 parents 42ff60c + 266c3d0 commit 8c3be2c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 65 deletions.
20 changes: 10 additions & 10 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,16 @@ protected void onResume() {
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
Expand Down Expand Up @@ -551,8 +561,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
if (!(fragment instanceof SearchFragment)) {
findViewById(R.id.toolbar).findViewById(R.id.toolbar_search_container).setVisibility(View.GONE);

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
}

ActionBar actionBar = getSupportActionBar();
Expand All @@ -574,14 +582,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case android.R.id.home:
onHomeButtonPressed();
return true;
case R.id.action_show_downloads:
return NavigationHelper.openDownloads(this);
case R.id.action_history:
NavigationHelper.openStatisticFragment(getSupportFragmentManager());
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/org/schabi/newpipe/about/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case android.R.id.home:
finish();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
case R.id.action_show_downloads:
return NavigationHelper.openDownloads(this);
}

return super.onOptionsItemSelected(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
onBackPressed();
return true;
}
case R.id.action_settings: {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}

default:
return super.onOptionsItemSelected(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.action_append_playlist:
appendAllToPlaylist();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
redraw = true;
return true;
case R.id.action_system_audio:
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
return true;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/schabi/newpipe/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 0 additions & 4 deletions app/src/main/res/menu/download_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@
android:title="@string/clear_download_history"
app:showAsAction="ifRoom" />

<item android:id="@+id/action_settings"
android:title="@string/settings"
app:showAsAction="never" />

</menu>
22 changes: 0 additions & 22 deletions app/src/main/res/menu/main_menu.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/menu/menu_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,4 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.schabi.newpipe.about.AboutActivity">

<item android:id="@+id/action_show_downloads"
android:orderInCategory="980"
android:title="@string/downloads"
app:showAsAction="never"/>

<item android:id="@+id/action_settings"
android:orderInCategory="990"
android:title="@string/settings"
app:showAsAction="never"/>

</menu>
5 changes: 0 additions & 5 deletions app/src/main/res/menu/menu_play_queue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
android:visible="true"
app:showAsAction="ifRoom"/>

<item android:id="@+id/action_settings"
android:orderInCategory="990"
android:title="@string/settings"
app:showAsAction="never"/>

<item android:id="@+id/action_system_audio"
android:orderInCategory="996"
android:title="@string/play_queue_audio_settings"
Expand Down

0 comments on commit 8c3be2c

Please sign in to comment.