From 69903ba8896a2e1d07112ad2d29944e61c6be482 Mon Sep 17 00:00:00 2001 From: Adam Howard Date: Sun, 20 Dec 2015 00:31:31 +0000 Subject: [PATCH] added preference to switch between external and internal audio players --- .../java/org/schabi/newpipe/ActionBarHandler.java | 10 ++++++---- app/src/main/res/values/settings_keys.xml | 7 ++++--- app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/settings_screen.xml | 11 ++++++++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java index 28fbbac37..ab7bcef96 100644 --- a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java +++ b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java @@ -139,7 +139,7 @@ class ActionBarHandler { MenuItem castItem = menu.findItem(R.id.action_play_with_kodi); castItem.setVisible(defaultPreferences - .getBoolean(activity.getString(R.string.showPlayWidthKodiPreference), false)); + .getBoolean(activity.getString(R.string.showPlayWithKodiPreference), false)); } public boolean onItemSelected(MenuItem item) { @@ -187,7 +187,7 @@ class ActionBarHandler { // ----------- THE MAGIC MOMENT --------------- if(!videoTitle.isEmpty()) { if (PreferenceManager.getDefaultSharedPreferences(activity) - .getBoolean(activity.getString(R.string.useExternalPlayer), false)) { + .getBoolean(activity.getString(R.string.useExternalVideoPlayer), false)) { // External Player Intent intent = new Intent(); @@ -297,9 +297,11 @@ class ActionBarHandler { } public void playAudio() { - boolean b = true;//todo: replace with preference + + boolean externalAudioPlayer = PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(activity.getString(R.string.useExternalAudioPlayer), false); Intent intent; - if (b)//internal (background) music player: explicit intent + if (!externalAudioPlayer)//internal (background) music player: explicit intent { intent = new Intent(activity, BackgroundPlayer.class); diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index f7c6020a6..8d33b8cbe 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -6,9 +6,10 @@ settings_category_etc download_path_preference - use_external_player + use_external_video_player + use_external_audio_player autoplay_through_intent - default_resulution_preference + default_resolution_preference 720p 360p @@ -16,7 +17,7 @@ 144p 360p - show_play_with_kodi_preference + show_play_with_kodi_preference default_audio_format @string/webMAudioDescription diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c819f5ff7..611c28def 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,7 +19,8 @@ Choose browser: rotation Settings - Use external player + Use external video player + Use external audio (background) player Download location Path to store downloaded videos in. Enter download path diff --git a/app/src/main/res/xml/settings_screen.xml b/app/src/main/res/xml/settings_screen.xml index 724c27e99..98399f778 100644 --- a/app/src/main/res/xml/settings_screen.xml +++ b/app/src/main/res/xml/settings_screen.xml @@ -8,8 +8,13 @@ android:title="@string/settingsCategoryVideoAudioTitle"> + +