summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/util/CameraUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/util/CameraUtil.java')
-rw-r--r--src/com/android/camera/util/CameraUtil.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 707a3e268..416f828a6 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -1211,4 +1211,23 @@ public class CameraUtil {
}
return cameraModeParent[modeIndex];
}
+
+ /**
+ * Gets the mode cover icon resource id of a specific mode.
+ *
+ * @param modeIndex index of the mode
+ * @param context current context
+ * @return icon resource id if the index is valid, otherwise 0
+ */
+ public static int getCameraModeCoverIconResId(int modeIndex, Context context) {
+ // Find the camera mode icon using id
+ TypedArray cameraModesIcons = context.getResources()
+ .obtainTypedArray(R.array.camera_mode_cover_icon);
+ if (modeIndex >= cameraModesIcons.length() || modeIndex < 0) {
+ // Mode index not found
+ Log.e(TAG, "Invalid mode index: " + modeIndex);
+ return 0;
+ }
+ return cameraModesIcons.getResourceId(modeIndex, 0);
+ }
}