summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java4
-rw-r--r--src/com/android/gallery3d/data/LocalImage.java21
-rw-r--r--src/com/android/gallery3d/data/MediaItem.java4
-rw-r--r--src/com/android/gallery3d/data/MediaObject.java9
-rw-r--r--src/com/android/gallery3d/data/UriImage.java16
-rw-r--r--src/com/android/gallery3d/ui/ActionModeHandler.java8
-rw-r--r--src/com/android/gallery3d/ui/MenuExecutor.java2
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java2
-rw-r--r--src_pd/com/android/gallery3d/util/LightCycleHelper.java4
9 files changed, 56 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 9bb3934c3..7ded7250a 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -575,11 +575,11 @@ public class PhotoPage extends ActivityState implements
private Intent createSharePanoramaIntent(Path path) {
DataManager manager = mActivity.getDataManager();
int supported = manager.getSupportedOperations(path);
- if ((supported & MediaObject.SUPPORT_PANORAMA) == 0) {
+ if ((supported & MediaObject.SUPPORT_PANORAMA360) == 0) {
return null;
}
Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType(GalleryUtils.MIME_TYPE_PANORAMA);
+ intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
Uri uri = manager.getContentUri(path);
intent.putExtra(Intent.EXTRA_STREAM, uri);
return intent;
diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java
index ffcf9760a..52f707b60 100644
--- a/src/com/android/gallery3d/data/LocalImage.java
+++ b/src/com/android/gallery3d/data/LocalImage.java
@@ -103,6 +103,9 @@ public class LocalImage extends LocalMediaItem {
private boolean mUsePanoramaViewer;
private boolean mUsePanoramaViewerInitialized;
+ private boolean mIsPanorama360;
+ private boolean mIsPanorama360Initialized;
+
public LocalImage(Path path, GalleryApp application, Cursor cursor) {
super(path, nextVersionNumber());
mApplication = application;
@@ -249,8 +252,11 @@ public class LocalImage extends LocalMediaItem {
if (usePanoramaViewer()) {
operation |= SUPPORT_PANORAMA;
- // disable destructive rotate for lightcycle panorama
- operation &= ~SUPPORT_ROTATE;
+ if (isPanorama360()) {
+ operation |= SUPPORT_PANORAMA360;
+ // disable destructive rotate for 360 degree panorama
+ operation &= ~SUPPORT_ROTATE;
+ }
}
return operation;
}
@@ -361,4 +367,15 @@ public class LocalImage extends LocalMediaItem {
}
return mUsePanoramaViewer;
}
+
+ @Override
+ public boolean isPanorama360() {
+ // cache flag for faster access
+ if (!mIsPanorama360Initialized) {
+ mIsPanorama360 = LightCycleHelper.isPanorama360(
+ mApplication.getAndroidContext(), getContentUri());
+ mIsPanorama360Initialized = true;
+ }
+ return mIsPanorama360;
+ }
}
diff --git a/src/com/android/gallery3d/data/MediaItem.java b/src/com/android/gallery3d/data/MediaItem.java
index 77b86b847..da59abeef 100644
--- a/src/com/android/gallery3d/data/MediaItem.java
+++ b/src/com/android/gallery3d/data/MediaItem.java
@@ -107,6 +107,10 @@ public abstract class MediaItem extends MediaObject {
return false;
}
+ public boolean isPanorama360() {
+ return false;
+ }
+
// Returns width and height of the media item.
// Returns 0, 0 if the information is not available.
public abstract int getWidth();
diff --git a/src/com/android/gallery3d/data/MediaObject.java b/src/com/android/gallery3d/data/MediaObject.java
index e738011ef..a16b9666d 100644
--- a/src/com/android/gallery3d/data/MediaObject.java
+++ b/src/com/android/gallery3d/data/MediaObject.java
@@ -38,10 +38,11 @@ public abstract class MediaObject {
public static final int SUPPORT_IMPORT = 1 << 11;
public static final int SUPPORT_TRIM = 1 << 12;
public static final int SUPPORT_PANORAMA = 1 << 13;
- public static final int SUPPORT_UNLOCK = 1 << 14;
- public static final int SUPPORT_BACK = 1 << 15;
- public static final int SUPPORT_ACTION = 1 << 16;
- public static final int SUPPORT_CAMERA_SHORTCUT = 1 << 17;
+ public static final int SUPPORT_PANORAMA360 = 1 << 14;
+ public static final int SUPPORT_UNLOCK = 1 << 15;
+ public static final int SUPPORT_BACK = 1 << 16;
+ public static final int SUPPORT_ACTION = 1 << 17;
+ public static final int SUPPORT_CAMERA_SHORTCUT = 1 << 18;
public static final int SUPPORT_ALL = 0xffffffff;
// These are the bits returned from getMediaType():
diff --git a/src/com/android/gallery3d/data/UriImage.java b/src/com/android/gallery3d/data/UriImage.java
index 737e85f25..a72ced2b8 100644
--- a/src/com/android/gallery3d/data/UriImage.java
+++ b/src/com/android/gallery3d/data/UriImage.java
@@ -58,6 +58,8 @@ public class UriImage extends MediaItem {
private int mRotation;
private boolean mUsePanoramaViewer;
private boolean mUsePanoramaViewerInitialized;
+ private boolean mIsPanorama360;
+ private boolean mIsPanorama360Initialized;
private GalleryApp mApplication;
@@ -220,6 +222,9 @@ public class UriImage extends MediaItem {
}
if (usePanoramaViewer()) {
supported |= SUPPORT_PANORAMA;
+ if (isPanorama360()) {
+ supported |= SUPPORT_PANORAMA360;
+ }
}
return supported;
}
@@ -302,4 +307,15 @@ public class UriImage extends MediaItem {
}
return mUsePanoramaViewer;
}
+
+ @Override
+ public boolean isPanorama360() {
+ // cache flag for faster access
+ if (!mIsPanorama360Initialized) {
+ mIsPanorama360 = LightCycleHelper.isPanorama360(
+ mApplication.getAndroidContext(), getContentUri());
+ mIsPanorama360Initialized = true;
+ }
+ return mIsPanorama360;
+ }
}
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java
index c738f66e9..c5aba53f9 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -55,7 +55,7 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
private static final int SUPPORT_MULTIPLE_MASK = MediaObject.SUPPORT_DELETE
| MediaObject.SUPPORT_ROTATE | MediaObject.SUPPORT_SHARE
| MediaObject.SUPPORT_CACHE | MediaObject.SUPPORT_IMPORT
- | MediaObject.SUPPORT_PANORAMA;
+ | MediaObject.SUPPORT_PANORAMA | MediaObject.SUPPORT_PANORAMA360;
public interface ActionModeListener {
public boolean onActionItemClicked(MenuItem item);
@@ -273,11 +273,11 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
if (size > 0) {
if (size > 1) {
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
- intent.setType(GalleryUtils.MIME_TYPE_PANORAMA);
+ intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
} else {
intent.setAction(Intent.ACTION_SEND);
- intent.setType(GalleryUtils.MIME_TYPE_PANORAMA);
+ intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
}
}
@@ -357,7 +357,7 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
MenuExecutor.updateMenuOperation(mMenu, operation);
if (mSharePanoramaMenuItem != null) {
mSharePanoramaMenuItem.setEnabled(true);
- if ((operation & MediaObject.SUPPORT_PANORAMA) != 0) {
+ if ((operation & MediaObject.SUPPORT_PANORAMA360) != 0) {
mActivity.invalidateOptionsMenu();
mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
mShareMenuItem.setTitle(
diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java
index 1f9d0c434..cacf6fce1 100644
--- a/src/com/android/gallery3d/ui/MenuExecutor.java
+++ b/src/com/android/gallery3d/ui/MenuExecutor.java
@@ -160,7 +160,7 @@ public class MenuExecutor {
boolean supportRotate = (supported & MediaObject.SUPPORT_ROTATE) != 0;
boolean supportCrop = (supported & MediaObject.SUPPORT_CROP) != 0;
boolean supportTrim = (supported & MediaObject.SUPPORT_TRIM) != 0;
- boolean supportSharePanorama = (supported & MediaObject.SUPPORT_PANORAMA) != 0;
+ boolean supportSharePanorama = (supported & MediaObject.SUPPORT_PANORAMA360) != 0;
boolean supportShare = (supported & MediaObject.SUPPORT_SHARE) != 0;
boolean supportSetAs = (supported & MediaObject.SUPPORT_SETAS) != 0;
boolean supportShowOnMap = (supported & MediaObject.SUPPORT_SHOW_ON_MAP) != 0;
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index 05bd3dea6..16eb424b5 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -58,7 +58,7 @@ public class GalleryUtils {
public static final String MIME_TYPE_IMAGE = "image/*";
public static final String MIME_TYPE_VIDEO = "video/*";
- public static final String MIME_TYPE_PANORAMA = "application/vnd.google.panorama360+jpg";
+ public static final String MIME_TYPE_PANORAMA360 = "application/vnd.google.panorama360+jpg";
public static final String MIME_TYPE_ALL = "*/*";
private static final String DIR_TYPE_IMAGE = "vnd.android.cursor.dir/image";
diff --git a/src_pd/com/android/gallery3d/util/LightCycleHelper.java b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
index a4da43cb4..d455ff7c1 100644
--- a/src_pd/com/android/gallery3d/util/LightCycleHelper.java
+++ b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
@@ -49,6 +49,10 @@ public class LightCycleHelper {
return false;
}
+ public static boolean isPanorama360(Context context, Uri uri) {
+ return false;
+ }
+
public static CameraModule createPanoramaModule() {
return null;
}