summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data
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
commit4e091eb758a3ac1016b373419cea1ada1b977bc5 (patch)
tree28452dbbc9eed2be6cfad490bf0e7507a84f49fd /src/com/android/gallery3d/data
parentf122d56e15e00928d731751796b0509ae47c6799 (diff)
downloadandroid_packages_apps_Gallery2-4e091eb758a3ac1016b373419cea1ada1b977bc5.tar.gz
android_packages_apps_Gallery2-4e091eb758a3ac1016b373419cea1ada1b977bc5.tar.bz2
android_packages_apps_Gallery2-4e091eb758a3ac1016b373419cea1ada1b977bc5.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
Diffstat (limited to 'src/com/android/gallery3d/data')
-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
4 files changed, 11 insertions, 55 deletions
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();
- }
- }
}