Enable long-press spacebar on 7 inch tablet

This change also eliminate useless attribute longPressSpaceKeyTimeout
of LatinKeyboardView.

Bug: 6449356
Change-Id: Ib4dace4b9510c0eb96bdddacf8e0dbaa14fcfbbf
main
Tadashi G. Takaoka 2012-05-08 12:39:54 +09:00
parent 22d196cb17
commit 7b6afb1287
7 changed files with 23 additions and 41 deletions

View File

@ -28,8 +28,6 @@
<bool name="config_auto_correction_spacebar_led_enabled">false</bool>
<!-- The language is never displayed if == 0, always displayed if < 0 -->
<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}. -->
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
<integer name="config_max_more_keys_column">5</integer>

View File

@ -26,8 +26,6 @@
<bool name="config_default_popup_preview">false</bool>
<bool name="config_default_sound_enabled">true</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}. -->
<string name="config_default_keyboard_theme_index" translatable="false">5</string>
<integer name="config_max_more_keys_column">5</integer>

View File

@ -154,8 +154,6 @@
<attr name="longPressKeyTimeout" format="integer" />
<!-- Long press timeout of shift key in millisecond. -->
<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. -->
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
<!-- More keys keyboard will shown at touched point. -->

View File

@ -63,9 +63,6 @@
<integer name="config_long_press_key_timeout">400</integer>
<!-- 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>
<!-- 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>
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
false -->

View File

@ -75,7 +75,6 @@
<item name="keyRepeatInterval">@integer/config_key_repeat_interval</item>
<item name="longPressKeyTimeout">@integer/config_long_press_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="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
<item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>

View File

@ -77,7 +77,7 @@
<key-style
latin:styleName="spaceKeyStyle"
latin:code="!code/key_space"
latin:keyActionFlags="noKeyPreview" />
latin:keyActionFlags="noKeyPreview|enableLongPress" />
<!-- U+200C: ZERO WIDTH NON-JOINER
U+200D: ZERO WIDTH JOINER -->
<key-style

View File

@ -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) {