summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2012-10-22 16:26:26 -0700
committerJohn Hoford <hoford@google.com>2012-10-22 19:51:43 -0700
commit072e41e2c00abdc8f7e780679b5a943d41c6f1e6 (patch)
treea674bbd9e7d0f2e03baaacc45ecf404fd40805c3 /src/com/android/gallery3d/filtershow/cache/ImageLoader.java
parenta1988ea0257872c07900a125a056427bb27258fe (diff)
downloadandroid_packages_apps_Snap-072e41e2c00abdc8f7e780679b5a943d41c6f1e6.tar.gz
android_packages_apps_Snap-072e41e2c00abdc8f7e780679b5a943d41c6f1e6.tar.bz2
android_packages_apps_Snap-072e41e2c00abdc8f7e780679b5a943d41c6f1e6.zip
on entry check if Tiny Planet if not remove UI
bug:7391885 Change-Id: Ic2bffa9f9fbaa2d437ce231a1478a1b63a0eed83
Diffstat (limited to 'src/com/android/gallery3d/filtershow/cache/ImageLoader.java')
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
index 032c4f78d..40bffb243 100644
--- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
+++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
@@ -31,6 +31,11 @@ import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
+import com.adobe.xmp.XMPException;
+import com.adobe.xmp.XMPIterator;
+import com.adobe.xmp.XMPMeta;
+import com.adobe.xmp.properties.XMPProperty;
+import com.adobe.xmp.properties.XMPPropertyInfo;
import com.android.gallery3d.R;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.filtershow.FilterShowActivity;
@@ -392,4 +397,48 @@ public class ImageLoader {
return null;
}
}
+
+ /**
+ * Determine if this is a light cycle 360 image
+ *
+ * @return true if it is a light Cycle image that is full 360
+ */
+ public boolean isLightCycle360() {
+ try {
+ InputStream is = mContext.getContentResolver().openInputStream(getUri());
+ XMPMeta meta = XmpUtilHelper.extractXMPMeta(is);
+ if (meta == null) {
+ return false;
+ }
+ String name = meta.getPacketHeader();
+ try {
+ String namespace = "http://ns.google.com/photos/1.0/panorama/";
+ String cropWidthName = "GPano:CroppedAreaImageWidthPixels";
+ String fullWidthName = "GPano:FullPanoWidthPixels";
+
+ if (!meta.doesPropertyExist(namespace, cropWidthName)) {
+ return false;
+ }
+ if (!meta.doesPropertyExist(namespace, fullWidthName)) {
+ return false;
+ }
+
+ Integer cropValue = meta.getPropertyInteger(namespace, cropWidthName);
+ Integer fullValue = meta.getPropertyInteger(namespace, fullWidthName);
+
+ // Definition of a 360:
+ // GFullPanoWidthPixels == CroppedAreaImageWidthPixels
+ if (cropValue != null && fullValue != null) {
+ return cropValue.equals(fullValue);
+ }
+
+ return false;
+ } catch (XMPException e) {
+ return false;
+ }
+ } catch (FileNotFoundException e) {
+ return false;
+ }
+ }
+
}