diff options
author | Sascha Haeberling <haeberling@google.com> | 2013-08-08 11:27:09 -0700 |
---|---|---|
committer | Sascha Haeberling <haeberling@google.com> | 2013-08-08 18:31:53 -0700 |
commit | 723bf81990245a07739146ac10357703c9839de1 (patch) | |
tree | 0c86a8a133077db5191907a760d5f4b3ab441b77 /src/com/android/gallery3d/data | |
parent | a6b80cccafe0a4c2de575ec69d1960c3c0d88062 (diff) | |
download | android_packages_apps_Gallery2-723bf81990245a07739146ac10357703c9839de1.tar.gz android_packages_apps_Gallery2-723bf81990245a07739146ac10357703c9839de1.tar.bz2 android_packages_apps_Gallery2-723bf81990245a07739146ac10357703c9839de1.zip |
Remove Camera from Gallery2.
Change-Id: I89adebffcacd1269217d7bd8c630c2f78886f590
Diffstat (limited to 'src/com/android/gallery3d/data')
-rw-r--r-- | src/com/android/gallery3d/data/Exif.java | 44 | ||||
-rw-r--r-- | src/com/android/gallery3d/data/LocalImage.java | 5 |
2 files changed, 42 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/data/Exif.java b/src/com/android/gallery3d/data/Exif.java index 950e7de18..20f072454 100644 --- a/src/com/android/gallery3d/data/Exif.java +++ b/src/com/android/gallery3d/data/Exif.java @@ -24,9 +24,11 @@ import java.io.IOException; import java.io.InputStream; public class Exif { - private static final String TAG = "CameraExif"; + private static final String TAG = "GalleryExif"; - // Returns the degrees in clockwise. Values are 0, 90, 180, or 270. + /** + * Returns the degrees in clockwise. Values are 0, 90, 180, or 270. + */ public static int getOrientation(InputStream is) { if (is == null) { return 0; @@ -45,4 +47,42 @@ public class Exif { return 0; } } + + /** + * Returns an exif interface instance for the given JPEG image. + * + * @param jpegData a valid JPEG image containing EXIF data + */ + public static ExifInterface getExif(byte[] jpegData) { + ExifInterface exif = new ExifInterface(); + try { + exif.readExif(jpegData); + } catch (IOException e) { + Log.w(TAG, "Failed to read EXIF data", e); + } + return exif; + } + + /** + * Returns the degrees in clockwise. Values are 0, 90, 180, or 270. + */ + public static int getOrientation(ExifInterface exif) { + Integer val = exif.getTagIntValue(ExifInterface.TAG_ORIENTATION); + if (val == null) { + return 0; + } else { + return ExifInterface.getRotationForOrientationValue(val.shortValue()); + } + } + + /** + * See {@link #getOrientation(byte[])}, but using the picture bytes instead. + */ + public static int getOrientation(byte[] jpegData) { + if (jpegData == null) + return 0; + + ExifInterface exif = getExif(jpegData); + return getOrientation(exif); + } } diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java index cc70dd457..94cb05936 100644 --- a/src/com/android/gallery3d/data/LocalImage.java +++ b/src/com/android/gallery3d/data/LocalImage.java @@ -32,7 +32,6 @@ import android.util.Log; import com.android.gallery3d.app.GalleryApp; import com.android.gallery3d.app.PanoramaMetadataSupport; -import com.android.gallery3d.app.StitchingProgressManager; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.exif.ExifInterface; @@ -237,10 +236,6 @@ public class LocalImage extends LocalMediaItem { @Override public int getSupportedOperations() { - StitchingProgressManager progressManager = mApplication.getStitchingProgressManager(); - if (progressManager != null && progressManager.getProgress(getContentUri()) != null) { - return 0; // doesn't support anything while stitching! - } int operation = SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_CROP | SUPPORT_SETAS | SUPPORT_EDIT | SUPPORT_INFO; if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) { |