summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2012-10-09 21:02:42 -0700
committerGeorge Mount <mount@google.com>2012-10-10 10:32:35 -0700
commitfffc28dcab3ae031c41c5aa290861ab4c4303550 (patch)
tree1988257a418dd78c5b1839ee63531b5cf55e10bb
parent895e9fad2bbe6031c30b34e44caedaa1f77ca617 (diff)
downloadandroid_packages_apps_Snap-fffc28dcab3ae031c41c5aa290861ab4c4303550.tar.gz
android_packages_apps_Snap-fffc28dcab3ae031c41c5aa290861ab4c4303550.tar.bz2
android_packages_apps_Snap-fffc28dcab3ae031c41c5aa290861ab4c4303550.zip
Change how stitched images are inserted into Gallery.
Bug 7299396 Stitching images now use normal LocalImages for their MediaItem instead of LightCycleItems. They are no longer part of a special album. Change-Id: Ic62822a44b9743829dee50bcfa6f455cd538afa7
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java43
-rw-r--r--src/com/android/gallery3d/app/StitchingChangeListener.java8
-rw-r--r--src/com/android/gallery3d/data/DataManager.java2
-rw-r--r--src/com/android/gallery3d/data/LocalAlbumSet.java6
-rw-r--r--src/com/android/gallery3d/data/LocalImage.java5
-rw-r--r--src/com/android/gallery3d/data/SecureAlbum.java53
-rw-r--r--src_pd/com/android/gallery3d/app/StitchingProgressManager.java21
-rw-r--r--src_pd/com/android/gallery3d/util/LightCycleHelper.java9
8 files changed, 35 insertions, 112 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 6f2a1e007..d6723ca51 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -46,6 +46,7 @@ import com.android.gallery3d.data.ComboAlbum;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.FilterDeleteSet;
import com.android.gallery3d.data.FilterSource;
+import com.android.gallery3d.data.LocalImage;
import com.android.gallery3d.data.MediaDetails;
import com.android.gallery3d.data.MediaItem;
import com.android.gallery3d.data.MediaObject;
@@ -207,26 +208,25 @@ public class PhotoPage extends ActivityState implements
private class UpdateProgressListener implements StitchingChangeListener {
@Override
- public void onStitchingResult(Path path, Uri uri) {
- sendUpdate(path);
+ public void onStitchingResult(Uri uri) {
+ sendUpdate(uri);
}
@Override
- public void onStitchingQueued(Path path) {
- sendUpdate(path);
+ public void onStitchingQueued(Uri uri) {
+ sendUpdate(uri);
}
@Override
- public void onStitchingProgress(Path path, final int progress) {
- sendUpdate(path);
+ public void onStitchingProgress(Uri uri, final int progress) {
+ sendUpdate(uri);
}
- private void sendUpdate(Path path) {
- boolean isCurrentPhoto = mCurrentPhoto != null
- && mCurrentPhoto.getPath().toString().equals(path.toString());
+ private void sendUpdate(Uri uri) {
+ boolean isCurrentPhoto = mCurrentPhoto instanceof LocalImage
+ && mCurrentPhoto.getContentUri().equals(uri);
if (isCurrentPhoto) {
mHandler.sendEmptyMessage(MSG_REFRESH_IMAGE);
-
}
}
};
@@ -388,20 +388,13 @@ public class PhotoPage extends ActivityState implements
mFlags |= FLAG_SHOW_WHEN_LOCKED;
}
- // Don't display "empty album" action item or panorama
- // progress for capture intents.
+ // Don't display "empty album" action item for capture intents.
if (!mSetPathString.equals("/local/all/0")) {
// Check if the path is a secure album.
if (SecureSource.isSecurePath(mSetPathString)) {
mSecureAlbum = (SecureAlbum) mActivity.getDataManager()
.getMediaSet(mSetPathString);
mShowSpinner = false;
- } else {
- // Use lightcycle album to handle panorama progress if
- // the path is not a secure album.
- if (LightCycleHelper.hasLightCycleCapture(mActivity.getAndroidContext())) {
- mSetPathString = LightCycleHelper.wrapGalleryPath(mSetPathString);
- }
}
mSetPathString = "/filter/empty/{"+mSetPathString+"}";
}
@@ -669,15 +662,11 @@ public class PhotoPage extends ActivityState implements
updateShareURI(photo.getPath());
}
StitchingProgressManager progressManager = mApplication.getStitchingProgressManager();
- if (progressManager != null) {
- int itemCount = progressManager.getItemCount();
- mProgressBar.hideProgress();
- for (int i = 0; i < itemCount; i++) {
- MediaItem item = progressManager.getItem(i);
- if (item.getPath().equals(photo.getPath())) {
- mProgressBar.setProgress(progressManager.getProgress(item.getFilePath()));
- break;
- }
+ mProgressBar.hideProgress();
+ if (progressManager != null && mCurrentPhoto instanceof LocalImage) {
+ Integer progress = progressManager.getProgress(photo.getContentUri());
+ if (progress != null) {
+ mProgressBar.setProgress(progress);
}
}
}
diff --git a/src/com/android/gallery3d/app/StitchingChangeListener.java b/src/com/android/gallery3d/app/StitchingChangeListener.java
index 40f59a52c..0b8c2d6d6 100644
--- a/src/com/android/gallery3d/app/StitchingChangeListener.java
+++ b/src/com/android/gallery3d/app/StitchingChangeListener.java
@@ -16,14 +16,12 @@
package com.android.gallery3d.app;
-import com.android.gallery3d.data.Path;
-
import android.net.Uri;
public interface StitchingChangeListener {
- public void onStitchingQueued(Path path);
+ public void onStitchingQueued(Uri uri);
- public void onStitchingResult(Path path, Uri uri);
+ public void onStitchingResult(Uri uri);
- public void onStitchingProgress(Path path, int progress);
+ public void onStitchingProgress(Uri uri, int progress);
}
diff --git a/src/com/android/gallery3d/data/DataManager.java b/src/com/android/gallery3d/data/DataManager.java
index e3b7bfc19..95954e59a 100644
--- a/src/com/android/gallery3d/data/DataManager.java
+++ b/src/com/android/gallery3d/data/DataManager.java
@@ -28,7 +28,6 @@ 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;
@@ -131,7 +130,6 @@ 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()) {
diff --git a/src/com/android/gallery3d/data/LocalAlbumSet.java b/src/com/android/gallery3d/data/LocalAlbumSet.java
index afaac4965..b2b4b8c5d 100644
--- a/src/com/android/gallery3d/data/LocalAlbumSet.java
+++ b/src/com/android/gallery3d/data/LocalAlbumSet.java
@@ -26,7 +26,6 @@ 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;
@@ -128,11 +127,6 @@ 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/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java
index 52f707b60..7006b0a82 100644
--- a/src/com/android/gallery3d/data/LocalImage.java
+++ b/src/com/android/gallery3d/data/LocalImage.java
@@ -33,6 +33,7 @@ import android.provider.MediaStore.MediaColumns;
import android.util.Log;
import com.android.gallery3d.app.GalleryApp;
+import com.android.gallery3d.app.StitchingProgressManager;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.BitmapUtils;
import com.android.gallery3d.util.GalleryUtils;
@@ -236,6 +237,10 @@ public class LocalImage extends LocalMediaItem {
@Override
public int getSupportedOperations() {
+ StitchingProgressManager progressManager = mApplication.getStitchingProgressManager();
+ if (progressManager != null && progressManager.getProgress(getContentUri()) != null) {
+ return 0; // doesn't support anything while stitching!
+ }
int operation = SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_CROP
| SUPPORT_SETAS | SUPPORT_EDIT | SUPPORT_INFO;
if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) {
diff --git a/src/com/android/gallery3d/data/SecureAlbum.java b/src/com/android/gallery3d/data/SecureAlbum.java
index 4e33cda49..c666bdc75 100644
--- a/src/com/android/gallery3d/data/SecureAlbum.java
+++ b/src/com/android/gallery3d/data/SecureAlbum.java
@@ -19,19 +19,17 @@ package com.android.gallery3d.data;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
-import android.provider.MediaStore.MediaColumns;
import android.provider.MediaStore.Images;
+import android.provider.MediaStore.MediaColumns;
import android.provider.MediaStore.Video;
import com.android.gallery3d.app.GalleryApp;
-import com.android.gallery3d.app.StitchingChangeListener;
-import com.android.gallery3d.app.StitchingProgressManager;
import com.android.gallery3d.util.MediaSetUtils;
import java.util.ArrayList;
// This class lists all media items added by the client.
-public class SecureAlbum extends MediaSet implements StitchingChangeListener {
+public class SecureAlbum extends MediaSet {
@SuppressWarnings("unused")
private static final String TAG = "SecureAlbum";
private static final String[] PROJECTION = {MediaColumns._ID};
@@ -44,10 +42,8 @@ public class SecureAlbum extends MediaSet implements StitchingChangeListener {
// The types of items in mAllItems. True is video and false is image.
private ArrayList<Boolean> mAllItemTypes = new ArrayList<Boolean>();
private ArrayList<Path> mExistingItems = new ArrayList<Path>();
- private ArrayList<Path> mStitchingItems = new ArrayList<Path>();
private Context mContext;
private DataManager mDataManager;
- private StitchingProgressManager mStitchingProgressManager;
private static final Uri[] mWatchUris =
{Images.Media.EXTERNAL_CONTENT_URI, Video.Media.EXTERNAL_CONTENT_URI};
private final ChangeNotifier mNotifier;
@@ -64,8 +60,6 @@ public class SecureAlbum extends MediaSet implements StitchingChangeListener {
mUnlockItem = unlock;
mShowUnlockItem = (!isCameraBucketEmpty(Images.Media.EXTERNAL_CONTENT_URI)
|| !isCameraBucketEmpty(Video.Media.EXTERNAL_CONTENT_URI));
- mStitchingProgressManager = application.getStitchingProgressManager();
- mStitchingProgressManager.addChangeListener(this);
}
public void addMediaItem(boolean isVideo, int id) {
@@ -85,26 +79,14 @@ public class SecureAlbum extends MediaSet implements StitchingChangeListener {
// The sequence is stitching items, local media items, and unlock image.
@Override
public ArrayList<MediaItem> getMediaItem(int start, int count) {
- int stitchingCount = mStitchingItems.size();
int existingCount = mExistingItems.size();
- if (start >= stitchingCount + existingCount + 1) {
+ if (start >= existingCount + 1) {
return new ArrayList<MediaItem>();
}
// Add paths of requested stitching items.
- int end = Math.min(start + count, stitchingCount + existingCount);
- ArrayList<Path> subset = new ArrayList<Path>();
- if (start < stitchingCount) {
- subset.addAll(mStitchingItems.subList(
- start, Math.min(stitchingCount, end)));
- }
-
- // Add paths of requested local media items.
- if (end >= stitchingCount) {
- int existingStart = Math.max(0, start - stitchingCount);
- int existingEnd = end - stitchingCount;
- subset.addAll(mExistingItems.subList(existingStart, existingEnd));
- }
+ int end = Math.min(start + count, existingCount);
+ ArrayList<Path> subset = new ArrayList<Path>(mExistingItems.subList(start, end));
// Convert paths to media items.
final MediaItem[] buf = new MediaItem[end - start];
@@ -125,8 +107,7 @@ public class SecureAlbum extends MediaSet implements StitchingChangeListener {
@Override
public int getMediaItemCount() {
- return (mStitchingItems.size() + mExistingItems.size()
- + (mShowUnlockItem ? 1 : 0));
+ return (mExistingItems.size() + (mShowUnlockItem ? 1 : 0));
}
@Override
@@ -202,26 +183,4 @@ public class SecureAlbum extends MediaSet implements StitchingChangeListener {
public boolean isLeafAlbum() {
return true;
}
-
- @Override
- public void onStitchingQueued(Path path) {
- mStitchingItems.add(path);
- notifyContentChanged();
- }
-
- @Override
- public void onStitchingResult(Path path, Uri uri) {
- if (mStitchingItems.remove(path)) {
- int id = Integer.parseInt(uri.getLastPathSegment());
- addMediaItem(false, id);
- notifyContentChanged();
- }
- }
-
- @Override
- public void onStitchingProgress(Path path, int progress) {
- if (mStitchingItems.contains(path)) {
- notifyContentChanged();
- }
- }
}
diff --git a/src_pd/com/android/gallery3d/app/StitchingProgressManager.java b/src_pd/com/android/gallery3d/app/StitchingProgressManager.java
index d0e2a6961..73868478e 100644
--- a/src_pd/com/android/gallery3d/app/StitchingProgressManager.java
+++ b/src_pd/com/android/gallery3d/app/StitchingProgressManager.java
@@ -16,30 +16,19 @@
package com.android.gallery3d.app;
-import com.android.gallery3d.data.MediaItem;
-
-import java.util.ArrayList;
+import android.net.Uri;
public class StitchingProgressManager {
- public void addChangeListener(StitchingChangeListener l) {
- }
-
- public void removeChangeListener(StitchingChangeListener l) {
+ public StitchingProgressManager(GalleryApp app) {
}
- public int getItemCount() {
- return 0;
+ public void addChangeListener(StitchingChangeListener l) {
}
- public MediaItem getItem(int i) {
- return null;
+ public void removeChangeListener(StitchingChangeListener l) {
}
- public ArrayList<MediaItem> getAllItems() {
+ public Integer getProgress(Uri uri) {
return null;
}
-
- public int getProgress(String filePath) {
- return 100;
- }
}
diff --git a/src_pd/com/android/gallery3d/util/LightCycleHelper.java b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
index d455ff7c1..cc8ea20b9 100644
--- a/src_pd/com/android/gallery3d/util/LightCycleHelper.java
+++ b/src_pd/com/android/gallery3d/util/LightCycleHelper.java
@@ -25,7 +25,6 @@ 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 {
@@ -60,12 +59,4 @@ public class LightCycleHelper {
public static StitchingProgressManager createStitchingManagerInstance(GalleryApp app) {
return null;
}
-
- public static MediaSource createMediaSourceInstance(GalleryApp app) {
- return null;
- }
-
- public static String wrapGalleryPath(String path) {
- return path;
- }
}