diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 7cd620faa..29dde41c1 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -453,15 +453,9 @@ public class MainActivity extends AppCompatActivity { 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); - } + final boolean isHistoryEnabled = sharedPreferences.getBoolean( + getString(R.string.enable_watch_history_key), true); + drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(isHistoryEnabled); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java index edfc54375..7fab44f8f 100644 --- a/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java +++ b/app/src/main/java/org/schabi/newpipe/about/AboutActivity.java @@ -88,13 +88,6 @@ public class AboutActivity extends AppCompatActivity { } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.menu_about, menu); - return true; - } - @Override public boolean onOptionsItemSelected(MenuItem item) { diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java b/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java index 00dd45ac9..de3df3527 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadActivity.java @@ -12,6 +12,7 @@ import android.view.MenuItem; import android.view.ViewTreeObserver; import org.schabi.newpipe.R; +import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.ThemeHelper; import us.shandian.giga.service.DownloadManagerService; @@ -76,11 +77,9 @@ public class DownloadActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: { + case android.R.id.home: onBackPressed(); return true; - } - default: return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 7dd98003a..b28c71d72 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -600,22 +600,27 @@ public class VideoDetailFragment @Override public boolean onOptionsItemSelected(MenuItem item) { - if (isLoading.get()) { - // if is still loading block menu + int id = item.getItemId(); + if (id == R.id.action_settings) { + NavigationHelper.openSettings(requireContext()); + return true; + } + + if (isLoading.get()) { + // if still loading, block menu buttons related to video info return true; } - int id = item.getItemId(); switch (id) { case R.id.menu_item_share: { if (currentInfo != null) { - ShareUtils.shareUrl(this.getContext(), currentInfo.getName(), currentInfo.getOriginalUrl()); + ShareUtils.shareUrl(requireContext(), currentInfo.getName(), currentInfo.getOriginalUrl()); } return true; } case R.id.menu_item_openInBrowser: { if (currentInfo != null) { - ShareUtils.openUrlInBrowser(this.getContext(), currentInfo.getOriginalUrl()); + ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl()); } return true; } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java index 7b7a08a48..4742fcca1 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/channel/ChannelFragment.java @@ -175,17 +175,20 @@ public class ChannelFragment extends BaseListInfoFragment { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case R.id.action_settings: + NavigationHelper.openSettings(requireContext()); + break; case R.id.menu_item_rss: openRssFeed(); break; case R.id.menu_item_openInBrowser: if (currentInfo != null) { - ShareUtils.openUrlInBrowser(this.getContext(), currentInfo.getOriginalUrl()); + ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl()); } break; case R.id.menu_item_share: if (currentInfo != null) { - ShareUtils.shareUrl(this.getContext(), name, currentInfo.getOriginalUrl()); + ShareUtils.shareUrl(requireContext(), name, currentInfo.getOriginalUrl()); } break; default: diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index 6941741af..a992cd7ba 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -222,11 +222,14 @@ public class PlaylistFragment extends BaseListInfoFragment { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case R.id.action_settings: + NavigationHelper.openSettings(requireContext()); + break; case R.id.menu_item_openInBrowser: - ShareUtils.openUrlInBrowser(this.getContext(), url); + ShareUtils.openUrlInBrowser(requireContext(), url); break; case R.id.menu_item_share: - ShareUtils.shareUrl(this.getContext(), name, url); + ShareUtils.shareUrl(requireContext(), name, url); break; case R.id.menu_item_bookmark: onBookmarkClicked(); 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 669d1c16c..aeba763be 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -156,6 +156,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity case android.R.id.home: finish(); return true; + case R.id.action_settings: + NavigationHelper.openSettings(this); + return true; case R.id.action_append_playlist: appendAllToPlaylist(); return true; 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 50350651d..b01b6df6a 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Constants.java +++ b/app/src/main/java/org/schabi/newpipe/util/Constants.java @@ -11,7 +11,5 @@ 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; } diff --git a/app/src/main/res/menu/download_menu.xml b/app/src/main/res/menu/download_menu.xml index 27d9bfe29..d41434711 100644 --- a/app/src/main/res/menu/download_menu.xml +++ b/app/src/main/res/menu/download_menu.xml @@ -26,5 +26,4 @@ android:icon="?attr/ic_delete" android:title="@string/clear_download_history" app:showAsAction="ifRoom" /> - diff --git a/app/src/main/res/menu/menu_about.xml b/app/src/main/res/menu/menu_about.xml deleted file mode 100644 index dbe91a04f..000000000 --- a/app/src/main/res/menu/menu_about.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/app/src/main/res/menu/menu_channel.xml b/app/src/main/res/menu/menu_channel.xml index cc6a9ed71..f8449d8b5 100644 --- a/app/src/main/res/menu/menu_channel.xml +++ b/app/src/main/res/menu/menu_channel.xml @@ -4,11 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" tools:context=".fragments.list.impl.ChannelFragment"> - - + + + + diff --git a/app/src/main/res/menu/menu_play_queue.xml b/app/src/main/res/menu/menu_play_queue.xml index 5413794be..be6cea46c 100644 --- a/app/src/main/res/menu/menu_play_queue.xml +++ b/app/src/main/res/menu/menu_play_queue.xml @@ -10,13 +10,18 @@ android:visible="true" app:showAsAction="ifRoom"/> + + diff --git a/app/src/main/res/menu/menu_playlist.xml b/app/src/main/res/menu/menu_playlist.xml index 4583ff719..5e62d40a3 100644 --- a/app/src/main/res/menu/menu_playlist.xml +++ b/app/src/main/res/menu/menu_playlist.xml @@ -3,11 +3,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> - - + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/video_detail_menu.xml b/app/src/main/res/menu/video_detail_menu.xml index fd44c7860..65e7bc4da 100644 --- a/app/src/main/res/menu/video_detail_menu.xml +++ b/app/src/main/res/menu/video_detail_menu.xml @@ -14,8 +14,15 @@ android:title="@string/share" app:showAsAction="ifRoom"/> + +