summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShri Borde <shri@google.com>2014-10-22 14:55:25 -0700
committerShri Borde <shri@google.com>2014-10-22 14:55:25 -0700
commitff6ac38cd3fd60e63882f3163d233d8c09a70db8 (patch)
treee450482ec40bf250355f78c0d9c3d08b65889fba /src
parent0667dbcdae03086a7beedd47c68d098441f7fedc (diff)
downloadphotoviewer-ff6ac38cd3fd60e63882f3163d233d8c09a70db8.tar.gz
Bug 17474391: Opening a different photo from same list of photos
Using FLAG_ACTIVITY_CLEAR_TOP causes a new activity instance to be created which can show the new initial photo. Change-Id: Idc59e07784a2cb3cf2b04879f3db0ece53864333
Diffstat (limited to 'src')
-rw-r--r--src/com/android/ex/photo/Intents.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/ex/photo/Intents.java b/src/com/android/ex/photo/Intents.java
index 99c3059..a1e9ffa 100644
--- a/src/com/android/ex/photo/Intents.java
+++ b/src/com/android/ex/photo/Intents.java
@@ -261,7 +261,17 @@ public class Intents {
public Intent build() {
mIntent.setAction(Intent.ACTION_VIEW);
- mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+ // In Lollipop, each list of photos should appear as a document in the "Recents"
+ // list. In earlier versions, this flag was Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.
+ mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT
+ // FLAG_ACTIVITY_CLEAR_TOP is needed for the case where the app tries to
+ // display a different photo while there is an existing activity instance
+ // for that list of photos. Since the initial photo is specified as an
+ // extra, without FLAG_ACTIVITY_CLEAR_TOP, the activity instance would
+ // just get restarted and it would display whatever photo it was last
+ // displaying. FLAG_ACTIVITY_CLEAR_TOP causes a new instance to be created,
+ // and it will display the new initial photo.
+ | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (mPhotoIndex != null) {
mIntent.putExtra(EXTRA_PHOTO_INDEX, (int) mPhotoIndex);