summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-11-11 20:37:39 +0800
committerWu-cheng Li <wuchengli@google.com>2010-11-12 12:43:48 +0800
commit1f09dac3d664734d099765783dae1233ef023226 (patch)
tree29f7d3a0ff6a860b3a3df4172ceccb070811bab5 /src
parent2c111a30c3a6bc6da85f092abb1111a24b166cb9 (diff)
downloadLegacyCamera-1f09dac3d664734d099765783dae1233ef023226.zip
LegacyCamera-1f09dac3d664734d099765783dae1233ef023226.tar.gz
LegacyCamera-1f09dac3d664734d099765783dae1233ef023226.tar.bz2
Fix the crash on tapping settings button when in front camera mode.
bug:3166485 Change-Id: I1c89a1fbfd5689d9881a7e62e4fac91770728368
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java3
-rw-r--r--src/com/android/camera/VideoCamera.java2
-rw-r--r--src/com/android/camera/ui/ControlPanel.java13
-rw-r--r--src/com/android/camera/ui/OtherSettingsPopup.java10
4 files changed, 24 insertions, 4 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index c776225..f99407c 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1111,6 +1111,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
// ignore
}
+ // Do this after starting preview because it depends on camera
+ // parameters.
initializeControlPanel();
}
@@ -2285,6 +2287,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
if (mFirstTimeInitialized) {
initializeHeadUpDisplay();
}
+ initializeControlPanel();
}
private boolean switchToVideoMode() {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index e2732e3..6ce1641 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1224,6 +1224,7 @@ public class VideoCamera extends NoSearchActivity
// Reload the UI.
initializeHeadUpDisplay();
+ initializeControlPanel();
if (mSurfaceHolder != null) {
mHandler.sendEmptyMessage(INIT_RECORDER);
@@ -1251,6 +1252,7 @@ public class VideoCamera extends NoSearchActivity
// Reload the UI.
initializeHeadUpDisplay();
+ initializeControlPanel();
if (mSurfaceHolder != null) {
mHandler.sendEmptyMessage(INIT_RECORDER);
diff --git a/src/com/android/camera/ui/ControlPanel.java b/src/com/android/camera/ui/ControlPanel.java
index b280de7..cdd00d9 100644
--- a/src/com/android/camera/ui/ControlPanel.java
+++ b/src/com/android/camera/ui/ControlPanel.java
@@ -83,9 +83,19 @@ public class ControlPanel extends RelativeLayout
public void initialize(Context context, PreferenceGroup group,
String[] keys, boolean enableOtherSettings) {
+ // Reset the variables and states.
+ hideSettingPicker();
+ if (mIndicatorWheel != null) {
+ // The first view is the shutter button.
+ mIndicatorWheel.removeViews(1, mIndicatorWheel.getChildCount() - 1);
+ }
+ mOtherSettingsPopup = null;
+ mSettingPickers = null;
+ mActiveIndicator = -1;
+
+ // Initialize all variables and icons.
mPreferenceGroup = group;
mPreferenceKeys = keys;
- // Add one more for other settings.
mSettingPickers = new BasicSettingPicker[mPreferenceKeys.length];
mIndicatorWheel = (IndicatorWheel) findViewById(R.id.indicator_wheel);
mThumbnailList = (ListView) findViewById(R.id.thumbnail_list);
@@ -122,6 +132,7 @@ public class ControlPanel extends RelativeLayout
break;
}
}
+
public void onIndicatorClicked(int index) {
if (!mEnabled) return;
if (index < mSettingPickers.length) {
diff --git a/src/com/android/camera/ui/OtherSettingsPopup.java b/src/com/android/camera/ui/OtherSettingsPopup.java
index f5a83ef..feacb6b 100644
--- a/src/com/android/camera/ui/OtherSettingsPopup.java
+++ b/src/com/android/camera/ui/OtherSettingsPopup.java
@@ -47,12 +47,16 @@ public class OtherSettingsPopup extends PopupWindow
public void initialize(PreferenceGroup group) {
TableLayout table = (TableLayout) getContentView();
// Initialize each camera setting.
- for (int i = 0; i < table.getChildCount(); i++) {
+ for (int i = table.getChildCount() - 1; i >= 0 ; i--) {
TableRow row = (TableRow) table.getChildAt(i);
InLineSettingPicker picker = (InLineSettingPicker) row.getChildAt(1);
ListPreference pref = group.findPreference(picker.getKey());
- picker.setSettingChangedListener(this);
- picker.initialize(pref);
+ if (pref != null) {
+ picker.setSettingChangedListener(this);
+ picker.initialize(pref);
+ } else { // remove the row if the preference is not supported
+ table.removeViewAt(i);
+ }
}
}