Commit f097b30a authored by Alexandre Perraud's avatar Alexandre Perraud

Preferences : Audio reorganization

parent a9256ccc
......@@ -274,18 +274,6 @@
<string name="enable_clone_mode">Prefer clone</string>
<string name="enable_clone_mode_summary">Clone the device screen without remote control.</string>
<string name="interface_other_category">Interface - Other</string>
<string name="audio_title_alignment">Audio title alignment</string>
<string name="enable_headset_detection">Detect headset</string>
<string name="enable_headset_detection_summary">Detect headset insertion and removal</string>
<string name="enable_play_on_headset_insertion">Resume on headset insertion</string>
<string name="enable_play_on_headset_insertion_summary">Pause otherwise</string>
<string name="enable_steal_remote_control">Exclusive headset remote control</string>
<string name="enable_steal_remote_control_summary">Avoid conflicts by stealing the remote control from other apps. This prevents dialing on double click on HTC phones.</string>
<string name="audio_title_alignment_default">Default</string>
<string name="audio_title_alignment_left">Left</string>
<string name="audio_title_alignment_centre">Centre</string>
<string name="audio_title_alignment_right">Right</string>
<string name="audio_title_alignment_marquee">Marquee</string>
<string name="video_prefs_category">Video</string>
<string name="video_min_group_length_title">Group videos</string>
......@@ -319,6 +307,26 @@
<string name="subtitles_color_green">Green</string>
<string name="subtitles_background_title">Subtitles Background</string>
<string name="audio_prefs_category">Audio</string>
<string name="lockscreen_cover_title">Media cover on Lockscreen</string>
<string name="lockscreen_cover_summary">When available, set the current media cover art as lockscreen wallpaper</string>
<string name="audio_title_alignment">Audio title alignment</string>
<string name="audio_title_alignment_default">Default</string>
<string name="audio_title_alignment_left">Left</string>
<string name="audio_title_alignment_centre">Centre</string>
<string name="audio_title_alignment_right">Right</string>
<string name="audio_title_alignment_marquee">Marquee</string>
<string name="headset_prefs_category">Headset</string>
<string name="enable_headset_detection">Detect headset</string>
<string name="enable_headset_detection_summary">Detect headset insertion and removal</string>
<string name="enable_play_on_headset_insertion">Resume on headset insertion</string>
<string name="enable_play_on_headset_insertion_summary">Pause otherwise</string>
<string name="enable_steal_remote_control">Exclusive headset remote control</string>
<string name="enable_steal_remote_control_summary">Avoid conflicts by stealing the remote control from other apps. This prevents dialing on double click on HTC phones.</string>
<string name="aout">Audio output</string>
<string name="aout_summary">Change the method that VLC uses to output audio.</string>
<string name="aout_audiotrack" translatable="false">AudioTrack</string>
<string name="aout_opensles" translatable="false">OpenSL ES</string>
<string name="controls_prefs_category">Controls</string>
......@@ -337,10 +345,6 @@
<string name="enable_time_stretching_audio_summary">Speed up and slow down audio without changing the pitch (requires a fast device).</string>
<string name="advanced_prefs_category">Advanced</string>
<string name="aout">Audio output</string>
<string name="aout_summary">Change the method that VLC uses to output audio.</string>
<string name="aout_audiotrack" translatable="false">AudioTrack</string>
<string name="aout_opensles" translatable="false">OpenSL ES</string>
<string name="save_video_none">Do not save speed</string>
<string name="save_video_session">Save speed during session</string>
<string name="save_video_always">Save speed across sessions</string>
......@@ -412,8 +416,6 @@
<string name="player_touch_disable_all">Disable all Touch controls</string>
<string name="tv_ui_title">Android TV interface</string>
<string name="tv_ui_summary">Change UI to TV adapted theme</string>
<string name="lockscreen_cover_title">Media cover on Lockscreen</string>
<string name="lockscreen_cover_summary">When available, set the current media cover art as lockscreen wallpaper</string>
<!--Accessibility-->
<string name="more_actions">More Actions</string>
......
......@@ -44,6 +44,9 @@
<Preference
android:title="@string/subtitles_prefs_category"
android:key="subtitles_category" />
<Preference
android:title="@string/audio_prefs_category"
android:key="audio_category" />
<Preference
android:title="@string/performance_prefs_category"
android:key="perf_category" />
......
......@@ -2,10 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/advanced_prefs_category" >
<ListPreference
android:key="aout"
android:summary="@string/aout_summary"
android:title="@string/aout" />
<!--<ListPreference-->
<!--android:key="vout"-->
<!--android:summary="@string/vout_summary"-->
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="audio_category"
android:title="@string/audio_prefs_category">
<CheckBoxPreference
android:defaultValue="true"
android:key="lockscreen_cover"
android:summary="@string/lockscreen_cover_summary"
android:title="@string/lockscreen_cover_title" />
<ListPreference
android:defaultValue="0"
android:entries="@array/audio_title_alignment_list"
android:entryValues="@array/audio_title_alignment_values"
android:key="audio_title_alignment"
android:persistent="true"
android:title="@string/audio_title_alignment" />
<PreferenceCategory android:title="@string/headset_prefs_category">
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_headset_detection"
android:summary="@string/enable_headset_detection_summary"
android:title="@string/enable_headset_detection" />
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_play_on_headset_insertion"
android:summary="@string/enable_play_on_headset_insertion_summary"
android:title="@string/enable_play_on_headset_insertion" />
<CheckBoxPreference
android:defaultValue="false"
android:key="enable_steal_remote_control"
android:summary="@string/enable_steal_remote_control_summary"
android:title="@string/enable_steal_remote_control" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/advanced_prefs_category">
<ListPreference
android:key="aout"
android:summary="@string/aout_summary"
android:title="@string/aout" />
</PreferenceCategory>
</PreferenceScreen>
......@@ -15,36 +15,6 @@
android:key="tv_ui"
android:summary="@string/tv_ui_summary"
android:title="@string/tv_ui_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="lockscreen_cover"
android:summary="@string/lockscreen_cover_summary"
android:title="@string/lockscreen_cover_title" />
<ListPreference
android:defaultValue="0"
android:entries="@array/audio_title_alignment_list"
android:entryValues="@array/audio_title_alignment_values"
android:key="audio_title_alignment"
android:persistent="true"
android:title="@string/audio_title_alignment" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/interface_controls">
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_headset_detection"
android:summary="@string/enable_headset_detection_summary"
android:title="@string/enable_headset_detection" />
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_play_on_headset_insertion"
android:summary="@string/enable_play_on_headset_insertion_summary"
android:title="@string/enable_play_on_headset_insertion" />
<CheckBoxPreference
android:defaultValue="false"
android:key="enable_steal_remote_control"
android:summary="@string/enable_steal_remote_control_summary"
android:title="@string/enable_steal_remote_control" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/interface_secondary_display_category_title">
......
......@@ -28,12 +28,10 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceManager;
import android.text.TextUtils;
import org.videolan.libvlc.util.HWDecoderUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.helpers.AudioUtil;
......@@ -41,7 +39,6 @@ import org.videolan.vlc.gui.helpers.BitmapCache;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.media.MediaDatabase;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.VLCOptions;
public class Advanced extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
......@@ -62,27 +59,6 @@ public class Advanced extends BasePreferenceFragment implements SharedPreference
findPreference("quit_app").setEnabled(false);
}
// Audio output
ListPreference aoutPref = (ListPreference) findPreference("aout");
final HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
if (aout == HWDecoderUtil.AudioOutput.AUDIOTRACK || aout == HWDecoderUtil.AudioOutput.OPENSLES) {
/* no AudioOutput choice */
findPreference("aout").setVisible(false);
} else {
int aoutEntriesId = R.array.aouts;
int aoutEntriesIdValues = R.array.aouts_values;
aoutPref.setEntries(aoutEntriesId);
aoutPref.setEntryValues(aoutEntriesIdValues);
final String value = aoutPref.getValue();
if (value == null)
aoutPref.setValue(String.valueOf(VLCOptions.AOUT_AUDIOTRACK));
else {
/* number of entries decreased, handle old values */
final int intValue = Integer.parseInt(value);
if (intValue != VLCOptions.AOUT_AUDIOTRACK && intValue != VLCOptions.AOUT_OPENSLES)
aoutPref.setValue(String.valueOf(VLCOptions.AOUT_AUDIOTRACK));
}
}
// Video output
// FIXME : This setting is disable until OpenGL is fixed
// ListPreference voutPref = (ListPreference) findPreference("vout");
......@@ -172,7 +148,6 @@ public class Advanced extends BasePreferenceFragment implements SharedPreference
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "aout":
case "network_caching":
case "vout":
VLCInstance.restart();
......
/*
* *************************************************************************
* PreferencesAudio.java
* **************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
package org.videolan.vlc.gui.preferences;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.TwoStatePreference;
import org.videolan.libvlc.util.HWDecoderUtil;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.VLCOptions;
public class PreferencesAudio extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
protected int getXml() {
return R.xml.preferences_audio;
}
@Override
protected int getTitleId() {
return R.string.audio_prefs_category;
}
@Override
public void onStart() {
super.onStart();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) findPreference("enable_headset_detection")).isChecked());
// Audio output
ListPreference aoutPref = (ListPreference) findPreference("aout");
final HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
if (aout == HWDecoderUtil.AudioOutput.AUDIOTRACK || aout == HWDecoderUtil.AudioOutput.OPENSLES) {
/* no AudioOutput choice */
findPreference("aout").setVisible(false);
} else {
int aoutEntriesId = R.array.aouts;
int aoutEntriesIdValues = R.array.aouts_values;
aoutPref.setEntries(aoutEntriesId);
aoutPref.setEntryValues(aoutEntriesIdValues);
final String value = aoutPref.getValue();
if (value == null)
aoutPref.setValue(String.valueOf(VLCOptions.AOUT_AUDIOTRACK));
else {
/* number of entries decreased, handle old values */
final int intValue = Integer.parseInt(value);
if (intValue != VLCOptions.AOUT_AUDIOTRACK && intValue != VLCOptions.AOUT_OPENSLES)
aoutPref.setValue(String.valueOf(VLCOptions.AOUT_AUDIOTRACK));
}
}
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey() == null)
return false;
switch (preference.getKey()){
case "enable_headset_detection":
((PreferencesActivity)getActivity()).detectHeadset(((TwoStatePreference) preference).isChecked());
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) preference).isChecked());
return true;
case "enable_steal_remote_control":
PlaybackService.Client.restartService(getActivity());
return true;
}
return super.onPreferenceTreeClick(preference);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "aout":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
}
}
}
\ No newline at end of file
......@@ -100,6 +100,9 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
case "subtitles_category":
loadFragment(new PreferencesSubtitles());
break;
case "audio_category":
loadFragment(new PreferencesAudio());
break;
case "perf_category":
loadFragment(new PreferencesPerformances());
break;
......
......@@ -23,15 +23,11 @@
package org.videolan.vlc.gui.preferences;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.TwoStatePreference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.util.VLCInstance;
public class PreferencesUi extends BasePreferenceFragment {
......@@ -53,9 +49,7 @@ public class PreferencesUi extends BasePreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("tv_ui").setVisible(AndroidUtil.isJellyBeanMR1OrLater());
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) findPreference("enable_headset_detection")).isChecked());
}
@Override
......@@ -63,13 +57,6 @@ public class PreferencesUi extends BasePreferenceFragment {
if (preference.getKey() == null)
return false;
switch (preference.getKey()){
case "enable_headset_detection":
((PreferencesActivity)getActivity()).detectHeadset(((TwoStatePreference) preference).isChecked());
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) preference).isChecked());
return true;
case "enable_steal_remote_control":
PlaybackService.Client.restartService(getActivity());
return true;
case "tv_ui":
((PreferencesActivity) getActivity()).setRestart();
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment