diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-05-22 13:32:46 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-05-22 13:44:30 +0800 |
commit | 938aad0bd611642c121c4ca28f2d79502aa3cff9 (patch) | |
tree | b707de6b9adad192a4bcb6c190cf66650cd21296 | |
parent | 9048f91a20782272832ede7facedfb640001191f (diff) | |
download | LegacyCamera-938aad0bd611642c121c4ca28f2d79502aa3cff9.zip LegacyCamera-938aad0bd611642c121c4ca28f2d79502aa3cff9.tar.gz LegacyCamera-938aad0bd611642c121c4ca28f2d79502aa3cff9.tar.bz2 |
Fix ImageGallery bug 1871294, 1871295, 1871299.
We ignore UI events if we are in the stopped state.
-rw-r--r-- | src/com/android/camera/GridViewSpecial.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/ImageGallery.java | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/com/android/camera/GridViewSpecial.java b/src/com/android/camera/GridViewSpecial.java index 8e00ad4..e54f998 100644 --- a/src/com/android/camera/GridViewSpecial.java +++ b/src/com/android/camera/GridViewSpecial.java @@ -283,9 +283,13 @@ class GridViewSpecial extends View { mImageBlockManager.setVisibleRows(startRow, endRow); } + // In MyGestureDetector we have to check canHandleEvent() because + // GestureDetector could queue events and fire them later. At that time + // stop() may have already been called and we can't handle the events. private class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onDown(MotionEvent e) { + if (!canHandleEvent()) return false; if (mScroller != null && !mScroller.isFinished()) { mScroller.forceFinished(true); return false; @@ -303,6 +307,7 @@ class GridViewSpecial extends View { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + if (!canHandleEvent()) return false; final float maxVelocity = 2500; if (velocityY > maxVelocity) { velocityY = maxVelocity; @@ -328,6 +333,7 @@ class GridViewSpecial extends View { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + if (!canHandleEvent()) return false; select(SELECT_NONE, false); scrollBy(0, (int) distanceY); invalidate(); @@ -336,6 +342,7 @@ class GridViewSpecial extends View { @Override public boolean onSingleTapConfirmed(MotionEvent e) { + if (!canHandleEvent()) return false; select(mCurrentSelection, false); int index = computeSelectedIndex(e.getX(), e.getY()); if (index >= 0 && index < mCount) { diff --git a/src/com/android/camera/ImageGallery.java b/src/com/android/camera/ImageGallery.java index 63be5b4..5610191 100644 --- a/src/com/android/camera/ImageGallery.java +++ b/src/com/android/camera/ImageGallery.java @@ -514,6 +514,7 @@ public class ImageGallery extends Activity implements @Override public boolean onPrepareOptionsMenu(Menu menu) { + if (!canHandleEvent()) return false; if ((mInclusion & ImageManager.INCLUDE_IMAGES) != 0) { boolean videoSelected = isVideoSelected(); // TODO: Only enable slide show if there is at least one image in @@ -734,6 +735,8 @@ public class ImageGallery extends Activity implements View.OnCreateContextMenuListener { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { + if (!canHandleEvent()) return; + if (getCurrentImage() == null) { return; } |