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);
+ }
}
}
// 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";
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();
+ }
}