diff options
author | Chih-Chung Chang <chihchung@google.com> | 2011-09-14 12:07:17 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2011-09-14 12:13:54 +0800 |
commit | 36064d1d4450494983652a5264a5d27cab454eed (patch) | |
tree | d8cb13f95c63ccdbe461e3b9b1045df4f8a1e25c /src/com/android | |
parent | e0c32157e3aabdb8f78692d777232eb30a2513e2 (diff) | |
download | android_packages_apps_Snap-36064d1d4450494983652a5264a5d27cab454eed.tar.gz android_packages_apps_Snap-36064d1d4450494983652a5264a5d27cab454eed.tar.bz2 android_packages_apps_Snap-36064d1d4450494983652a5264a5d27cab454eed.zip |
Fix 5280798: Click on filmstrip during swiping causes crash.
After swiping animation finishes we move to the previous
picture. But if during the animation the user clicks the first
thumbnail on the filmstrip, we will have no previous picture
to move to.
Now disallow clicking on the filmstrip during the swiping animation.
Change-Id: Ie910c346cbf35543fedb6812b04c8e78faab0d0f
Diffstat (limited to 'src/com/android')
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. |