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);
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);

View File

@ -6,9 +6,10 @@
<string name="settingsCategoryEtc">settings_category_etc</string>
<!-- Key values -->
<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="defaultResolutionPreference">default_resulution_preference</string>
<string name="defaultResolutionPreference">default_resolution_preference</string>
<string-array name="resolutionList">
<item>720p</item>
<item>360p</item>
@ -16,7 +17,7 @@
<item>144p</item>
</string-array>
<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-array name="audioFormatDescriptionList">
<item>@string/webMAudioDescription</item>

View File

@ -19,7 +19,8 @@
<string name="chooseBrowser">Choose browser:</string>
<string name="screenRotation">rotation</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="downloadLocationSummary">Path to store downloaded videos in.</string>
<string name="downloadLocationDialogTitle">Enter download path</string>

View File

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