diff options
Diffstat (limited to 'photoviewer/src/com/android/ex/photo/Intents.java')
-rw-r--r-- | photoviewer/src/com/android/ex/photo/Intents.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/photoviewer/src/com/android/ex/photo/Intents.java b/photoviewer/src/com/android/ex/photo/Intents.java index e1e77d3..24c48fe 100644 --- a/photoviewer/src/com/android/ex/photo/Intents.java +++ b/photoviewer/src/com/android/ex/photo/Intents.java @@ -29,7 +29,7 @@ import com.android.ex.photo.fragments.PhotoViewFragment; public class Intents { // Intent extras public static final String EXTRA_PHOTO_INDEX = "photo_index"; - public static final String EXTRA_PHOTO_ID = "photo_id"; + public static final String EXTRA_INITIAL_PHOTO_URI = "initial_photo_uri"; public static final String EXTRA_PHOTOS_URI = "photos_uri"; public static final String EXTRA_RESOLVED_PHOTO_URI = "resolved_photo_uri"; public static final String EXTRA_PROJECTION = "projection"; @@ -68,6 +68,8 @@ public class Intents { /** The index of the photo to show */ private Integer mPhotoIndex; + /** The URI of the initial photo to show */ + private String mInitialPhotoUri; /** The URI of the group of photos to display */ private String mPhotosUri; /** The URL of the photo to display */ @@ -89,6 +91,12 @@ public class Intents { return this; } + /** Sets the initial photo URI */ + public PhotoViewIntentBuilder setInitialPhotoUri(String initialPhotoUri) { + mInitialPhotoUri = initialPhotoUri; + return this; + } + /** Sets the photos URI */ public PhotoViewIntentBuilder setPhotosUri(String photosUri) { mPhotosUri = photosUri; @@ -137,6 +145,14 @@ public class Intents { mIntent.putExtra(EXTRA_PHOTO_INDEX, (int) mPhotoIndex); } + if (mInitialPhotoUri != null) { + mIntent.putExtra(EXTRA_INITIAL_PHOTO_URI, mInitialPhotoUri); + } + if (mInitialPhotoUri != null && mPhotoIndex != null) { + throw new IllegalStateException( + "specified both photo index and photo uri"); + } + if (mPhotosUri != null) { mIntent.putExtra(EXTRA_PHOTOS_URI, mPhotosUri); } |