summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Util.java
diff options
context:
space:
mode:
authorSascha Haeberling <haeberling@google.com>2013-08-06 14:31:52 -0700
committerSascha Haeberling <haeberling@google.com>2013-08-06 14:58:07 -0700
commit37f3611bbdc787c996a99894dcef7d8fb77e3f7c (patch)
tree4dc08a60a543dc4d2b0672a8c0cc4efdc30b52ad /src/com/android/camera/Util.java
parent8fe71f31bc8ab1b634566a3060e041e22e9b2e41 (diff)
downloadandroid_packages_apps_Snap-37f3611bbdc787c996a99894dcef7d8fb77e3f7c.tar.gz
android_packages_apps_Snap-37f3611bbdc787c996a99894dcef7d8fb77e3f7c.tar.bz2
android_packages_apps_Snap-37f3611bbdc787c996a99894dcef7d8fb77e3f7c.zip
This adds the following four CLs to Camera2:
http://ag/339319 http://ag/338974 http://ag/338401 http://ag/324149 Adapted to work in Camera2 and adding a .gitignore so that temporary Eclipse files and folders are not submitted. Change-Id: I40295c7f0139f76270c44f0ca395c0574a288569
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r--src/com/android/camera/Util.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 43ad22e17..11176a79b 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -24,7 +24,6 @@ import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
-import com.android.camera2.R;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
@@ -62,7 +61,8 @@ import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.Toast;
-import com.android.camera.support.common.ApiHelper;
+import com.android.camera2.R;
+import com.android.gallery3d.common.ApiHelper;
/**
* Collection of utility functions used in this package.
@@ -89,8 +89,8 @@ public class Util {
public static final String TRUE = "true";
public static final String FALSE = "false";
- /** Has to by in sync with the receiving MovieActivity. */
- public static final String KEY_TREAT_UP_AS_BACK = "treat-up-as-back";
+ /** Has to be in sync with the receiving MovieActivity. */
+ public static final String KEY_TREAT_UP_AS_BACK = "treat-up-as-back";
public static boolean isSupported(String value, List<String> supported) {
return supported == null ? false : supported.indexOf(value) >= 0;
@@ -711,6 +711,19 @@ public class Util {
return rotation;
}
+ /**
+ * Down-samples a jpeg byte array.
+ * @param data a byte array of jpeg data
+ * @param downSampleFactor down-sample factor
+ * @return decoded and down-sampled bitmap
+ */
+ public static Bitmap downSample(final byte[] data, int downSampleFactor) {
+ final BitmapFactory.Options opts = new BitmapFactory.Options();
+ // Downsample the image
+ opts.inSampleSize = downSampleFactor;
+ return BitmapFactory.decodeByteArray(data, 0, data.length, opts);
+ }
+
public static void setGpsParameters(Parameters parameters, Location loc) {
// Clear previous GPS location from the parameters.
parameters.removeGpsData();