From 98c2490a424da79beefbdd8a29fb90ab006c77b0 Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Tue, 3 Apr 2012 10:42:55 +0800 Subject: 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 --- src/com/android/gallery3d/app/AlbumPage.java | 9 +++------ src/com/android/gallery3d/app/PhotoPage.java | 16 +++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) (limited to 'src') 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; -- cgit v1.2.3