diff options
author | 2012-05-08 12:39:54 +0900 | |
---|---|---|
committer | 2012-05-08 12:50:07 +0900 | |
commit | 7b6afb1287fb6d5edfebed7403eb31ed23a8348d (patch) | |
tree | 5d8e9d292edc92baa2ffc4777b171daa11a2c5d5 /java/src | |
parent | 22d196cb178e31d3aac23a1d34c5032299dc8bb5 (diff) | |
download | latinime-7b6afb1287fb6d5edfebed7403eb31ed23a8348d.tar.gz latinime-7b6afb1287fb6d5edfebed7403eb31ed23a8348d.tar.xz latinime-7b6afb1287fb6d5edfebed7403eb31ed23a8348d.zip |
Enable long-press spacebar on 7 inch tablet
This change also eliminate useless attribute longPressSpaceKeyTimeout
of LatinKeyboardView.
Bug: 6449356
Change-Id: Ib4dace4b9510c0eb96bdddacf8e0dbaa14fcfbbf
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 58bd845e1..84564c87a 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -110,7 +110,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint; private final PointerTrackerParams mPointerTrackerParams; - private final boolean mIsSpacebarTriggeringPopupByLongPress; private final SuddenJumpingTouchEventHandler mTouchScreenRegulator; protected KeyDetector mKeyDetector; @@ -197,29 +196,27 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke @Override public void startLongPressTimer(PointerTracker tracker) { cancelLongPressTimer(); - if (tracker != null) { - final Key key = tracker.getKey(); - final int delay; - switch (key.mCode) { - case Keyboard.CODE_SHIFT: - delay = mParams.mLongPressShiftKeyTimeout; - break; - case Keyboard.CODE_SPACE: - delay = mParams.mLongPressSpaceKeyTimeout; - break; - default: - if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) { - // We use longer timeout for sliding finger input started from the symbols - // mode key. - delay = mParams.mLongPressKeyTimeout * 3; - } else { - delay = mParams.mLongPressKeyTimeout; - } - break; - } - if (delay > 0) { - sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay); + if (tracker == null) { + return; + } + final Key key = tracker.getKey(); + final int delay; + switch (key.mCode) { + case Keyboard.CODE_SHIFT: + delay = mParams.mLongPressShiftKeyTimeout; + break; + default: + if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) { + // We use longer timeout for sliding finger input started from the symbols + // mode key. + delay = mParams.mLongPressKeyTimeout * 3; + } else { + delay = mParams.mLongPressKeyTimeout; } + break; + } + if (delay > 0) { + sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay); } } @@ -314,7 +311,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke public final int mKeyRepeatInterval; public final int mLongPressKeyTimeout; public final int mLongPressShiftKeyTimeout; - public final int mLongPressSpaceKeyTimeout; public final int mIgnoreAltCodeKeyTimeout; public KeyTimerParams(TypedArray latinKeyboardViewAttr) { @@ -326,8 +322,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke R.styleable.LatinKeyboardView_longPressKeyTimeout, 0); mLongPressShiftKeyTimeout = latinKeyboardViewAttr.getInt( R.styleable.LatinKeyboardView_longPressShiftKeyTimeout, 0); - mLongPressSpaceKeyTimeout = latinKeyboardViewAttr.getInt( - R.styleable.LatinKeyboardView_longPressSpaceKeyTimeout, 0); mIgnoreAltCodeKeyTimeout = latinKeyboardViewAttr.getInt( R.styleable.LatinKeyboardView_ignoreAltCodeKeyTimeout, 0); } @@ -369,7 +363,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke final KeyTimerParams keyTimerParams = new KeyTimerParams(a); mPointerTrackerParams = new PointerTrackerParams(a); - mIsSpacebarTriggeringPopupByLongPress = (keyTimerParams.mLongPressSpaceKeyTimeout > 0); final float keyHysteresisDistance = a.getDimension( R.styleable.LatinKeyboardView_keyHysteresisDistance, 0); @@ -881,9 +874,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke drawSpacebar(key, canvas, paint); // Whether space key needs to show the "..." popup hint for special purposes - if (mIsSpacebarTriggeringPopupByLongPress - && ImfUtils.hasMultipleEnabledIMEsOrSubtypes( - getContext(), true /* include aux subtypes */)) { + if (key.isLongPressEnabled() && ImfUtils.hasMultipleEnabledIMEsOrSubtypes( + getContext(), true /* include aux subtypes */)) { drawKeyPopupHint(key, canvas, paint, params); } } else if (key.mCode == Keyboard.CODE_LANGUAGE_SWITCH) { |