diff options
author | Chih-Chung Chang <chihchung@google.com> | 2012-06-26 03:40:04 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-26 03:40:04 -0700 |
commit | 64cebdd1eebd2c001e6680f247c6f741889ad989 (patch) | |
tree | 4afa49b244fc7a93539d7fbbd53b388a7cd27342 /src/com/android/gallery3d/app | |
parent | 57150b3c30a066bdf7f346223bf0707a345c4e47 (diff) | |
parent | 6118af9ddad8acc050133154f8f60c842c7f9bfa (diff) | |
download | android_packages_apps_Gallery2-64cebdd1eebd2c001e6680f247c6f741889ad989.tar.gz android_packages_apps_Gallery2-64cebdd1eebd2c001e6680f247c6f741889ad989.tar.bz2 android_packages_apps_Gallery2-64cebdd1eebd2c001e6680f247c6f741889ad989.zip |
am 6118af9d: Fix the behavior of deleting the last picture.
* commit '6118af9ddad8acc050133154f8f60c842c7f9bfa':
Fix the behavior of deleting the last picture.
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 20 |
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 |