[Android] PreferencesActivity: setDefaultValue doesn't work here, so force the value if it's not set
Sébastien Toque
git at videolan.org
Sun Dec 16 10:11:15 CET 2012
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun Dec 16 10:10:31 2012 +0100| [d0eed7152d92b0e82875248a0233efe1597a16f2] | committer: Sébastien Toque
PreferencesActivity: setDefaultValue doesn't work here, so force the value if it's not set
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d0eed7152d92b0e82875248a0233efe1597a16f2
---
vlc-android/res/xml/preferences.xml | 1 -
vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/vlc-android/res/xml/preferences.xml b/vlc-android/res/xml/preferences.xml
index cf42736..d95b5ac 100644
--- a/vlc-android/res/xml/preferences.xml
+++ b/vlc-android/res/xml/preferences.xml
@@ -58,7 +58,6 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/advanced_prefs_category">
<ListPreference
- android:defaultValue="@string/aout_audiotrack_java"
android:key="aout"
android:title="@string/aout" />
<CheckBoxPreference
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index fbe017e..15fb381 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -160,10 +160,10 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
int aoutEntriesIdValues = Util.isGingerbreadOrLater() ? R.array.aouts_values : R.array.aouts_values_froyo;
aoutPref.setEntries(aoutEntriesId);
aoutPref.setEntryValues(aoutEntriesIdValues);
- if(Util.isGingerbreadOrLater())
- aoutPref.setDefaultValue(2/*AOUT_OPENSLES*/);
- else
- aoutPref.setDefaultValue(0/*AOUT_AUDIOTRACK_JAVA*/);
+ if (aoutPref.getValue() == null)
+ aoutPref.setValue(Util.isGingerbreadOrLater()
+ ? "2"/*AOUT_OPENSLES*/
+ : "0"/*AOUT_AUDIOTRACK_JAVA*/);
// Attach debugging items
Preference quitAppPref = findPreference("quit_app");
More information about the Android
mailing list