Merge change I98cb3b5c

* changes:
  Fixes the IME not triggering on touch bug.
This commit is contained in:
Android (Google) Code Review
2009-12-15 13:31:32 -08:00

View File

@@ -2726,7 +2726,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
setPressed(false);
if (!mHasPerformedLongPress) {
cancelLongPress();
removeLongPressCallback();
}
}
}
@@ -3748,7 +3748,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
if (imm != null && (mPrivateFlags & FOCUSED) != 0) {
imm.focusOut(this);
}
cancelLongPress();
removeLongPressCallback();
onFocusLost();
} else if (imm != null && (mPrivateFlags & FOCUSED) != 0) {
imm.focusIn(this);
@@ -3994,7 +3994,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
if (!mHasPerformedLongPress) {
// This is a tap, so remove the longpress check
cancelLongPress();
removeLongPressCallback();
result = performClick();
}
@@ -4184,7 +4184,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
if (!mHasPerformedLongPress) {
// This is a tap, so remove the longpress check
cancelLongPress();
removeLongPressCallback();
// Only perform take click actions if we were in the pressed state
if (!focusTaken) {
@@ -4227,7 +4227,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
// Outside button
if ((mPrivateFlags & PRESSED) != 0) {
// Remove any future long press checks
cancelLongPress();
removeLongPressCallback();
// Need to switch from pressed to not pressed
mPrivateFlags &= ~PRESSED;
@@ -4249,6 +4249,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
return false;
}
/**
* Remove the longpress detection timer.
*/
private void removeLongPressCallback() {
if (mPendingCheckForLongPress != null) {
removeCallbacks(mPendingCheckForLongPress);
}
}
/**
* Cancels a pending long press. Your subclass can use this if you
* want the context menu to come up if the user presses and holds
@@ -4256,9 +4265,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* and then move around enough to cause scrolling.
*/
public void cancelLongPress() {
if (mPendingCheckForLongPress != null) {
removeCallbacks(mPendingCheckForLongPress);
}
removeLongPressCallback();
}
/**
@@ -5759,7 +5766,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* @see #onAttachedToWindow()
*/
protected void onDetachedFromWindow() {
cancelLongPress();
removeLongPressCallback();
destroyDrawingCache();
}