[Android] PreferencesActivity: Java cleanup

Edward Wang git at videolan.org
Wed Mar 13 19:08:57 CET 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Mar 13 12:40:05 2013 -0400| [2a227dd7f482b3db6a9e2b9feee4667333ef36d7] | committer: Edward Wang

PreferencesActivity: Java cleanup

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

 .../org/videolan/vlc/gui/PreferencesActivity.java  |   63 ++++++++++----------
 1 file changed, 30 insertions(+), 33 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index c2981db..bf43310 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -75,7 +75,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
                     }
                 });
 
-        // Screen Orientation
+        // Screen orientation
         ListPreference screenOrientationPref = (ListPreference) findPreference("screen_orientation");
         screenOrientationPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
             @Override
@@ -138,9 +138,8 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
 
         // Clear media library
         Preference clearMediaPref = findPreference("clear_media_db");
-        clearMediaPref.setOnPreferenceClickListener(
-                new OnPreferenceClickListener() {
-
+        clearMediaPref
+                .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                     @Override
                     public boolean onPreferenceClick(Preference preference) {
                         DatabaseManager.getInstance(getBaseContext()).emptyDatabase();
@@ -149,17 +148,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
                     }
                 });
 
-        // Audio output
-        ListPreference aoutPref = (ListPreference) findPreference("aout");
-        int aoutEntriesId = Util.isGingerbreadOrLater() ? R.array.aouts : R.array.aouts_froyo;
-        int aoutEntriesIdValues = Util.isGingerbreadOrLater() ? R.array.aouts_values : R.array.aouts_values_froyo;
-        aoutPref.setEntries(aoutEntriesId);
-        aoutPref.setEntryValues(aoutEntriesIdValues);
-        if (aoutPref.getValue() == null)
-            aoutPref.setValue(Util.isGingerbreadOrLater()
-                    ? "2"/*AOUT_OPENSLES*/
-                            : "0"/*AOUT_AUDIOTRACK_JAVA*/);
-
         // Change verbosity (logcat)
         CheckBoxPreference checkboxVerbosity = (CheckBoxPreference) findPreference("enable_verbose_mode");
         checkboxVerbosity.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@@ -179,18 +167,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
             }
         });
 
-        //Set locale
-        EditTextPreference setLocalePref = (EditTextPreference) findPreference("set_locale");
-        setLocalePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
-
-            @Override
-            public boolean onPreferenceChange(Preference preference, Object newValue) {
-                Toast.makeText(getBaseContext(), R.string.set_locale_popup, Toast.LENGTH_SHORT).show();
-                return true;
-            }
-        });
-
-        // Attach debugging items
+        /*** Attach debugging items **/
         Preference quitAppPref = findPreference("quit_app");
         quitAppPref.setOnPreferenceClickListener(
                 new OnPreferenceClickListener() {
@@ -201,19 +178,39 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
                         return true;
                     }
                 });
+        // Audio output
+        ListPreference aoutPref = (ListPreference) findPreference("aout");
+        int aoutEntriesId = Util.isGingerbreadOrLater() ? R.array.aouts : R.array.aouts_froyo;
+        int aoutEntriesIdValues = Util.isGingerbreadOrLater() ? R.array.aouts_values : R.array.aouts_values_froyo;
+        aoutPref.setEntries(aoutEntriesId);
+        aoutPref.setEntryValues(aoutEntriesIdValues);
+        if (aoutPref.getValue() == null)
+            aoutPref.setValue(Util.isGingerbreadOrLater()
+                    ? "2"/*AOUT_OPENSLES*/
+                            : "0"/*AOUT_AUDIOTRACK_JAVA*/);
+        // Set locale
+        EditTextPreference setLocalePref = (EditTextPreference) findPreference("set_locale");
+        setLocalePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+
+            @Override
+            public boolean onPreferenceChange(Preference preference, Object newValue) {
+                Toast.makeText(getBaseContext(), R.string.set_locale_popup, Toast.LENGTH_SHORT).show();
+                return true;
+            }
+        });
 
-        // SharedPreferences Listener to apply changes
+        /*** SharedPreferences Listener to apply changes ***/
         SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
         sharedPrefs.registerOnSharedPreferenceChangeListener(this);
     }
 
     @Override
     public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
-        if (key.equalsIgnoreCase("enable_iomx") ||
-                key.equalsIgnoreCase("subtitles_text_encoding") ||
-                key.equalsIgnoreCase("aout") ||
-                key.equalsIgnoreCase("enable_time_stretching_audio") ||
-                key.equalsIgnoreCase("chroma_format")) {
+        if(key.equalsIgnoreCase("enable_iomx")
+                || key.equalsIgnoreCase("subtitles_text_encoding")
+                || key.equalsIgnoreCase("aout")
+                || key.equalsIgnoreCase("enable_time_stretching_audio")
+                || key.equalsIgnoreCase("chroma_format")) {
             LibVLC.restart();
         }
     }



More information about the Android mailing list