diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-01-25 19:26:15 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-25 19:26:15 -0800 |
commit | de0d58c0368407e37181c8236cc31c2da8b3491b (patch) | |
tree | d6f561edffa124956edb950bb599dcff87d50758 /src/com/android/camera/ui | |
parent | e4ddd4c0ab7ae98541c1baa4da20a29c1915b6b5 (diff) | |
parent | 75c11984594546002610c9f076520414ae4b6d4d (diff) | |
download | LegacyCamera-de0d58c0368407e37181c8236cc31c2da8b3491b.zip LegacyCamera-de0d58c0368407e37181c8236cc31c2da8b3491b.tar.gz LegacyCamera-de0d58c0368407e37181c8236cc31c2da8b3491b.tar.bz2 |
Merge "Fix NPE in BasicSettingPopup." into honeycomb
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r-- | src/com/android/camera/ui/BasicSettingPopup.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/com/android/camera/ui/BasicSettingPopup.java b/src/com/android/camera/ui/BasicSettingPopup.java index b3dfb77..83c5f95 100644 --- a/src/com/android/camera/ui/BasicSettingPopup.java +++ b/src/com/android/camera/ui/BasicSettingPopup.java @@ -76,6 +76,11 @@ public class BasicSettingPopup extends AbstractSettingPopup implements ((ListView) mSettingList).setAdapter(listItemAdapter); ((ListView) mSettingList).setOnItemClickListener(this); ((ListView) mSettingList).setSelector(android.R.color.transparent); + int index = mPreference.findIndexOfValue(mPreference.getValue()); + if (index != -1) { + ((ListView) mSettingList).setItemChecked(index, true); + } + } public void setSettingChangedListener(Listener listener) { @@ -83,14 +88,6 @@ public class BasicSettingPopup extends AbstractSettingPopup implements } @Override - public void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - int index = mPreference.findIndexOfValue(mPreference.getValue()); - View selected = ((ListView) mSettingList).getChildAt(index); - if (selected != null) selected.setActivated(true); - } - - @Override public void onItemClick(AdapterView<?> parent, View view, int index, long id) { // If popup window is dismissed, ignore the event. This may happen when @@ -99,10 +96,8 @@ public class BasicSettingPopup extends AbstractSettingPopup implements int oldIndex = mPreference.findIndexOfValue(mPreference.getValue()); if (oldIndex != index) { - ((LinearLayout) parent.getChildAt(oldIndex)).setActivated(false); mPreference.setValueIndex(index); if (mListener != null) mListener.onSettingChanged(); } - view.setActivated(true); } } |