diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 29 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 31 |
2 files changed, 40 insertions, 20 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 9dd05ac89..0e3e31f7e 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -147,6 +147,16 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } }; + // This are the transitions we want: + // + // +--------+ +------------+ +-------+ +----------+ + // | Camera |---------->| Fullscreen |--->| Album |--->| AlbumSet | + // | View | thumbnail | Photo | up | Page | up | Page | + // +--------+ +------------+ +-------+ +----------+ + // ^ | | ^ | + // | | | | | close + // +----------back--------+ +----back----+ +--back-> app + // @Override protected void onBackPressed() { if (mShowDetails) { @@ -156,7 +166,18 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } else { // TODO: fix this regression // mAlbumView.savePositions(PositionRepository.getInstance(mActivity)); + onUpPressed(); + } + } + + private void onUpPressed() { + if (mActivity.getStateManager().getStateCount() > 1) { super.onBackPressed(); + } else if (mParentMediaSetString != null) { + Bundle data = new Bundle(getData()); + data.putString(AlbumSetPage.KEY_MEDIA_PATH, mParentMediaSetString); + mActivity.getStateManager().switchState( + this, AlbumSetPage.class, data); } } @@ -467,13 +488,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster protected boolean onItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { - if (mActivity.getStateManager().getStateCount() > 1) { - onBackPressed(); - } else if (mParentMediaSetString != null) { - Bundle data = new Bundle(getData()); - data.putString(AlbumSetPage.KEY_MEDIA_PATH, mParentMediaSetString); - mActivity.getStateManager().switchState(this, AlbumSetPage.class, data); - } + onUpPressed(); return true; } case R.id.action_cancel: diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index afa56c905..a237cbac3 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -110,6 +110,8 @@ public class PhotoPage extends ActivityState implements private boolean mIsActive; private ShareActionProvider mShareActionProvider; private String mSetPathString; + // This is the original mSetPathString before adding the camera preview item. + private String mOriginalSetPathString; private AppBridge mAppBridge; private ScreenNail mScreenNail; private MediaItem mScreenNailItem; @@ -171,6 +173,7 @@ public class PhotoPage extends ActivityState implements mOrientationManager.addListener(this); mSetPathString = data.getString(KEY_MEDIA_SET_PATH); + mOriginalSetPathString = mSetPathString; mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity.getAndroidContext()); Path itemPath = Path.fromString(data.getString(KEY_MEDIA_ITEM_PATH)); @@ -427,6 +430,20 @@ public class PhotoPage extends ActivityState implements } } + private void onUpPressed() { + if (mActivity.getStateManager().getStateCount() > 1) { + super.onBackPressed(); + } else if (mOriginalSetPathString != null) { + // We're in view mode so set up the stacks on our own. + Bundle data = new Bundle(getData()); + data.putString(AlbumPage.KEY_MEDIA_PATH, mOriginalSetPathString); + data.putString(AlbumPage.KEY_PARENT_MEDIA_PATH, + mActivity.getDataManager().getTopSetPath( + DataManager.INCLUDE_ALL)); + mActivity.getStateManager().switchState(this, AlbumPage.class, data); + } + } + private void setResult() { Intent result = null; if (!mPhotoView.getFilmMode()) { @@ -480,19 +497,7 @@ public class PhotoPage extends ActivityState implements boolean needsConfirm = false; switch (action) { case android.R.id.home: { - if (mSetPathString != null) { - if (mActivity.getStateManager().getStateCount() > 1) { - onBackPressed(); - } else { - // 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); - } - } + onUpPressed(); return true; } case R.id.action_slideshow: { |