[Android] PreferencesActivity: reflect defaults in GUI

Edward Wang git at videolan.org
Sat Jun 22 18:44:47 CEST 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Jun 22 12:41:05 2013 -0400| [5d9ad9eb07e368a99089b50725586d54dd754cbb] | committer: Edward Wang

PreferencesActivity: reflect defaults in GUI

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5d9ad9eb07e368a99089b50725586d54dd754cbb
---

 vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index 3847d68..923d279 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -59,6 +59,8 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+        boolean deblocking_exists = sharedPrefs.contains("enable_deblocking");
         addPreferencesFromResource(R.xml.preferences);
 
         // Directories
@@ -182,6 +184,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
             aoutPref.setValue(Util.isGingerbreadOrLater()
                     ? "2"/*AOUT_OPENSLES*/
                             : "0"/*AOUT_AUDIOTRACK_JAVA*/);
+        // Deblocking
+        CheckBoxPreference deblockingPref = (CheckBoxPreference) findPreference("enable_deblocking");
+        if(!deblocking_exists) {
+            deblockingPref.setChecked(Util.deblockingDefault());
+        }
         // Set locale
         EditTextPreference setLocalePref = (EditTextPreference) findPreference("set_locale");
         setLocalePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@@ -194,7 +201,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
         });
 
         /*** SharedPreferences Listener to apply changes ***/
-        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
         sharedPrefs.registerOnSharedPreferenceChangeListener(this);
     }
 



More information about the Android mailing list