diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2011-08-23 15:57:51 +0900 |
|---|---|---|
| committer | Tadashi G. Takaoka <takaoka@google.com> | 2011-08-23 17:44:41 +0900 |
| commit | c403a46f6d787b79768895272d53d296100677dd (patch) | |
| tree | 98aa920e0e439cd0e231cdb4edb59b2864c0bcf4 /java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java | |
| parent | 6dde878d515f7bf5268d16a8fe4921d8821c5ae7 (diff) | |
Extract sudden jumping touch event hack into separate class
Bug: 5182291
Change-Id: I6a88ed4df3ec98e31ea4966d82da56f7fca342ac
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java index 4a7b2bd60..4b85bcbec 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java @@ -53,11 +53,14 @@ import java.util.WeakHashMap; * @attr ref R.styleable#KeyboardView_verticalCorrection * @attr ref R.styleable#KeyboardView_popupLayout */ -public class LatinKeyboardBaseView extends KeyboardView implements PointerTracker.KeyEventHandler { +public class LatinKeyboardBaseView extends KeyboardView implements PointerTracker.KeyEventHandler, + SuddenJumpingTouchEventHandler.ProcessMotionEvent { private static final String TAG = LatinKeyboardBaseView.class.getSimpleName(); private static final boolean ENABLE_CAPSLOCK_BY_DOUBLETAP = true; + private final SuddenJumpingTouchEventHandler mTouchScreenRegulator; + // Timing constants private final int mKeyRepeatInterval; @@ -213,6 +216,8 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke public LatinKeyboardBaseView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + mTouchScreenRegulator = new SuddenJumpingTouchEventHandler(getContext(), this); + final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView); mVerticalCorrection = a.getDimensionPixelOffset( @@ -300,6 +305,7 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection); mKeyDetector.setProximityThreshold(keyboard.mMostCommonKeyWidth); PointerTracker.setKeyDetector(mKeyDetector); + mTouchScreenRegulator.setKeyboard(keyboard); mPopupPanelCache.clear(); } @@ -481,6 +487,11 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke @Override public boolean onTouchEvent(MotionEvent me) { + return mTouchScreenRegulator.onTouchEvent(me); + } + + @Override + public boolean processMotionEvent(MotionEvent me) { final boolean nonDistinctMultitouch = !mHasDistinctMultitouch; final int action = me.getActionMasked(); final int pointerCount = me.getPointerCount(); |
