Support panorama progress items in Gallery.
Bug 7259843
Add dummy files for showing panorama progress in filmstrip.
Change-Id: I7ae92b90bbbd992fde00cfcfc68af69b34d34d74
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 @@
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.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 @@
private DataManager mDataManager;
private ThreadPool mThreadPool;
private DownloadCache mDownloadCache;
+ private StitchingProgressManager mStitchingProgressManager;
@Override
public void onCreate() {
@@ -59,6 +61,8 @@
getPackageManager().setComponentEnabledSetting(
new ComponentName(this, PhotoEditor.class),
state, PackageManager.DONT_KILL_APP);
+
+ mStitchingProgressManager = LightCycleHelper.createStitchingManagerInstance(this);
}
@Override
@@ -76,6 +80,11 @@
}
@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 @@
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.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 @@
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 @@
// 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.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 @@
}
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 @@
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.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 @@
/* 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 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;
+ }
}