Merge "Mini keyboard works even while shift is being pressed" into gingerbread

main
Tadashi G. Takaoka 2010-09-28 21:01:46 -07:00 committed by Android (Google) Code Review
commit c2c9cd82da
2 changed files with 14 additions and 5 deletions

View File

@ -205,6 +205,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
private long mMiniKeyboardPopupTime; private long mMiniKeyboardPopupTime;
private int[] mWindowOffset; private int[] mWindowOffset;
private final float mMiniKeyboardSlideAllowance; private final float mMiniKeyboardSlideAllowance;
private int mMiniKeyboardTrackerId;
/** Listener for {@link OnKeyboardActionListener}. */ /** Listener for {@link OnKeyboardActionListener}. */
private OnKeyboardActionListener mKeyboardActionListener; private OnKeyboardActionListener mKeyboardActionListener;
@ -1023,6 +1024,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
if (result) { if (result) {
dismissKeyPreview(); dismissKeyPreview();
tracker.setAlreadyProcessed(); tracker.setAlreadyProcessed();
mMiniKeyboardTrackerId = tracker.mPointerId;
} }
return result; return result;
} }
@ -1258,9 +1260,15 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
// Needs to be called after the gesture detector gets a turn, as it may have // Needs to be called after the gesture detector gets a turn, as it may have
// displayed the mini keyboard // displayed the mini keyboard
if (mMiniKeyboard != null) { if (mMiniKeyboard != null) {
MotionEvent translated = generateMiniKeyboardMotionEvent(action, x, y, eventTime); final int miniKeyboardPointerIndex = me.findPointerIndex(mMiniKeyboardTrackerId);
mMiniKeyboard.onTouchEvent(translated); if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) {
translated.recycle(); final int miniKeyboardX = (int)me.getX(miniKeyboardPointerIndex);
final int miniKeyboardY = (int)me.getY(miniKeyboardPointerIndex);
MotionEvent translated = generateMiniKeyboardMotionEvent(action,
miniKeyboardX, miniKeyboardY, eventTime);
mMiniKeyboard.onTouchEvent(translated);
translated.recycle();
}
return true; return true;
} }

View File

@ -515,7 +515,8 @@ public class PointerTracker {
int primaryCode = key.codes[0]; int primaryCode = key.codes[0];
code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode); code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode);
} }
Log.d(TAG, String.format("%s [%d] %3d,%3d %3d(%s) %s", title, mPointerId, x, y, keyIndex, Log.d(TAG, String.format("%s%s[%d] %3d,%3d %3d(%s) %s", title,
code, isModifier() ? "modifier" : "")); (mKeyAlreadyProcessed ? "-" : " "), mPointerId, x, y, keyIndex, code,
(isModifier() ? "modifier" : "")));
} }
} }