summaryrefslogtreecommitdiffstats
path: root/gallerycommon/src/com/android/gallery3d/common
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2012-08-24 19:30:08 +0800
committerAngus Kong <shkong@google.com>2012-08-29 19:43:12 +0800
commit8fe96573217f52b1200920e09727f98157610cb0 (patch)
treef9870bd3684e3a7896a3315787c3ed7de8482d7b /gallerycommon/src/com/android/gallery3d/common
parentf67891cb9b5a47a6412cfa88b889b4b76fd22e79 (diff)
downloadandroid_packages_apps_Snap-8fe96573217f52b1200920e09727f98157610cb0.tar.gz
android_packages_apps_Snap-8fe96573217f52b1200920e09727f98157610cb0.tar.bz2
android_packages_apps_Snap-8fe96573217f52b1200920e09727f98157610cb0.zip
Invoke LightCycle viewer for panoramas.
1. Add SUPPORT_PANORAMA_VIEW to supported operations. 2. Add helper methods in LightCycleHelper: a. checks if the image file is a panorama. b. invokes the panorama view activity. bug:6912297 Change-Id: I7909e49632cad02a795943a113bca6aec17df9dd
Diffstat (limited to 'gallerycommon/src/com/android/gallery3d/common')
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/LightCycleHelper.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/LightCycleHelper.java b/gallerycommon/src/com/android/gallery3d/common/LightCycleHelper.java
index f8df29dd4..c4fb61a52 100644
--- a/gallerycommon/src/com/android/gallery3d/common/LightCycleHelper.java
+++ b/gallerycommon/src/com/android/gallery3d/common/LightCycleHelper.java
@@ -16,18 +16,21 @@
package com.android.gallery3d.common;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.net.Uri;
public class LightCycleHelper {
+ public static final String EXTRA_OUTPUT_DIR = "output_dir";
+ private static final String PANORAMA_FILENAME_PREFIX = "panorama_";
public static final String LIGHTCYCLE_PACKAGE =
"com.google.android.apps.lightcycle";
public static final String LIGHTCYCLE_CAPTURE_CLASS =
"com.google.android.apps.lightcycle.PanoramaCaptureActivity";
- public static final String LIGHTCYCLE_VIEW_CLASS =
+ private static final String LIGHTCYCLE_VIEW_CLASS =
"com.google.android.apps.lightcycle.PanoramaViewActivity";
- public static final String EXTRA_OUTPUT_DIR = "output_dir";
private static boolean sUpdated;
private static boolean sHasViewActivity;
@@ -45,35 +48,50 @@ public class LightCycleHelper {
sHasCaptureActivity = hasLightCycleActivity(pm, LIGHTCYCLE_CAPTURE_CLASS);
}
- public synchronized static boolean hasLightCycleView(PackageManager pm) {
+ public static synchronized boolean hasLightCycleView(PackageManager pm) {
if (!sUpdated) {
update(pm);
}
return sHasViewActivity;
}
- public synchronized static boolean hasLightCycleCapture(PackageManager pm) {
+ public static synchronized boolean hasLightCycleCapture(PackageManager pm) {
if (!sUpdated) {
update(pm);
}
return sHasCaptureActivity;
}
- public synchronized static void onPackageAdded(Context context, String packageName) {
+ public static synchronized void onPackageAdded(Context context, String packageName) {
if (LIGHTCYCLE_PACKAGE.equals(packageName)) {
update(context.getPackageManager());
}
}
- public synchronized static void onPackageRemoved(Context context, String packageName) {
+ public static synchronized void onPackageRemoved(Context context, String packageName) {
if (LIGHTCYCLE_PACKAGE.equals(packageName)) {
update(context.getPackageManager());
}
}
- public synchronized static void onPackageChanged(Context context, String packageName) {
+ public static synchronized void onPackageChanged(Context context, String packageName) {
if (LIGHTCYCLE_PACKAGE.equals(packageName)) {
update(context.getPackageManager());
}
}
+
+ public static void viewPanorama(Activity activity, Uri uri, String type) {
+ try {
+ Intent intent = new Intent(Intent.ACTION_VIEW)
+ .setDataAndType(uri, type)
+ .setClassName(LIGHTCYCLE_PACKAGE, LIGHTCYCLE_VIEW_CLASS);
+ activity.startActivity(intent);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static boolean isPanorama(String filename) {
+ return filename.startsWith(PANORAMA_FILENAME_PREFIX);
+ }
}