summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-01-25 17:42:09 +0800
committerWu-cheng Li <wuchengli@google.com>2011-01-25 17:51:18 +0800
commit75c11984594546002610c9f076520414ae4b6d4d (patch)
tree74c29a933ca2cbaf34f8f3d4be292f1472c54cfd /src/com/android/camera
parentb5aaedd0e300f103f73907ec9bdfcc6b1231eef3 (diff)
downloadLegacyCamera-75c11984594546002610c9f076520414ae4b6d4d.zip
LegacyCamera-75c11984594546002610c9f076520414ae4b6d4d.tar.gz
LegacyCamera-75c11984594546002610c9f076520414ae4b6d4d.tar.bz2
Fix NPE in BasicSettingPopup.
The monkey test sends DPAD_CENTER event and brings up the soft keyboard. The layout will change and the basic setting popup may have fewer children than items. In fact, setActiviated is called by ListView and we do not need to call it. Also add stateAlwaysHidden to make sure soft keyboard is always hidden. bug:3383128 Change-Id: I8032ff4680af7617c1568632af1c1678a04a04f8
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/Camera.java2
-rw-r--r--src/com/android/camera/ui/BasicSettingPopup.java15
2 files changed, 7 insertions, 10 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 5fdf8a5..84456e3 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1630,6 +1630,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
return;
}
+ Log.v(TAG, "surfaceChanged. w=" + w + ". h=" + h);
+
// We need to save the holder for later use, even when the mCameraDevice
// is null. This could happen if onResume() is invoked after this
// function.
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);
}
}