diff options
author | Erin Dahlgren <edahlgren@google.com> | 2014-01-16 13:29:42 -0800 |
---|---|---|
committer | Erin Dahlgren <edahlgren@google.com> | 2014-01-16 14:05:30 -0800 |
commit | fecd723c1cfd90332cd2805be79a24f26643ebb9 (patch) | |
tree | c3b0db0d63bba60abef49186d0c9ed13fc467ebf /src/com/android/camera/util/CameraUtil.java | |
parent | 55007febc18832eebf3cedd3d8497f9bcb221b9d (diff) | |
download | android_packages_apps_Camera2-fecd723c1cfd90332cd2805be79a24f26643ebb9.tar.gz android_packages_apps_Camera2-fecd723c1cfd90332cd2805be79a24f26643ebb9.tar.bz2 android_packages_apps_Camera2-fecd723c1cfd90332cd2805be79a24f26643ebb9.zip |
Set the shutter button icon across all modes.
Bug: 12552362
Change-Id: I55d4238b0ddbc4bb3ea206dc577381b6de2f68a7
Diffstat (limited to 'src/com/android/camera/util/CameraUtil.java')
-rw-r--r-- | src/com/android/camera/util/CameraUtil.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index fb33ae536..7af8670f6 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -1051,4 +1051,22 @@ public class CameraUtil { } return cameraModesText[modeIndex]; } + + /** + * Gets the shutter icon res id for a specific mode. + * + * @param modeIndex index of the mode + * @param context current context + * @return mode shutter icon id if the index is valid, otherwise 0. + */ + public static int getCameraShutterIconId(int modeIndex, Context context) { + // Find the camera mode icon using id + TypedArray shutterIcons = context.getResources() + .obtainTypedArray(R.array.camera_mode_shutter_icon); + if (modeIndex < 0 || modeIndex >= shutterIcons.length()) { + Log.e(TAG, "Invalid mode index: " + modeIndex); + return 0; + } + return shutterIcons.getResourceId(modeIndex, 0); + } } |