summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/util
diff options
context:
space:
mode:
authorEmilian Peev <epeevs@codeaurora.org>2014-03-17 16:34:20 -0700
committerIvan Evlogiev <ivanevlogiev@codeaurora.org>2014-06-26 18:01:27 +0300
commitde5dd90a48875ed84371da6eb4354826a3b429e2 (patch)
tree5b5a3238817f2bcd054cc5042e8c9c156b049db2 /src/com/android/camera/util
parent03dbeabed74dce7485bcb3f4807fe4105e96830a (diff)
downloadandroid_packages_apps_Snap-de5dd90a48875ed84371da6eb4354826a3b429e2.tar.gz
android_packages_apps_Snap-de5dd90a48875ed84371da6eb4354826a3b429e2.tar.bz2
android_packages_apps_Snap-de5dd90a48875ed84371da6eb4354826a3b429e2.zip
Camera: Initial Refocus support
Refocus mode is enabled which expects 7 snapshots in burst from the camera. The captured images are stored with custom names. Change-Id: I7c1f9ef15d710118f7089c2fc584da450ab0984c
Diffstat (limited to 'src/com/android/camera/util')
-rw-r--r--src/com/android/camera/util/CameraUtil.java43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index d90b52552..bb7639f9f 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -720,9 +720,15 @@ public class CameraUtil {
matrix.setConcat(mapping, matrix);
}
+ public static String createJpegName(long dateTaken, boolean refocus) {
+ synchronized (sImageFileNamer) {
+ return sImageFileNamer.generateName(dateTaken, refocus);
+ }
+ }
+
public static String createJpegName(long dateTaken) {
synchronized (sImageFileNamer) {
- return sImageFileNamer.generateName(dateTaken);
+ return sImageFileNamer.generateName(dateTaken, false);
}
}
@@ -903,6 +909,12 @@ public class CameraUtil {
private static class ImageFileNamer {
private final SimpleDateFormat mFormat;
+ private final int REFOCUS_DEPTHMAP_IDX = 5;
+ private final String REFOCUS_DEPTHMAP_SUFFIX = "DepthMap";
+ private final int REFOCUS_ALLFOCUS_IDX = 6;
+ private final String REFOCUS_ALLFOCUS_SUFFIX = "Allfocus";
+ private int mRefocusIdx = 0;
+
// The date (in milliseconds) used to generate the last name.
private long mLastDate;
@@ -913,18 +925,31 @@ public class CameraUtil {
mFormat = new SimpleDateFormat(format);
}
- public String generateName(long dateTaken) {
+ public String generateName(long dateTaken, boolean refocus) {
Date date = new Date(dateTaken);
String result = mFormat.format(date);
- // If the last name was generated for the same second,
- // we append _1, _2, etc to the name.
- if (dateTaken / 1000 == mLastDate / 1000) {
- mSameSecondCount++;
- result += "_" + mSameSecondCount;
+ if (refocus) {
+ if (mRefocusIdx == REFOCUS_DEPTHMAP_IDX) {
+ result += "_" + REFOCUS_DEPTHMAP_SUFFIX;
+ mRefocusIdx++;
+ } else if (mRefocusIdx == REFOCUS_ALLFOCUS_IDX) {
+ result += "_" + REFOCUS_ALLFOCUS_SUFFIX;
+ mRefocusIdx = 0;
+ } else {
+ result += "_" + mRefocusIdx;
+ mRefocusIdx++;
+ }
} else {
- mLastDate = dateTaken;
- mSameSecondCount = 0;
+ // If the last name was generated for the same second,
+ // we append _1, _2, etc to the name.
+ if (dateTaken / 1000 == mLastDate / 1000) {
+ mSameSecondCount++;
+ result += "_" + mSameSecondCount;
+ } else {
+ mLastDate = dateTaken;
+ mSameSecondCount = 0;
+ }
}
return result;