diff options
author | Owen Lin <owenlin@google.com> | 2009-11-19 13:24:55 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2009-11-20 11:00:22 +0800 |
commit | 503560f0dc42d6185c61be06f8060dfd50d30d69 (patch) | |
tree | 8c6a10f96c8a3d5b455cb8b86e94a7709aca4630 | |
parent | 3e44f8076a16792bb295589ca4b467ba27ea2a6f (diff) | |
download | LegacyCamera-503560f0dc42d6185c61be06f8060dfd50d30d69.zip LegacyCamera-503560f0dc42d6185c61be06f8060dfd50d30d69.tar.gz LegacyCamera-503560f0dc42d6185c61be06f8060dfd50d30d69.tar.bz2 |
Keep space for those empty icons but hide them if the feature is not
supported.
fix bug: http://b/2250438
Change-Id: I79eb9d575cf275c25decc6236b80f61ecfdf3042
-rw-r--r-- | res/layout/camera.xml | 18 | ||||
-rw-r--r-- | res/values/arrays.xml | 18 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | res/values/styles.xml | 1 | ||||
-rw-r--r-- | src/com/android/camera/Camera.java | 22 | ||||
-rw-r--r-- | src/com/android/camera/IconIndicator.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 7 |
7 files changed, 56 insertions, 22 deletions
diff --git a/res/layout/camera.xml b/res/layout/camera.xml index b35761c..199208f 100644 --- a/res/layout/camera.xml +++ b/res/layout/camera.xml @@ -49,6 +49,8 @@ android:layout_marginLeft="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> + <!-- Thsee icons should be in the same order as the + on-screen menu items --> <com.android.camera.IconIndicator style="@style/IconIndicator" android:id="@+id/gps_icon" @@ -56,24 +58,24 @@ camera:icons="@array/gps_icons"/> <com.android.camera.IconIndicator style="@style/IconIndicator" + android:id="@+id/flash_icon" + camera:modes="@array/flash_modes" + camera:icons="@array/flash_icons"/> + <com.android.camera.IconIndicator + style="@style/IconIndicator" android:id="@+id/scenemode_icon" camera:modes="@array/scenemode_modes" camera:icons="@array/scenemode_icons"/> <com.android.camera.IconIndicator style="@style/IconIndicator" - android:id="@+id/focus_icon" - camera:modes="@array/pref_camera_focusmode_entryvalues" - camera:icons="@array/focusmode_icons"/> - <com.android.camera.IconIndicator - style="@style/IconIndicator" android:id="@+id/whitebalance_icon" camera:modes="@array/pref_camera_whitebalance_entryvalues" camera:icons="@array/whitebalance_icons"/> <com.android.camera.IconIndicator style="@style/IconIndicator" - android:id="@+id/flash_icon" - camera:modes="@array/pref_camera_flashmode_entryvalues" - camera:icons="@array/flash_icons"/> + android:id="@+id/focus_icon" + camera:modes="@array/pref_camera_focusmode_entryvalues" + camera:icons="@array/focusmode_icons"/> </LinearLayout> </FrameLayout> </com.android.camera.PreviewFrameLayout> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 22026a7..fd613ba 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -100,7 +100,7 @@ </array> <array name="focusmode_icons"> - <item>@null</item> + <item>@drawable/ic_viewfinder_empty</item> <item>@drawable/ic_viewfinder_focus_infinity</item> <item>@drawable/ic_viewfinder_focus_macro</item> </array> @@ -134,10 +134,18 @@ <item>@string/pref_camera_recordlocation_entry_on</item> </array> + <string-array name="flash_modes" translatable="false"> + <item>auto</item> + <item>on</item> + <item>off</item> + <item>@string/pref_camera_flashmode_no_flash</item> + </string-array> + <array name="flash_icons"> <item>@drawable/ic_viewfinder_flash_auto</item> <item>@drawable/ic_viewfinder_flash_on</item> - <item>@null</item> + <item>@drawable/ic_viewfinder_flash_off</item> + <item>@drawable/ic_viewfinder_empty</item> </array> <string-array name="gps_modes" translatable="false"> @@ -146,7 +154,7 @@ </string-array> <array name="gps_icons"> - <item>@null</item> + <item>@drawable/ic_viewfinder_empty</item> <item>@drawable/ic_camera_sym_gps</item> </array> @@ -176,7 +184,7 @@ </array> <array name="whitebalance_icons"> - <item>@null</item> + <item>@drawable/ic_viewfinder_empty</item> <item>@drawable/ic_viewfinder_wb_incandescent</item> <item>@drawable/ic_viewfinder_wb_daylight</item> <item>@drawable/ic_viewfinder_wb_fluorescent</item> @@ -251,7 +259,7 @@ </string-array> <array name="scenemode_icons"> - <item>@null</item> + <item>@drawable/ic_viewfinder_empty</item> <item>@drawable/ic_viewfinder_scenemode</item> </array> diff --git a/res/values/strings.xml b/res/values/strings.xml index 4b569a9..b40c1d9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -394,6 +394,9 @@ <!-- Default flash mode setting.--> <string name="pref_camera_flashmode_default" translatable="false">auto</string> + <!-- Value for flash off setting--> + <string name="pref_camera_flashmode_no_flash" translatable="false">no_flash</string> + <!-- Settings screen, Flash mode title --> <string name="pref_camera_flashmode_title">Flash mode</string> diff --git a/res/values/styles.xml b/res/values/styles.xml index e18658d..8311284 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -79,7 +79,6 @@ <item name="android:windowExitAnimation">@null</item> </style> <style name="IconIndicator"> - <item name="android:visibility">gone</item> <item name="android:layout_marginTop">10dp</item> <item name="android:layout_marginBottom">10dp</item> <item name="android:layout_width">wrap_content</item> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 7e2d69b..3de6bae 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -981,6 +981,25 @@ public class Camera extends Activity implements View.OnClickListener, } catch (InterruptedException ex) { // ignore } + removeUnsupportedIndicators(); + } + + private void removeUnsupportedIndicators() { + if (mParameters.getSupportedFocusModes() == null) { + mFocusIndicator.setVisibility(View.GONE); + } + + if (mParameters.getSupportedWhiteBalance() == null) { + mWhitebalanceIndicator.setVisibility(View.GONE); + } + + if (mParameters.getSupportedFlashModes() == null) { + mFlashIndicator.setVisibility(View.GONE); + } + + if (mParameters.getSupportedSceneModes() == null) { + mSceneModeIndicator.setVisibility(View.GONE); + } } private class GripperTouchListener implements View.OnTouchListener { @@ -1825,7 +1844,8 @@ public class Camera extends Activity implements View.OnClickListener, } else { flashMode = mParameters.getFlashMode(); if (flashMode == null) { - flashMode = Parameters.FLASH_MODE_OFF; + flashMode = getString( + R.string.pref_camera_flashmode_no_flash); } } diff --git a/src/com/android/camera/IconIndicator.java b/src/com/android/camera/IconIndicator.java index e4500e4..f21269e 100644 --- a/src/com/android/camera/IconIndicator.java +++ b/src/com/android/camera/IconIndicator.java @@ -40,7 +40,7 @@ public class IconIndicator extends ImageView { a.recycle(); setModesAndIcons(modes, icons); - setImageDrawable(mIcons.length > 0 ? mIcons[0]: null); + setImageDrawable(mIcons.length > 0 ? mIcons[0] : null); } public IconIndicator(Context context, AttributeSet attrs) { @@ -70,12 +70,7 @@ public class IconIndicator extends ImageView { public void setMode(String mode) { for (int i = 0, n = mModes.length; i < n; ++i) { if (mModes[i].equals(mode)) { - if (mIcons[i] != null) { - setVisibility(View.VISIBLE); - setImageDrawable(mIcons[i]); - } else { - setVisibility(View.GONE); - } + setImageDrawable(mIcons[i]); return; } } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index f065f90..8effd3c 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -325,6 +325,13 @@ public class VideoCamera extends Activity implements View.OnClickListener, } catch (InterruptedException ex) { // ignore } + removeUnsupportedIndicators(); + } + + private void removeUnsupportedIndicators() { + if (mParameters.getSupportedWhiteBalance() == null) { + mWhitebalanceIndicator.setVisibility(View.GONE); + } } @Override |