diff options
4 files changed, 20 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 3e8972f4b..a3b385ac0 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -510,9 +510,10 @@ public class PhotoPage extends ActivityState } } - // Called by FileStripView - public void onSlotSelected(int slotIndex) { - ((PhotoDataAdapter) mModel).jumpTo(slotIndex); + // Called by FileStripView. + // Returns false if it cannot jump to the specified index at this time. + public boolean onSlotSelected(int slotIndex) { + return mPhotoView.jumpTo(slotIndex); } @Override diff --git a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java index 54183e006..0c54ada11 100644 --- a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java @@ -174,6 +174,10 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter throw new UnsupportedOperationException(); } + public void jumpTo(int index) { + throw new UnsupportedOperationException(); + } + public MediaItem getCurrentMediaItem() { return mItem; } diff --git a/src/com/android/gallery3d/ui/FilmStripView.java b/src/com/android/gallery3d/ui/FilmStripView.java index c53e1aedf..a6be2d10a 100644 --- a/src/com/android/gallery3d/ui/FilmStripView.java +++ b/src/com/android/gallery3d/ui/FilmStripView.java @@ -34,7 +34,8 @@ public class FilmStripView extends GLView implements SlotView.Listener, private static final int HIDE_ANIMATION_DURATION = 300; // 0.3 sec public interface Listener { - void onSlotSelected(int slotIndex); + // Returns false if it cannot jump to the specified index at this time. + boolean onSlotSelected(int slotIndex); } private int mTopMargin, mMidMargin, mBottomMargin; @@ -171,8 +172,9 @@ public class FilmStripView extends GLView implements SlotView.Listener, // Called by AlbumView @Override public void onSingleTapUp(int slotIndex) { - mAlbumView.setFocusIndex(slotIndex); - mListener.onSlotSelected(slotIndex); + if (mListener.onSlotSelected(slotIndex)) { + mAlbumView.setFocusIndex(slotIndex); + } } // Called by AlbumView diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index aba572b00..feb0ee778 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -985,6 +985,12 @@ public class PhotoView extends GLView { } } + public boolean jumpTo(int index) { + if (mTransitionMode != TRANS_NONE) return false; + mModel.jumpTo(index); + return true; + } + public void notifyOnNewImage() { mPositionController.setImageSize(0, 0); } @@ -1065,6 +1071,7 @@ public class PhotoView extends GLView { public static interface Model extends TileImageView.Model { public void next(); public void previous(); + public void jumpTo(int index); public int getImageRotation(); // Return null if the specified image is unavailable. |