diff options
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; } |