diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml index c507bd2a9..2f35d9ae5 100644 --- a/java/res/values-sw600dp/config.xml +++ b/java/res/values-sw600dp/config.xml @@ -28,8 +28,6 @@ false 1200 - - 0 5 5 diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml index b78a6c62a..5fcaeeb41 100644 --- a/java/res/values-sw768dp/config.xml +++ b/java/res/values-sw768dp/config.xml @@ -26,8 +26,6 @@ false true false - - 0 5 5 diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index dbe3cd74f..844b8e96d 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -154,8 +154,6 @@ - - diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 133bb0a06..a6fd22ee1 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -63,9 +63,6 @@ 400 1200 - - - @integer/config_long_press_key_timeout 700 diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index b08ff3b90..1f8c37550 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -75,7 +75,6 @@ @integer/config_key_repeat_interval @integer/config_long_press_key_timeout @integer/config_long_press_shift_key_timeout - @integer/config_long_press_space_key_timeout @integer/config_ignore_alt_code_key_timeout @bool/config_show_more_keys_keyboard_at_touched_point @integer/config_language_on_spacebar_final_alpha diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index dcaf45027..5b3d1b835 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -77,7 +77,7 @@ + latin:keyActionFlags="noKeyPreview|enableLongPress" /> 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) {