summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2012-10-04 14:44:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-04 14:44:34 -0700
commit22ac4de64a2917a5e2b5449b208553a42bd46e6b (patch)
tree5bbfbecdf9ac6d81af5bbf147e2235a4eff867a3
parentc422bd02c4063513e9974dfead3eb12f329bacb8 (diff)
parent356ffa04adff94a09fe60849b40397aa8ee018b8 (diff)
downloadandroid_packages_apps_Snap-22ac4de64a2917a5e2b5449b208553a42bd46e6b.zip
android_packages_apps_Snap-22ac4de64a2917a5e2b5449b208553a42bd46e6b.tar.gz
android_packages_apps_Snap-22ac4de64a2917a5e2b5449b208553a42bd46e6b.tar.bz2
Merge "Support panorama progress items in Gallery." into gb-ub-photos-arches
-rw-r--r--src/com/android/gallery3d/app/GalleryApp.java2
-rw-r--r--src/com/android/gallery3d/app/GalleryAppImpl.java9
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java5
-rw-r--r--src/com/android/gallery3d/app/StitchingChangeListener.java26
-rw-r--r--src/com/android/gallery3d/data/DataManager.java3
-rw-r--r--src/com/android/gallery3d/data/LocalAlbumSet.java8
-rw-r--r--src_pd/com/android/gallery3d/util/LightCycleHelper.java19
7 files changed, 69 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/app/GalleryApp.java b/src/com/android/gallery3d/app/GalleryApp.java
index a2d7494..b56b8a8 100644
--- a/src/com/android/gallery3d/app/GalleryApp.java
+++ b/src/com/android/gallery3d/app/GalleryApp.java
@@ -28,6 +28,8 @@ import com.android.gallery3d.util.ThreadPool;
public interface GalleryApp {
public DataManager getDataManager();
+
+ public StitchingProgressManager getStitchingProgressManager();
public ImageCacheService getImageCacheService();
public DownloadCache getDownloadCache();
public ThreadPool getThreadPool();
diff --git a/src/com/android/gallery3d/app/GalleryAppImpl.java b/src/com/android/gallery3d/app/GalleryAppImpl.java
index 9576093..c4507b3 100644
--- a/src/com/android/gallery3d/app/GalleryAppImpl.java
+++ b/src/com/android/gallery3d/app/GalleryAppImpl.java
@@ -30,6 +30,7 @@ import com.android.gallery3d.gadget.WidgetUtils;
import com.android.gallery3d.photoeditor.PhotoEditor;
import com.android.gallery3d.picasasource.PicasaSource;
import com.android.gallery3d.util.GalleryUtils;
+import com.android.gallery3d.util.LightCycleHelper;
import com.android.gallery3d.util.ThreadPool;
import java.io.File;
@@ -44,6 +45,7 @@ public class GalleryAppImpl extends Application implements GalleryApp {
private DataManager mDataManager;
private ThreadPool mThreadPool;
private DownloadCache mDownloadCache;
+ private StitchingProgressManager mStitchingProgressManager;
@Override
public void onCreate() {
@@ -59,6 +61,8 @@ public class GalleryAppImpl extends Application implements GalleryApp {
getPackageManager().setComponentEnabledSetting(
new ComponentName(this, PhotoEditor.class),
state, PackageManager.DONT_KILL_APP);
+
+ mStitchingProgressManager = LightCycleHelper.createStitchingManagerInstance(this);
}
@Override
@@ -76,6 +80,11 @@ public class GalleryAppImpl extends Application implements GalleryApp {
}
@Override
+ public StitchingProgressManager getStitchingProgressManager() {
+ return mStitchingProgressManager;
+ }
+
+ @Override
public ImageCacheService getImageCacheService() {
// This method may block on file I/O so a dedicated lock is needed here.
synchronized (mLock) {
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index c60c3b9..2a088b1 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -371,6 +371,11 @@ public class PhotoPage extends ActivityState implements
mSetPathString = "/filter/empty/{"+mSetPathString+"}";
}
+ // Add support for showing panorama progress.
+ if (LightCycleHelper.hasLightCycleCapture(mActivity.getAndroidContext())) {
+ mSetPathString = LightCycleHelper.wrapGalleryPath(mSetPathString);
+ }
+
// Combine the original MediaSet with the one for ScreenNail
// from AppBridge.
mSetPathString = "/combo/item/{" + screenNailSetPath +
diff --git a/src/com/android/gallery3d/app/StitchingChangeListener.java b/src/com/android/gallery3d/app/StitchingChangeListener.java
new file mode 100644
index 0000000..901f379
--- /dev/null
+++ b/src/com/android/gallery3d/app/StitchingChangeListener.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.app;
+
+
+public interface StitchingChangeListener {
+ public void onFileAdded(String filePath);
+
+ public void onFileRemoved(String filePath);
+
+ public void onProgressChanged(String filePath, int progress);
+}
diff --git a/src/com/android/gallery3d/data/DataManager.java b/src/com/android/gallery3d/data/DataManager.java
index eeab8a8..e3b7bfc 100644
--- a/src/com/android/gallery3d/data/DataManager.java
+++ b/src/com/android/gallery3d/data/DataManager.java
@@ -28,6 +28,7 @@ import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.MediaSet.ItemConsumer;
import com.android.gallery3d.data.MediaSource.PathId;
import com.android.gallery3d.picasasource.PicasaSource;
+import com.android.gallery3d.util.LightCycleHelper;
import java.util.ArrayList;
import java.util.Comparator;
@@ -130,6 +131,7 @@ public class DataManager {
addSource(new SecureSource(mApplication));
addSource(new UriSource(mApplication));
addSource(new SnailSource(mApplication));
+ addSource(LightCycleHelper.createMediaSourceInstance(mApplication));
if (mActiveCount > 0) {
for (MediaSource source : mSourceMap.values()) {
@@ -153,6 +155,7 @@ public class DataManager {
// open for debug
void addSource(MediaSource source) {
+ if (source == null) return;
mSourceMap.put(source.getPrefix(), source);
}
diff --git a/src/com/android/gallery3d/data/LocalAlbumSet.java b/src/com/android/gallery3d/data/LocalAlbumSet.java
index d737ca8..afaac49 100644
--- a/src/com/android/gallery3d/data/LocalAlbumSet.java
+++ b/src/com/android/gallery3d/data/LocalAlbumSet.java
@@ -26,6 +26,7 @@ import com.android.gallery3d.app.GalleryApp;
import com.android.gallery3d.data.BucketHelper.BucketEntry;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
+import com.android.gallery3d.util.LightCycleHelper;
import com.android.gallery3d.util.MediaSetUtils;
import com.android.gallery3d.util.ThreadPool;
import com.android.gallery3d.util.ThreadPool.JobContext;
@@ -92,7 +93,7 @@ public class LocalAlbumSet extends MediaSet
}
private static int findBucket(BucketEntry entries[], int bucketId) {
- for (int i = 0, n = entries.length; i < n ; ++i) {
+ for (int i = 0, n = entries.length; i < n; ++i) {
if (entries[i].bucketId == bucketId) return i;
}
return -1;
@@ -127,6 +128,11 @@ public class LocalAlbumSet extends MediaSet
for (BucketEntry entry : entries) {
MediaSet album = getLocalAlbum(dataManager,
mType, mPath, entry.bucketId, entry.bucketName);
+ if (LightCycleHelper.hasLightCycleCapture(mApplication.getAndroidContext())
+ && album.isCameraRoll()) {
+ album = dataManager.getMediaSet(Path.fromString(
+ LightCycleHelper.wrapGalleryPath(album.getPath().toString())));
+ }
albums.add(album);
}
return albums;
diff --git a/src_pd/com/android/gallery3d/util/LightCycleHelper.java b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
index dcedc2d..a4da43c 100644
--- a/src_pd/com/android/gallery3d/util/LightCycleHelper.java
+++ b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
@@ -23,6 +23,9 @@ import android.content.Intent;
import android.net.Uri;
import com.android.camera.CameraModule;
+import com.android.gallery3d.app.GalleryApp;
+import com.android.gallery3d.app.StitchingProgressManager;
+import com.android.gallery3d.data.MediaSource;
public class LightCycleHelper {
@@ -30,11 +33,11 @@ public class LightCycleHelper {
/* Do nothing */
}
- public static synchronized boolean hasLightCycleView(Context context) {
+ public static boolean hasLightCycleView(Context context) {
return false;
}
- public static synchronized boolean hasLightCycleCapture(Context context) {
+ public static boolean hasLightCycleCapture(Context context) {
return false;
}
@@ -49,4 +52,16 @@ public class LightCycleHelper {
public static CameraModule createPanoramaModule() {
return null;
}
+
+ public static StitchingProgressManager createStitchingManagerInstance(GalleryApp app) {
+ return null;
+ }
+
+ public static MediaSource createMediaSourceInstance(GalleryApp app) {
+ return null;
+ }
+
+ public static String wrapGalleryPath(String path) {
+ return path;
+ }
}