Enable long-press spacebar on 7 inch tablet
This change also eliminate useless attribute longPressSpaceKeyTimeout of LatinKeyboardView. Bug: 6449356 Change-Id: Ib4dace4b9510c0eb96bdddacf8e0dbaa14fcfbbfmain
parent
22d196cb17
commit
7b6afb1287
|
@ -28,8 +28,6 @@
|
||||||
<bool name="config_auto_correction_spacebar_led_enabled">false</bool>
|
<bool name="config_auto_correction_spacebar_led_enabled">false</bool>
|
||||||
<!-- The language is never displayed if == 0, always displayed if < 0 -->
|
<!-- The language is never displayed if == 0, always displayed if < 0 -->
|
||||||
<integer name="config_delay_before_fadeout_language_on_spacebar">1200</integer>
|
<integer name="config_delay_before_fadeout_language_on_spacebar">1200</integer>
|
||||||
<!-- Long pressing space will invoke IME switcher if > 0, never invoke IME switcher if == 0 -->
|
|
||||||
<integer name="config_long_press_space_key_timeout">0</integer>
|
|
||||||
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
||||||
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
|
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
|
||||||
<integer name="config_max_more_keys_column">5</integer>
|
<integer name="config_max_more_keys_column">5</integer>
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
<bool name="config_default_popup_preview">false</bool>
|
<bool name="config_default_popup_preview">false</bool>
|
||||||
<bool name="config_default_sound_enabled">true</bool>
|
<bool name="config_default_sound_enabled">true</bool>
|
||||||
<bool name="config_auto_correction_spacebar_led_enabled">false</bool>
|
<bool name="config_auto_correction_spacebar_led_enabled">false</bool>
|
||||||
<!-- Long pressing space will invoke IME switcher if > 0, never invoke IME switcher if == 0 -->
|
|
||||||
<integer name="config_long_press_space_key_timeout">0</integer>
|
|
||||||
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
||||||
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
|
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
|
||||||
<integer name="config_max_more_keys_column">5</integer>
|
<integer name="config_max_more_keys_column">5</integer>
|
||||||
|
|
|
@ -154,8 +154,6 @@
|
||||||
<attr name="longPressKeyTimeout" format="integer" />
|
<attr name="longPressKeyTimeout" format="integer" />
|
||||||
<!-- Long press timeout of shift key in millisecond. -->
|
<!-- Long press timeout of shift key in millisecond. -->
|
||||||
<attr name="longPressShiftKeyTimeout" format="integer" />
|
<attr name="longPressShiftKeyTimeout" format="integer" />
|
||||||
<!-- Long press timeout of space key in millisecond. -->
|
|
||||||
<attr name="longPressSpaceKeyTimeout" format="integer" />
|
|
||||||
<!-- Ignore special key timeout while typing in millisecond. -->
|
<!-- Ignore special key timeout while typing in millisecond. -->
|
||||||
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
|
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
|
||||||
<!-- More keys keyboard will shown at touched point. -->
|
<!-- More keys keyboard will shown at touched point. -->
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
<integer name="config_long_press_key_timeout">400</integer>
|
<integer name="config_long_press_key_timeout">400</integer>
|
||||||
<!-- Long pressing shift will invoke caps-lock if > 0, never invoke caps-lock if == 0 -->
|
<!-- Long pressing shift will invoke caps-lock if > 0, never invoke caps-lock if == 0 -->
|
||||||
<integer name="config_long_press_shift_key_timeout">1200</integer>
|
<integer name="config_long_press_shift_key_timeout">1200</integer>
|
||||||
<!-- Long pressing space will invoke IME switcher if > 0, never invoke IME switcher if == 0 -->
|
|
||||||
<integer name="config_long_press_space_key_timeout">
|
|
||||||
@integer/config_long_press_key_timeout</integer>
|
|
||||||
<integer name="config_ignore_alt_code_key_timeout">700</integer>
|
<integer name="config_ignore_alt_code_key_timeout">700</integer>
|
||||||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||||
false -->
|
false -->
|
||||||
|
|
|
@ -75,7 +75,6 @@
|
||||||
<item name="keyRepeatInterval">@integer/config_key_repeat_interval</item>
|
<item name="keyRepeatInterval">@integer/config_key_repeat_interval</item>
|
||||||
<item name="longPressKeyTimeout">@integer/config_long_press_key_timeout</item>
|
<item name="longPressKeyTimeout">@integer/config_long_press_key_timeout</item>
|
||||||
<item name="longPressShiftKeyTimeout">@integer/config_long_press_shift_key_timeout</item>
|
<item name="longPressShiftKeyTimeout">@integer/config_long_press_shift_key_timeout</item>
|
||||||
<item name="longPressSpaceKeyTimeout">@integer/config_long_press_space_key_timeout</item>
|
|
||||||
<item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
|
<item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
|
||||||
<item name="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
|
<item name="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
|
||||||
<item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>
|
<item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="spaceKeyStyle"
|
latin:styleName="spaceKeyStyle"
|
||||||
latin:code="!code/key_space"
|
latin:code="!code/key_space"
|
||||||
latin:keyActionFlags="noKeyPreview" />
|
latin:keyActionFlags="noKeyPreview|enableLongPress" />
|
||||||
<!-- U+200C: ZERO WIDTH NON-JOINER
|
<!-- U+200C: ZERO WIDTH NON-JOINER
|
||||||
U+200D: ZERO WIDTH JOINER -->
|
U+200D: ZERO WIDTH JOINER -->
|
||||||
<key-style
|
<key-style
|
||||||
|
|
|
@ -110,7 +110,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
|
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
|
||||||
|
|
||||||
private final PointerTrackerParams mPointerTrackerParams;
|
private final PointerTrackerParams mPointerTrackerParams;
|
||||||
private final boolean mIsSpacebarTriggeringPopupByLongPress;
|
|
||||||
private final SuddenJumpingTouchEventHandler mTouchScreenRegulator;
|
private final SuddenJumpingTouchEventHandler mTouchScreenRegulator;
|
||||||
|
|
||||||
protected KeyDetector mKeyDetector;
|
protected KeyDetector mKeyDetector;
|
||||||
|
@ -197,16 +196,15 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
@Override
|
@Override
|
||||||
public void startLongPressTimer(PointerTracker tracker) {
|
public void startLongPressTimer(PointerTracker tracker) {
|
||||||
cancelLongPressTimer();
|
cancelLongPressTimer();
|
||||||
if (tracker != null) {
|
if (tracker == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Key key = tracker.getKey();
|
final Key key = tracker.getKey();
|
||||||
final int delay;
|
final int delay;
|
||||||
switch (key.mCode) {
|
switch (key.mCode) {
|
||||||
case Keyboard.CODE_SHIFT:
|
case Keyboard.CODE_SHIFT:
|
||||||
delay = mParams.mLongPressShiftKeyTimeout;
|
delay = mParams.mLongPressShiftKeyTimeout;
|
||||||
break;
|
break;
|
||||||
case Keyboard.CODE_SPACE:
|
|
||||||
delay = mParams.mLongPressSpaceKeyTimeout;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) {
|
if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) {
|
||||||
// We use longer timeout for sliding finger input started from the symbols
|
// We use longer timeout for sliding finger input started from the symbols
|
||||||
|
@ -221,7 +219,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay);
|
sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancelLongPressTimer() {
|
public void cancelLongPressTimer() {
|
||||||
|
@ -314,7 +311,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
public final int mKeyRepeatInterval;
|
public final int mKeyRepeatInterval;
|
||||||
public final int mLongPressKeyTimeout;
|
public final int mLongPressKeyTimeout;
|
||||||
public final int mLongPressShiftKeyTimeout;
|
public final int mLongPressShiftKeyTimeout;
|
||||||
public final int mLongPressSpaceKeyTimeout;
|
|
||||||
public final int mIgnoreAltCodeKeyTimeout;
|
public final int mIgnoreAltCodeKeyTimeout;
|
||||||
|
|
||||||
public KeyTimerParams(TypedArray latinKeyboardViewAttr) {
|
public KeyTimerParams(TypedArray latinKeyboardViewAttr) {
|
||||||
|
@ -326,8 +322,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
R.styleable.LatinKeyboardView_longPressKeyTimeout, 0);
|
R.styleable.LatinKeyboardView_longPressKeyTimeout, 0);
|
||||||
mLongPressShiftKeyTimeout = latinKeyboardViewAttr.getInt(
|
mLongPressShiftKeyTimeout = latinKeyboardViewAttr.getInt(
|
||||||
R.styleable.LatinKeyboardView_longPressShiftKeyTimeout, 0);
|
R.styleable.LatinKeyboardView_longPressShiftKeyTimeout, 0);
|
||||||
mLongPressSpaceKeyTimeout = latinKeyboardViewAttr.getInt(
|
|
||||||
R.styleable.LatinKeyboardView_longPressSpaceKeyTimeout, 0);
|
|
||||||
mIgnoreAltCodeKeyTimeout = latinKeyboardViewAttr.getInt(
|
mIgnoreAltCodeKeyTimeout = latinKeyboardViewAttr.getInt(
|
||||||
R.styleable.LatinKeyboardView_ignoreAltCodeKeyTimeout, 0);
|
R.styleable.LatinKeyboardView_ignoreAltCodeKeyTimeout, 0);
|
||||||
}
|
}
|
||||||
|
@ -369,7 +363,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
|
|
||||||
final KeyTimerParams keyTimerParams = new KeyTimerParams(a);
|
final KeyTimerParams keyTimerParams = new KeyTimerParams(a);
|
||||||
mPointerTrackerParams = new PointerTrackerParams(a);
|
mPointerTrackerParams = new PointerTrackerParams(a);
|
||||||
mIsSpacebarTriggeringPopupByLongPress = (keyTimerParams.mLongPressSpaceKeyTimeout > 0);
|
|
||||||
|
|
||||||
final float keyHysteresisDistance = a.getDimension(
|
final float keyHysteresisDistance = a.getDimension(
|
||||||
R.styleable.LatinKeyboardView_keyHysteresisDistance, 0);
|
R.styleable.LatinKeyboardView_keyHysteresisDistance, 0);
|
||||||
|
@ -881,8 +874,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
drawSpacebar(key, canvas, paint);
|
drawSpacebar(key, canvas, paint);
|
||||||
|
|
||||||
// Whether space key needs to show the "..." popup hint for special purposes
|
// Whether space key needs to show the "..." popup hint for special purposes
|
||||||
if (mIsSpacebarTriggeringPopupByLongPress
|
if (key.isLongPressEnabled() && ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
|
||||||
&& ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
|
|
||||||
getContext(), true /* include aux subtypes */)) {
|
getContext(), true /* include aux subtypes */)) {
|
||||||
drawKeyPopupHint(key, canvas, paint, params);
|
drawKeyPopupHint(key, canvas, paint, params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue