1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

added preference to switch between external and internal audio players

This commit is contained in:
Adam Howard 2015-12-20 00:31:31 +00:00
parent 25c5f95ad9
commit 69903ba889
4 changed files with 20 additions and 11 deletions

View File

@ -139,7 +139,7 @@ class ActionBarHandler {
MenuItem castItem = menu.findItem(R.id.action_play_with_kodi); MenuItem castItem = menu.findItem(R.id.action_play_with_kodi);
castItem.setVisible(defaultPreferences castItem.setVisible(defaultPreferences
.getBoolean(activity.getString(R.string.showPlayWidthKodiPreference), false)); .getBoolean(activity.getString(R.string.showPlayWithKodiPreference), false));
} }
public boolean onItemSelected(MenuItem item) { public boolean onItemSelected(MenuItem item) {
@ -187,7 +187,7 @@ class ActionBarHandler {
// ----------- THE MAGIC MOMENT --------------- // ----------- THE MAGIC MOMENT ---------------
if(!videoTitle.isEmpty()) { if(!videoTitle.isEmpty()) {
if (PreferenceManager.getDefaultSharedPreferences(activity) if (PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(activity.getString(R.string.useExternalPlayer), false)) { .getBoolean(activity.getString(R.string.useExternalVideoPlayer), false)) {
// External Player // External Player
Intent intent = new Intent(); Intent intent = new Intent();
@ -297,9 +297,11 @@ class ActionBarHandler {
} }
public void playAudio() { public void playAudio() {
boolean b = true;//todo: replace with preference
boolean externalAudioPlayer = PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(activity.getString(R.string.useExternalAudioPlayer), false);
Intent intent; Intent intent;
if (b)//internal (background) music player: explicit intent if (!externalAudioPlayer)//internal (background) music player: explicit intent
{ {
intent = new Intent(activity, BackgroundPlayer.class); intent = new Intent(activity, BackgroundPlayer.class);

View File

@ -6,9 +6,10 @@
<string name="settingsCategoryEtc">settings_category_etc</string> <string name="settingsCategoryEtc">settings_category_etc</string>
<!-- Key values --> <!-- Key values -->
<string name="downloadPathPreference">download_path_preference</string> <string name="downloadPathPreference">download_path_preference</string>
<string name="useExternalPlayer">use_external_player</string> <string name="useExternalVideoPlayer">use_external_video_player</string>
<string name="useExternalAudioPlayer">use_external_audio_player</string>
<string name="autoPlayThroughIntent">autoplay_through_intent</string> <string name="autoPlayThroughIntent">autoplay_through_intent</string>
<string name="defaultResolutionPreference">default_resulution_preference</string> <string name="defaultResolutionPreference">default_resolution_preference</string>
<string-array name="resolutionList"> <string-array name="resolutionList">
<item>720p</item> <item>720p</item>
<item>360p</item> <item>360p</item>
@ -16,7 +17,7 @@
<item>144p</item> <item>144p</item>
</string-array> </string-array>
<string name="defaultResolutionListItem">360p</string> <string name="defaultResolutionListItem">360p</string>
<string name="showPlayWidthKodiPreference">show_play_with_kodi_preference</string> <string name="showPlayWithKodiPreference">show_play_with_kodi_preference</string>
<string name="defaultAudioFormatPreference">default_audio_format</string> <string name="defaultAudioFormatPreference">default_audio_format</string>
<string-array name="audioFormatDescriptionList"> <string-array name="audioFormatDescriptionList">
<item>@string/webMAudioDescription</item> <item>@string/webMAudioDescription</item>

View File

@ -19,7 +19,8 @@
<string name="chooseBrowser">Choose browser:</string> <string name="chooseBrowser">Choose browser:</string>
<string name="screenRotation">rotation</string> <string name="screenRotation">rotation</string>
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="useExternalPlayerTitle">Use external player</string> <string name="useExternalVideoPlayerTitle">Use external video player</string>
<string name="useExternalAudioPlayerTitle">Use external audio (background) player</string>
<string name="downloadLocation">Download location</string> <string name="downloadLocation">Download location</string>
<string name="downloadLocationSummary">Path to store downloaded videos in.</string> <string name="downloadLocationSummary">Path to store downloaded videos in.</string>
<string name="downloadLocationDialogTitle">Enter download path</string> <string name="downloadLocationDialogTitle">Enter download path</string>

View File

@ -8,8 +8,13 @@
android:title="@string/settingsCategoryVideoAudioTitle"> android:title="@string/settingsCategoryVideoAudioTitle">
<CheckBoxPreference <CheckBoxPreference
android:key="@string/useExternalPlayer" android:key="@string/useExternalVideoPlayer"
android:title="@string/useExternalPlayerTitle" android:title="@string/useExternalVideoPlayerTitle"
android:defaultValue="false"/>
<CheckBoxPreference
android:key="@string/useExternalAudioPlayer"
android:title="@string/useExternalAudioPlayerTitle"
android:defaultValue="false"/> android:defaultValue="false"/>
<ListPreference <ListPreference
@ -32,7 +37,7 @@
android:title="@string/settingsCategoryVideoInfoTittle"> android:title="@string/settingsCategoryVideoInfoTittle">
<CheckBoxPreference <CheckBoxPreference
android:key="@string/showPlayWidthKodiPreference" android:key="@string/showPlayWithKodiPreference"
android:title="@string/showPlayWithKodiTitle" android:title="@string/showPlayWithKodiTitle"
android:summary="@string/showPlayWithKodiSummary" android:summary="@string/showPlayWithKodiSummary"
android:defaultValue="false" /> android:defaultValue="false" />