From 833f775afc9515567dc5aaf0cafe20e006e77545 Mon Sep 17 00:00:00 2001 From: Bobby Georgescu Date: Wed, 26 Sep 2012 14:22:57 -0700 Subject: Fix behavior of up button in Camera app Bug: 7233448 - Up button now goes to gallery root when appropriate. Change-Id: Ib474335b2ac4139e7c5a213bda3efa481b24f224 --- src/com/android/gallery3d/app/AlbumPage.java | 4 +++- src/com/android/gallery3d/app/PhotoPage.java | 10 +++------- src/com/android/gallery3d/util/GalleryUtils.java | 6 ++++++ 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 30682a115..a19798f2b 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -214,7 +214,9 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } private void onUpPressed() { - if (mActivity.getStateManager().getStateCount() > 1) { + if (mInCameraApp) { + GalleryUtils.startGalleryActivity(mActivity); + } else if (mActivity.getStateManager().getStateCount() > 1) { super.onBackPressed(); } else if (mParentMediaSetString != null) { Bundle data = new Bundle(getData()); diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 29211ffee..760c96d58 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -659,7 +659,8 @@ public class PhotoPage extends ActivityState implements } private void onUpPressed() { - if (mStartInFilmstrip && !mPhotoView.getFilmMode()) { + if ((mStartInFilmstrip || mAppBridge != null) + && !mPhotoView.getFilmMode()) { mPhotoView.setFilmMode(true); return; } @@ -681,12 +682,7 @@ public class PhotoPage extends ActivityState implements DataManager.INCLUDE_ALL)); mActivity.getStateManager().switchState(this, AlbumPage.class, data); } else { - // Start the real gallery activity to view the camera roll. - Uri uri = Uri.parse("content://media/external/file?bucketId=" - + MediaSetUtils.CAMERA_BUCKET_ID); - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(uri, ContentResolver.CURSOR_DIR_BASE_TYPE + "/image"); - ((Activity) mActivity).startActivity(intent); + GalleryUtils.startGalleryActivity(mActivity); } } diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java index f04a5ccff..6639c55f0 100644 --- a/src/com/android/gallery3d/util/GalleryUtils.java +++ b/src/com/android/gallery3d/util/GalleryUtils.java @@ -37,6 +37,7 @@ import android.util.Log; import android.view.WindowManager; import com.android.gallery3d.R; +import com.android.gallery3d.app.Gallery; import com.android.gallery3d.app.PackagesMonitor; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.data.DataManager; @@ -240,6 +241,11 @@ public class GalleryUtils { context.startActivity(intent); } + public static void startGalleryActivity(Context context) { + Intent intent = new Intent(context, Gallery.class); + context.startActivity(intent); + } + public static boolean isValidLocation(double latitude, double longitude) { // TODO: change || to && after we fix the default location issue return (latitude != MediaItem.INVALID_LATLNG || longitude != MediaItem.INVALID_LATLNG); -- cgit v1.2.3