summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java6
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java49
-rw-r--r--src_pd/com/android/gallery3d/util/XmpUtilHelper.java4
3 files changed, 58 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 7a7645a28..2851a2e74 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -345,6 +345,12 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
pickImage();
}
+ View tinyPlanetView = listColors.findViewById(R.id.tinyplanetButton);
+
+ if (tinyPlanetView != null && !mImageLoader.isLightCycle360()) {
+ tinyPlanetView.setVisibility(View.GONE);
+ }
+
String action = intent.getAction();
if (action.equalsIgnoreCase(CROP_ACTION)){
mPanelController.showComponent(findViewById(R.id.cropButton));
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;
+ }
+ }
+
}
diff --git a/src_pd/com/android/gallery3d/util/XmpUtilHelper.java b/src_pd/com/android/gallery3d/util/XmpUtilHelper.java
index 7cbd7f170..88b813dea 100644
--- a/src_pd/com/android/gallery3d/util/XmpUtilHelper.java
+++ b/src_pd/com/android/gallery3d/util/XmpUtilHelper.java
@@ -16,11 +16,13 @@
package com.android.gallery3d.util;
+import com.adobe.xmp.XMPMeta;
+
import java.io.InputStream;
public class XmpUtilHelper {
- public static Object extractXMPMeta(InputStream is) {
+ public static XMPMeta extractXMPMeta(InputStream is) {
return null;
}