diff options
author | Owen Lin <owenlin@google.com> | 2009-05-12 19:10:57 -0700 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2009-05-13 16:44:34 -0700 |
commit | 77e110b93d904a19d9d454c825688cf1706f2392 (patch) | |
tree | a0b368b0c128c12d997c942f3f25016c5c7f47cf /src/com/android | |
parent | 5862926be88d7959cb5f5c9a8a746247fefbf29b (diff) | |
download | LegacyCamera-77e110b93d904a19d9d454c825688cf1706f2392.zip LegacyCamera-77e110b93d904a19d9d454c825688cf1706f2392.tar.gz LegacyCamera-77e110b93d904a19d9d454c825688cf1706f2392.tar.bz2 |
Fix bug 1707148 by disabling long press if it is not running.
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/GridViewSpecial.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/camera/GridViewSpecial.java b/src/com/android/camera/GridViewSpecial.java index 142110d..a7cea30 100644 --- a/src/com/android/camera/GridViewSpecial.java +++ b/src/com/android/camera/GridViewSpecial.java @@ -27,7 +27,6 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Handler; import android.util.AttributeSet; -import android.util.Log; import android.view.GestureDetector; import android.view.KeyEvent; import android.view.MotionEvent; @@ -88,7 +87,7 @@ class GridViewSpecial extends View { }; // These are set in init(). - private Handler mHandler = new Handler(); + private final Handler mHandler = new Handler(); private GestureDetector mGestureDetector; private ImageBlockManager mImageBlockManager; @@ -118,7 +117,7 @@ class GridViewSpecial extends View { private boolean mRunning = false; private boolean mShowSelection = false; - private boolean mFling = true; + private final boolean mFling = true; private Scroller mScroller = null; public GridViewSpecial(Context context, AttributeSet attrs) { @@ -135,7 +134,7 @@ class GridViewSpecial extends View { setFocusableInTouchMode(true); } - private Runnable mRedrawCallback = new Runnable() { + private final Runnable mRedrawCallback = new Runnable() { public void run() { invalidate(); } @@ -326,7 +325,9 @@ class GridViewSpecial extends View { @Override public void onLongPress(MotionEvent e) { - performLongClick(); + if (GridViewSpecial.this.mRunning) { + performLongClick(); + } } @Override @@ -441,6 +442,9 @@ class GridViewSpecial extends View { // mGvs.set...(...); // mGvs.start(); public void stop() { + // Remove the long press callback from the queue if we are going to + // stop + mHandler.removeCallbacks(mLongPressCallback); mScroller = null; if (mImageBlockManager != null) { mImageBlockManager.recycle(); @@ -911,7 +915,7 @@ class ImageBlockManager { // drawn to mBitmap. mBitmap is later used in onDraw() of GridViewSpecial. private class ImageBlock { private Bitmap mBitmap; - private Canvas mCanvas; + private final Canvas mCanvas; // Columns which have been requested to the loader private int mRequestedMask; |