diff options
| author | Ray Chen <raychen@google.com> | 2012-04-03 10:42:55 +0800 |
|---|---|---|
| committer | Ray Chen <raychen@google.com> | 2012-04-03 17:39:44 +0800 |
| commit | 98c2490a424da79beefbdd8a29fb90ab006c77b0 (patch) | |
| tree | d3a64b6ebe0edc22306be6ec15a60845f5d78902 /src | |
| parent | 602295200f93a54d891d25db14b524beb5ca4d01 (diff) | |
| download | android_packages_apps_Gallery2-98c2490a424da79beefbdd8a29fb90ab006c77b0.tar.gz android_packages_apps_Gallery2-98c2490a424da79beefbdd8a29fb90ab006c77b0.tar.bz2 android_packages_apps_Gallery2-98c2490a424da79beefbdd8a29fb90ab006c77b0.zip | |
Fix b/3462852 [UI] When linking from Camera preview - App icon with 'Up' arrow should go to next level up
Change startActivity to switchState because not every MediaObject implements "getContentUri" which may
cause runtime exception.
Change-Id: I88be6e9e8f15ad17f4c7347b6dfc200c7682ce01
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 9 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 16 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 43936e746..e0b738444 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -462,12 +462,9 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (mActivity.getStateManager().getStateCount() > 1) { onBackPressed(); } else if (mParentMediaSetString != null) { - Activity a = (Activity) mActivity; - int flags = Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK; - Intent intent = new Intent() - .setClass(a, Gallery.class) - .setFlags(flags); - a.startActivity(intent); + Bundle data = new Bundle(getData()); + data.putString(AlbumSetPage.KEY_MEDIA_PATH, mParentMediaSetString); + mActivity.getStateManager().switchState(this, AlbumSetPage.class, data); } return true; } diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index e16ac8a3e..32aba9308 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -425,15 +425,13 @@ public class PhotoPage extends ActivityState if (mActivity.getStateManager().getStateCount() > 1) { onBackPressed(); } else { - Activity a = (Activity) mActivity; - Uri uri = mActivity.getDataManager().getContentUri( - Path.fromString(mSetPathString)); - Intent intent = new Intent(Intent.ACTION_VIEW) - .setClass(a, Gallery.class) - .setDataAndType(uri, ContentResolver.CURSOR_DIR_BASE_TYPE) - .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | - Intent.FLAG_ACTIVITY_NEW_TASK); - a.startActivity(intent); + // We're in view mode so set up the stacks on our own. + Bundle data = new Bundle(getData()); + data.putString(AlbumPage.KEY_MEDIA_PATH, mSetPathString); + data.putString(AlbumPage.KEY_PARENT_MEDIA_PATH, + mActivity.getDataManager().getTopSetPath( + DataManager.INCLUDE_ALL)); + mActivity.getStateManager().switchState(this, AlbumPage.class, data); } } return true; |
