diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-01 15:50:11 -0700 |
---|---|---|
committer | Bobby Georgescu <georgescu@google.com> | 2012-10-01 15:56:51 -0700 |
commit | 3cf502a91b36bf6ce633f897505b0a2c3fc53ad5 (patch) | |
tree | 23815d26f31352e088d1e0a710a6fd6d341f8880 /src/com/android/gallery3d/app/AlbumPage.java | |
parent | c58fe396fb7c6208740fa22a005e94a358b8266f (diff) | |
download | android_packages_apps_Gallery2-3cf502a91b36bf6ce633f897505b0a2c3fc53ad5.tar.gz android_packages_apps_Gallery2-3cf502a91b36bf6ce633f897505b0a2c3fc53ad5.tar.bz2 android_packages_apps_Gallery2-3cf502a91b36bf6ce633f897505b0a2c3fc53ad5.zip |
Move grid/filmstrip switching to ActionBar title "spinner"
Bug: 7233818
Bug: 7240846
Bug: 7258973
Tapping the title of the album, whether in filmstrip or
grid mode, allows switching between these modes using a
menu. The album name is now displayed when viewing pictures
in the filmstrip or zoomed in modes. Finally, no longer
allow switching to grid mode when not appropriate.
Change-Id: I4ee511feb7a74581fe185933ddd5110e5eb9feb0
Diffstat (limited to 'src/com/android/gallery3d/app/AlbumPage.java')
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index addee0ed7..ae6418cce 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -56,7 +56,7 @@ import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.MediaSetUtils; public class AlbumPage extends ActivityState implements GalleryActionBar.ClusterRunner, - SelectionManager.SelectionListener, MediaSet.SyncListener { + SelectionManager.SelectionListener, MediaSet.SyncListener, GalleryActionBar.OnAlbumModeSelectedListener { @SuppressWarnings("unused") private static final String TAG = "AlbumPage"; @@ -399,7 +399,9 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster boolean enableHomeButton = (mActivity.getStateManager().getStateCount() > 1) | mParentMediaSetString != null; - mActivity.getGalleryActionBar().setDisplayOptions(enableHomeButton, true); + GalleryActionBar actionBar = mActivity.getGalleryActionBar(); + actionBar.setDisplayOptions(enableHomeButton, false); + actionBar.enableAlbumModeMenu(GalleryActionBar.ALBUM_GRID_MODE_SELECTED, this); // Set the reload bit here to prevent it exit this page in clearLoadingBit(). setLoadingBit(BIT_LOADING_RELOAD); @@ -423,6 +425,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mAlbumDataAdapter.pause(); mAlbumView.pause(); DetailsHelper.pause(); + mActivity.getGalleryActionBar().disableAlbumModeMenu(true); if (mSyncTask != null) { mSyncTask.cancel(); @@ -560,6 +563,17 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mSlotView.getSlotRect(slotIndex, mRootPane)); } + private void switchToFilmstrip() { + if (mAlbumDataAdapter.size() < 1) return; + int targetPhoto = mSlotView.getVisibleStart(); + prepareAnimationBackToFilmstrip(targetPhoto); + if(mLaunchedFromPhotoPage) { + onBackPressed(); + } else { + pickPhoto(targetPhoto, true); + } + } + @Override protected boolean onItemSelected(MenuItem item) { switch (item.getItemId()) { @@ -587,17 +601,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster SlideshowPage.class, REQUEST_SLIDESHOW, data); return true; } - case R.id.action_filmstrip: { - if (mAlbumDataAdapter.size() < 1) return true; - int targetPhoto = mSlotView.getVisibleStart(); - prepareAnimationBackToFilmstrip(targetPhoto); - if(mLaunchedFromPhotoPage) { - onBackPressed(); - } else { - pickPhoto(targetPhoto, true); - } - return true; - } case R.id.action_details: { if (mShowDetails) { hideDetails(); @@ -750,4 +753,11 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } } } + + @Override + public void onAlbumModeSelected(int mode) { + if (mode == GalleryActionBar.ALBUM_FILMSTRIP_MODE_SELECTED) { + switchToFilmstrip(); + } + } } |