summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-06-22 20:56:04 +0800
committerChih-Chung Chang <chihchung@google.com>2012-06-26 15:19:43 +0800
commit6118af9ddad8acc050133154f8f60c842c7f9bfa (patch)
treef89916d6f302104544e5dc3809ed3dbd41350f36 /src/com/android/gallery3d/app
parent55fad05ef4a80b3a690d4748c5b90fb5c0488d22 (diff)
downloadandroid_packages_apps_Gallery2-6118af9ddad8acc050133154f8f60c842c7f9bfa.tar.gz
android_packages_apps_Gallery2-6118af9ddad8acc050133154f8f60c842c7f9bfa.tar.bz2
android_packages_apps_Gallery2-6118af9ddad8acc050133154f8f60c842c7f9bfa.zip
Fix the behavior of deleting the last picture.
Also fix the jank while deleting multiple pictures quickly. Bug: 6713932, 6712555 Change-Id: I9d64d8bbdcd4ec0dc9a447a51d50f88ff27363b4
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index c94454352..568f5901f 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -218,10 +218,12 @@ public class PhotoPage extends ActivityState implements
mShowBars = false;
}
+ MediaSet originalSet = mActivity.getDataManager()
+ .getMediaSet(mSetPathString);
+ mSelectionManager.setSourceMediaSet(originalSet);
mSetPathString = "/filter/delete/{" + mSetPathString + "}";
mMediaSet = (FilterDeleteSet) mActivity.getDataManager()
.getMediaSet(mSetPathString);
- mSelectionManager.setSourceMediaSet(mMediaSet);
mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0);
if (mMediaSet == null) {
Log.w(TAG, "failed to restore " + mSetPathString);
@@ -717,32 +719,25 @@ public class PhotoPage extends ActivityState implements
// the deletion, we then actually delete the media item.
@Override
public void onDeleteImage(Path path, int offset) {
- commitDeletion(); // commit the previous deletion
+ onCommitDeleteImage(); // commit the previous deletion
mDeletePath = path;
mDeleteIsFocus = (offset == 0);
- mMediaSet.setDeletion(path, mCurrentIndex + offset);
- mPhotoView.showUndoBar();
+ mMediaSet.addDeletion(path, mCurrentIndex + offset);
}
@Override
public void onUndoDeleteImage() {
+ if (mDeletePath == null) return;
// If the deletion was done on the focused item, we want the model to
// focus on it when it is undeleted.
if (mDeleteIsFocus) mModel.setFocusHintPath(mDeletePath);
- mMediaSet.setDeletion(null, 0);
+ mMediaSet.removeDeletion(mDeletePath);
mDeletePath = null;
- mPhotoView.hideUndoBar();
}
@Override
public void onCommitDeleteImage() {
if (mDeletePath == null) return;
- commitDeletion();
- mPhotoView.hideUndoBar();
- }
-
- private void commitDeletion() {
- if (mDeletePath == null) return;
mSelectionManager.deSelectAll();
mSelectionManager.toggle(mDeletePath);
mMenuExecutor.onMenuClicked(R.id.action_delete, null, true, false);
@@ -857,6 +852,7 @@ public class PhotoPage extends ActivityState implements
onCommitDeleteImage();
mMenuExecutor.pause();
+ if (mMediaSet != null) mMediaSet.clearDeletion();
}
@Override