summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-06-27 00:10:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-27 00:10:33 -0700
commit8ba7701ccacfe48c9632abbf51fac891edb72774 (patch)
treecca20f15700e9992619b7ae8ffeed0669090913f /src
parentf30aae7dfa064f65697214a3b107b581b42f135b (diff)
parent57ec2e5724e4e152d994592193e29e76267a6e9c (diff)
downloadandroid_packages_apps_Snap-8ba7701ccacfe48c9632abbf51fac891edb72774.tar.gz
android_packages_apps_Snap-8ba7701ccacfe48c9632abbf51fac891edb72774.tar.bz2
android_packages_apps_Snap-8ba7701ccacfe48c9632abbf51fac891edb72774.zip
am acd75301: am bb52543c: Merge "Show undo option for 3 seconds after the last picture is deleted." into jb-dev
* commit 'acd753010dcf6d8079e4620722921694cb041dbf': Show undo option for 3 seconds after the last picture is deleted.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java7
-rw-r--r--src/com/android/gallery3d/data/FilterDeleteSet.java7
2 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 568f5901f..17f57c204 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -253,7 +253,12 @@ public class PhotoPage extends ActivityState implements
MediaItem photo = mModel.getMediaItem(0);
if (photo != null) updateCurrentPhoto(photo);
} else if (mIsActive) {
- mActivity.getStateManager().finishState(PhotoPage.this);
+ // We only want to finish the PhotoPage if there is no
+ // deletion that the user can undo.
+ if (mMediaSet.getNumberOfDeletions() == 0) {
+ mActivity.getStateManager().finishState(
+ PhotoPage.this);
+ }
}
}
diff --git a/src/com/android/gallery3d/data/FilterDeleteSet.java b/src/com/android/gallery3d/data/FilterDeleteSet.java
index 97bbc1256..dbd85d57d 100644
--- a/src/com/android/gallery3d/data/FilterDeleteSet.java
+++ b/src/com/android/gallery3d/data/FilterDeleteSet.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
// void addDeletion(Path path, int index);
// void removeDelection(Path path);
// void clearDeletion();
+// int getNumberOfDeletions();
//
public class FilterDeleteSet extends MediaSet implements ContentListener {
private static final String TAG = "FilterDeleteSet";
@@ -242,4 +243,10 @@ public class FilterDeleteSet extends MediaSet implements ContentListener {
public void clearDeletion() {
sendRequest(REQUEST_CLEAR, null /* unused */ , 0 /* unused */);
}
+
+ // Returns number of deletions _in effect_ (the number will only gets
+ // updated after a reload()).
+ public int getNumberOfDeletions() {
+ return mCurrent.size();
+ }
}