[Android] Equalizer: fix a layout initialization bug of the preset spinner
Adrien Maglo
git at videolan.org
Thu Feb 6 17:07:37 CET 2014
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Feb 6 17:07:28 2014 +0100| [d368611af0c84abaedc7286537fa4d83dba88ffa] | committer: Adrien Maglo
Equalizer: fix a layout initialization bug of the preset spinner
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d368611af0c84abaedc7286537fa4d83dba88ffa
---
.../src/org/videolan/vlc/gui/audio/EqualizerFragment.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
index 8a1c377..1ad3d16 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
@@ -112,12 +112,14 @@ public class EqualizerFragment extends SherlockFragment {
// presets
equalizer_presets.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_dropdown_item, presets));
- equalizer_presets.setSelection(preferences.getInt("equalizer_preset", 0), false);
- // set listener asynchronously to prevent the listener from being fired during spinner init
+ equalizer_presets.setOnItemSelectedListener(mPresetListener);
+
+ // Set the default selection asynchronously to prevent a layout initialization bug.
+ final int equalizer_preset_pref = preferences.getInt("equalizer_preset", 0);
equalizer_presets.post(new Runnable() {
@Override
public void run() {
- equalizer_presets.setOnItemSelectedListener(mPresetListener);
+ equalizer_presets.setSelection(equalizer_preset_pref, false);
}
});
More information about the Android
mailing list