Rename ambiguous feature name and related resources
Bug: 11737015 Change-Id: I39f7ca13b99f019a2edb5aa690e3142ceba4e837
This commit is contained in:
parent
9bb61243a0
commit
42d9980a84
12 changed files with 82 additions and 80 deletions
|
@ -31,7 +31,7 @@
|
||||||
Configuration for MainKeyboardView
|
Configuration for MainKeyboardView
|
||||||
-->
|
-->
|
||||||
<dimen name="config_key_hysteresis_distance">40.0dp</dimen>
|
<dimen name="config_key_hysteresis_distance">40.0dp</dimen>
|
||||||
<bool name="config_sliding_key_input_enabled">false</bool>
|
<bool name="config_key_selection_by_dragging_finger">false</bool>
|
||||||
<!-- 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 -->
|
||||||
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>
|
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<!--
|
<!--
|
||||||
Configuration for MainKeyboardView
|
Configuration for MainKeyboardView
|
||||||
-->
|
-->
|
||||||
<bool name="config_sliding_key_input_enabled">false</bool>
|
<bool name="config_key_selection_by_dragging_finger">false</bool>
|
||||||
<!-- 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 -->
|
||||||
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>
|
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
<attr name="touchNoiseThresholdTime" format="integer" />
|
<attr name="touchNoiseThresholdTime" format="integer" />
|
||||||
<!-- Touch noise threshold distance in millimeter -->
|
<!-- Touch noise threshold distance in millimeter -->
|
||||||
<attr name="touchNoiseThresholdDistance" format="dimension" />
|
<attr name="touchNoiseThresholdDistance" format="dimension" />
|
||||||
<!-- Sliding key input enable -->
|
<!-- Enable key selection by dragging finger -->
|
||||||
<attr name="slidingKeyInputEnable" format="boolean" />
|
<attr name="keySelectionByDraggingFinger" format="boolean" />
|
||||||
<attr name="slidingKeyInputPreviewColor" format="color" />
|
<attr name="slidingKeyInputPreviewColor" format="color" />
|
||||||
<attr name="slidingKeyInputPreviewWidth" format="dimension" />
|
<attr name="slidingKeyInputPreviewWidth" format="dimension" />
|
||||||
<attr name="slidingKeyInputPreviewBodyRatio" format="integer" />
|
<attr name="slidingKeyInputPreviewBodyRatio" format="integer" />
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<integer name="config_touch_noise_threshold_time">40</integer>
|
<integer name="config_touch_noise_threshold_time">40</integer>
|
||||||
<dimen name="config_touch_noise_threshold_distance">12.6dp</dimen>
|
<dimen name="config_touch_noise_threshold_distance">12.6dp</dimen>
|
||||||
<integer name="config_key_preview_linger_timeout">70</integer>
|
<integer name="config_key_preview_linger_timeout">70</integer>
|
||||||
<bool name="config_sliding_key_input_enabled">true</bool>
|
<bool name="config_key_selection_by_dragging_finger">true</bool>
|
||||||
<!-- Sliding key input preview parameters -->
|
<!-- Sliding key input preview parameters -->
|
||||||
<dimen name="config_sliding_key_input_preview_width">8.0dp</dimen>
|
<dimen name="config_sliding_key_input_preview_width">8.0dp</dimen>
|
||||||
<!-- Percentages of sliding key input preview body and shadow, in proportion to the width.
|
<!-- Percentages of sliding key input preview body and shadow, in proportion to the width.
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<item name="keyHysteresisDistanceForSlidingModifier">@dimen/config_key_hysteresis_distance_for_sliding_modifier</item>
|
<item name="keyHysteresisDistanceForSlidingModifier">@dimen/config_key_hysteresis_distance_for_sliding_modifier</item>
|
||||||
<item name="touchNoiseThresholdTime">@integer/config_touch_noise_threshold_time</item>
|
<item name="touchNoiseThresholdTime">@integer/config_touch_noise_threshold_time</item>
|
||||||
<item name="touchNoiseThresholdDistance">@dimen/config_touch_noise_threshold_distance</item>
|
<item name="touchNoiseThresholdDistance">@dimen/config_touch_noise_threshold_distance</item>
|
||||||
<item name="slidingKeyInputEnable">@bool/config_sliding_key_input_enabled</item>
|
<item name="keySelectionByDraggingFinger">@bool/config_key_selection_by_dragging_finger</item>
|
||||||
<item name="slidingKeyInputPreviewWidth">@dimen/config_sliding_key_input_preview_width</item>
|
<item name="slidingKeyInputPreviewWidth">@dimen/config_sliding_key_input_preview_width</item>
|
||||||
<item name="slidingKeyInputPreviewBodyRatio">@integer/config_sliding_key_input_preview_body_ratio</item>
|
<item name="slidingKeyInputPreviewBodyRatio">@integer/config_sliding_key_input_preview_body_ratio</item>
|
||||||
<item name="slidingKeyInputPreviewShadowRatio">@integer/config_sliding_key_input_preview_shadow_ratio</item>
|
<item name="slidingKeyInputPreviewShadowRatio">@integer/config_sliding_key_input_preview_shadow_ratio</item>
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class KeyDetector {
|
||||||
return mKeyboard;
|
return mKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean alwaysAllowsSlidingInput() {
|
public boolean alwaysAllowsKeySelectionByDraggingFinger() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ import java.util.WeakHashMap;
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyHysteresisDistance
|
* @attr ref R.styleable#MainKeyboardView_keyHysteresisDistance
|
||||||
* @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdTime
|
* @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdTime
|
||||||
* @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdDistance
|
* @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdDistance
|
||||||
* @attr ref R.styleable#MainKeyboardView_slidingKeyInputEnable
|
* @attr ref R.styleable#MainKeyboardView_keySelectionByDraggingFinger
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyRepeatStartTimeout
|
* @attr ref R.styleable#MainKeyboardView_keyRepeatStartTimeout
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyRepeatInterval
|
* @attr ref R.styleable#MainKeyboardView_keyRepeatInterval
|
||||||
* @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
|
* @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
|
||||||
|
@ -985,11 +985,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
tracker.onShowMoreKeysPanel(moreKeysPanel);
|
tracker.onShowMoreKeysPanel(moreKeysPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isInDraggingFinger() {
|
||||||
if (isShowingMoreKeysPanel()) {
|
if (isShowingMoreKeysPanel()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return PointerTracker.isAnyInSlidingKeyInput();
|
return PointerTracker.isAnyInDraggingFinger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,7 +28,7 @@ public final class MoreKeysDetector extends KeyDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean alwaysAllowsSlidingInput() {
|
public boolean alwaysAllowsKeySelectionByDraggingFinger() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class PointerTrackerParams {
|
static final class PointerTrackerParams {
|
||||||
public final boolean mSlidingKeyInputEnabled;
|
public final boolean mKeySelectionByDraggingFinger;
|
||||||
public final int mTouchNoiseThresholdTime;
|
public final int mTouchNoiseThresholdTime;
|
||||||
public final int mTouchNoiseThresholdDistance;
|
public final int mTouchNoiseThresholdDistance;
|
||||||
public final int mSuppressKeyPreviewAfterBatchInputDuration;
|
public final int mSuppressKeyPreviewAfterBatchInputDuration;
|
||||||
|
@ -145,7 +145,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
public static final PointerTrackerParams DEFAULT = new PointerTrackerParams();
|
public static final PointerTrackerParams DEFAULT = new PointerTrackerParams();
|
||||||
|
|
||||||
private PointerTrackerParams() {
|
private PointerTrackerParams() {
|
||||||
mSlidingKeyInputEnabled = false;
|
mKeySelectionByDraggingFinger = false;
|
||||||
mTouchNoiseThresholdTime = 0;
|
mTouchNoiseThresholdTime = 0;
|
||||||
mTouchNoiseThresholdDistance = 0;
|
mTouchNoiseThresholdDistance = 0;
|
||||||
mSuppressKeyPreviewAfterBatchInputDuration = 0;
|
mSuppressKeyPreviewAfterBatchInputDuration = 0;
|
||||||
|
@ -155,8 +155,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointerTrackerParams(final TypedArray mainKeyboardViewAttr) {
|
public PointerTrackerParams(final TypedArray mainKeyboardViewAttr) {
|
||||||
mSlidingKeyInputEnabled = mainKeyboardViewAttr.getBoolean(
|
mKeySelectionByDraggingFinger = mainKeyboardViewAttr.getBoolean(
|
||||||
R.styleable.MainKeyboardView_slidingKeyInputEnable, false);
|
R.styleable.MainKeyboardView_keySelectionByDraggingFinger, false);
|
||||||
mTouchNoiseThresholdTime = mainKeyboardViewAttr.getInt(
|
mTouchNoiseThresholdTime = mainKeyboardViewAttr.getInt(
|
||||||
R.styleable.MainKeyboardView_touchNoiseThresholdTime, 0);
|
R.styleable.MainKeyboardView_touchNoiseThresholdTime, 0);
|
||||||
mTouchNoiseThresholdDistance = mainKeyboardViewAttr.getDimensionPixelSize(
|
mTouchNoiseThresholdDistance = mainKeyboardViewAttr.getDimensionPixelSize(
|
||||||
|
@ -341,16 +341,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
private MoreKeysPanel mMoreKeysPanel;
|
private MoreKeysPanel mMoreKeysPanel;
|
||||||
|
|
||||||
private static final int MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT = 3;
|
private static final int MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT = 3;
|
||||||
// true if this pointer is in a sliding key input.
|
// true if this pointer is in the dragging finger mode.
|
||||||
boolean mIsInSlidingKeyInput;
|
boolean mIsInDraggingFinger;
|
||||||
// true if this pointer is in a sliding key input from a modifier key,
|
// true if this pointer is sliding from a modifier key and in the sliding key input mode,
|
||||||
// so that further modifier keys should be ignored.
|
// so that further modifier keys should be ignored.
|
||||||
boolean mIsInSlidingKeyInputFromModifier;
|
boolean mIsInSlidingKeyInput;
|
||||||
// if not a NOT_A_CODE, the key of this code is repeating
|
// if not a NOT_A_CODE, the key of this code is repeating
|
||||||
private int mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
|
private int mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
|
||||||
|
|
||||||
// true if a sliding key input is allowed.
|
// true if dragging finger is allowed.
|
||||||
private boolean mIsAllowedSlidingKeyInput;
|
private boolean mIsAllowedDraggingFinger;
|
||||||
|
|
||||||
private final GestureStrokeWithPreviewPoints mGestureStrokeWithPreviewPoints;
|
private final GestureStrokeWithPreviewPoints mGestureStrokeWithPreviewPoints;
|
||||||
|
|
||||||
|
@ -425,8 +425,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
return trackers.get(id);
|
return trackers.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnyInSlidingKeyInput() {
|
public static boolean isAnyInDraggingFinger() {
|
||||||
return sPointerTrackerQueue.isAnyInSlidingKeyInput();
|
return sPointerTrackerQueue.isAnyInDraggingFinger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cancelAllPointerTrackers() {
|
public static void cancelAllPointerTrackers() {
|
||||||
|
@ -500,7 +500,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
|
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier();
|
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
|
||||||
if (DEBUG_LISTENER) {
|
if (DEBUG_LISTENER) {
|
||||||
Log.d(TAG, String.format("[%d] onPress : %s%s%s%s", mPointerId,
|
Log.d(TAG, String.format("[%d] onPress : %s%s%s%s", mPointerId,
|
||||||
KeyDetector.printableCode(key),
|
KeyDetector.printableCode(key),
|
||||||
|
@ -525,7 +525,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
// primaryCode is different from {@link Key#mCode}.
|
// primaryCode is different from {@link Key#mCode}.
|
||||||
private void callListenerOnCodeInput(final Key key, final int primaryCode, final int x,
|
private void callListenerOnCodeInput(final Key key, final int primaryCode, final int x,
|
||||||
final int y, final long eventTime) {
|
final int y, final long eventTime) {
|
||||||
final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier();
|
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
|
||||||
final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
|
final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
|
||||||
final int code = altersCode ? key.getAltCode() : primaryCode;
|
final int code = altersCode ? key.getAltCode() : primaryCode;
|
||||||
if (DEBUG_LISTENER) {
|
if (DEBUG_LISTENER) {
|
||||||
|
@ -561,7 +561,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
|
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier();
|
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
|
||||||
if (DEBUG_LISTENER) {
|
if (DEBUG_LISTENER) {
|
||||||
Log.d(TAG, String.format("[%d] onRelease : %s%s%s%s", mPointerId,
|
Log.d(TAG, String.format("[%d] onRelease : %s%s%s%s", mPointerId,
|
||||||
Constants.printableCode(primaryCode),
|
Constants.printableCode(primaryCode),
|
||||||
|
@ -619,8 +619,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isInDraggingFinger() {
|
||||||
return mIsInSlidingKeyInput;
|
return mIsInDraggingFinger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key getKey() {
|
public Key getKey() {
|
||||||
|
@ -960,14 +960,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
|
|
||||||
private void onDownEventInternal(final int x, final int y, final long eventTime) {
|
private void onDownEventInternal(final int x, final int y, final long eventTime) {
|
||||||
Key key = onDownKey(x, y, eventTime);
|
Key key = onDownKey(x, y, eventTime);
|
||||||
// Sliding key is allowed when 1) enabled by configuration, 2) this pointer starts sliding
|
// Key selection by dragging finger is allowed when 1) key selection by dragging finger is
|
||||||
// from modifier key, or 3) this pointer's KeyDetector always allows sliding input.
|
// enabled by configuration, 2) this pointer starts dragging from modifier key, or 3) this
|
||||||
mIsAllowedSlidingKeyInput = sParams.mSlidingKeyInputEnabled
|
// pointer's KeyDetector always allows key selection by dragging finger, such as
|
||||||
|
// {@link MoreKeysKeyboard}.
|
||||||
|
mIsAllowedDraggingFinger = sParams.mKeySelectionByDraggingFinger
|
||||||
|| (key != null && key.isModifier())
|
|| (key != null && key.isModifier())
|
||||||
|| mKeyDetector.alwaysAllowsSlidingInput();
|
|| mKeyDetector.alwaysAllowsKeySelectionByDraggingFinger();
|
||||||
mKeyboardLayoutHasBeenChanged = false;
|
mKeyboardLayoutHasBeenChanged = false;
|
||||||
mIsTrackingForActionDisabled = false;
|
mIsTrackingForActionDisabled = false;
|
||||||
resetSlidingKeyInput();
|
resetKeySelectionByDraggingFinger();
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
// This onPress call may have changed keyboard layout. Those cases are detected at
|
// This onPress call may have changed keyboard layout. Those cases are detected at
|
||||||
// {@link #setKeyboard}. In those cases, we should update key according to the new
|
// {@link #setKeyboard}. In those cases, we should update key according to the new
|
||||||
|
@ -982,16 +984,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startSlidingKeyInput(final Key key) {
|
private void startKeySelectionByDraggingFinger(final Key key) {
|
||||||
if (!mIsInSlidingKeyInput) {
|
if (!mIsInDraggingFinger) {
|
||||||
mIsInSlidingKeyInputFromModifier = key.isModifier();
|
mIsInSlidingKeyInput = key.isModifier();
|
||||||
}
|
}
|
||||||
mIsInSlidingKeyInput = true;
|
mIsInDraggingFinger = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetSlidingKeyInput() {
|
private void resetKeySelectionByDraggingFinger() {
|
||||||
|
mIsInDraggingFinger = false;
|
||||||
mIsInSlidingKeyInput = false;
|
mIsInSlidingKeyInput = false;
|
||||||
mIsInSlidingKeyInputFromModifier = false;
|
|
||||||
mDrawingProxy.dismissSlidingKeyInputPreview();
|
mDrawingProxy.dismissSlidingKeyInputPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1050,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
final int translatedY = mMoreKeysPanel.translateY(y);
|
final int translatedY = mMoreKeysPanel.translateY(y);
|
||||||
mMoreKeysPanel.onMoveEvent(translatedX, translatedY, mPointerId, eventTime);
|
mMoreKeysPanel.onMoveEvent(translatedX, translatedY, mPointerId, eventTime);
|
||||||
onMoveKey(x, y);
|
onMoveKey(x, y);
|
||||||
if (mIsInSlidingKeyInputFromModifier) {
|
if (mIsInSlidingKeyInput) {
|
||||||
mDrawingProxy.showSlidingKeyInputPreview(this);
|
mDrawingProxy.showSlidingKeyInputPreview(this);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1056,7 +1058,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
onMoveEventInternal(x, y, eventTime);
|
onMoveEventInternal(x, y, eventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSlidingKeyInput(final Key newKey, final int x, final int y,
|
private void processDraggingFingerInToNewKey(final Key newKey, final int x, final int y,
|
||||||
final long eventTime) {
|
final long eventTime) {
|
||||||
// This onPress call may have changed keyboard layout. Those cases are detected
|
// This onPress call may have changed keyboard layout. Those cases are detected
|
||||||
// at {@link #setKeyboard}. In those cases, we should update key according
|
// at {@link #setKeyboard}. In those cases, we should update key according
|
||||||
|
@ -1110,22 +1112,22 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
onDownEventInternal(x, y, eventTime);
|
onDownEventInternal(x, y, eventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSildeOutFromOldKey(final Key oldKey) {
|
private void processDraggingFingerOutFromOldKey(final Key oldKey) {
|
||||||
setReleasedKeyGraphics(oldKey);
|
setReleasedKeyGraphics(oldKey);
|
||||||
callListenerOnRelease(oldKey, oldKey.getCode(), true /* withSliding */);
|
callListenerOnRelease(oldKey, oldKey.getCode(), true /* withSliding */);
|
||||||
startSlidingKeyInput(oldKey);
|
startKeySelectionByDraggingFinger(oldKey);
|
||||||
mTimerProxy.cancelKeyTimers();
|
mTimerProxy.cancelKeyTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void slideFromOldKeyToNewKey(final Key key, final int x, final int y,
|
private void dragFingerFromOldKeyToNewKey(final Key key, final int x, final int y,
|
||||||
final long eventTime, final Key oldKey, final int lastX, final int lastY) {
|
final long eventTime, final Key oldKey, final int lastX, final int lastY) {
|
||||||
// The pointer has been slid in to the new key from the previous key, we must call
|
// The pointer has been slid in to the new key from the previous key, we must call
|
||||||
// onRelease() first to notify that the previous key has been released, then call
|
// onRelease() first to notify that the previous key has been released, then call
|
||||||
// onPress() to notify that the new key is being pressed.
|
// onPress() to notify that the new key is being pressed.
|
||||||
processSildeOutFromOldKey(oldKey);
|
processDraggingFingerOutFromOldKey(oldKey);
|
||||||
startRepeatKey(key);
|
startRepeatKey(key);
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedDraggingFinger) {
|
||||||
processSlidingKeyInput(key, x, y, eventTime);
|
processDraggingFingerInToNewKey(key, x, y, eventTime);
|
||||||
}
|
}
|
||||||
// HACK: On some devices, quick successive touches may be reported as a sudden move by
|
// HACK: On some devices, quick successive touches may be reported as a sudden move by
|
||||||
// touch panel firmware. This hack detects such cases and translates the move event to
|
// touch panel firmware. This hack detects such cases and translates the move event to
|
||||||
|
@ -1163,11 +1165,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void slideOutFromOldKey(final Key oldKey, final int x, final int y) {
|
private void dragFingerOutFromOldKey(final Key oldKey, final int x, final int y) {
|
||||||
// The pointer has been slid out from the previous key, we must call onRelease() to
|
// The pointer has been slid out from the previous key, we must call onRelease() to
|
||||||
// notify that the previous key has been released.
|
// notify that the previous key has been released.
|
||||||
processSildeOutFromOldKey(oldKey);
|
processDraggingFingerOutFromOldKey(oldKey);
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedDraggingFinger) {
|
||||||
onMoveToNewKey(null, x, y);
|
onMoveToNewKey(null, x, y);
|
||||||
} else {
|
} else {
|
||||||
if (!mIsDetectingGesture) {
|
if (!mIsDetectingGesture) {
|
||||||
|
@ -1194,18 +1196,18 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
|
|
||||||
if (newKey != null) {
|
if (newKey != null) {
|
||||||
if (oldKey != null && isMajorEnoughMoveToBeOnNewKey(x, y, eventTime, newKey)) {
|
if (oldKey != null && isMajorEnoughMoveToBeOnNewKey(x, y, eventTime, newKey)) {
|
||||||
slideFromOldKeyToNewKey(newKey, x, y, eventTime, oldKey, lastX, lastY);
|
dragFingerFromOldKeyToNewKey(newKey, x, y, eventTime, oldKey, lastX, lastY);
|
||||||
} else if (oldKey == null) {
|
} else if (oldKey == null) {
|
||||||
// The pointer has been slid in to the new key, but the finger was not on any keys.
|
// The pointer has been slid in to the new key, but the finger was not on any keys.
|
||||||
// In this case, we must call onPress() to notify that the new key is being pressed.
|
// In this case, we must call onPress() to notify that the new key is being pressed.
|
||||||
processSlidingKeyInput(newKey, x, y, eventTime);
|
processDraggingFingerInToNewKey(newKey, x, y, eventTime);
|
||||||
}
|
}
|
||||||
} else { // newKey == null
|
} else { // newKey == null
|
||||||
if (oldKey != null && isMajorEnoughMoveToBeOnNewKey(x, y, eventTime, newKey)) {
|
if (oldKey != null && isMajorEnoughMoveToBeOnNewKey(x, y, eventTime, newKey)) {
|
||||||
slideOutFromOldKey(oldKey, x, y);
|
dragFingerOutFromOldKey(oldKey, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mIsInSlidingKeyInputFromModifier) {
|
if (mIsInSlidingKeyInput) {
|
||||||
mDrawingProxy.showSlidingKeyInputPreview(this);
|
mDrawingProxy.showSlidingKeyInputPreview(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1246,9 +1248,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
|
|
||||||
private void onUpEventInternal(final int x, final int y, final long eventTime) {
|
private void onUpEventInternal(final int x, final int y, final long eventTime) {
|
||||||
mTimerProxy.cancelKeyTimers();
|
mTimerProxy.cancelKeyTimers();
|
||||||
|
final boolean isInDraggingFinger = mIsInDraggingFinger;
|
||||||
final boolean isInSlidingKeyInput = mIsInSlidingKeyInput;
|
final boolean isInSlidingKeyInput = mIsInSlidingKeyInput;
|
||||||
final boolean isInSlidingKeyInputFromModifier = mIsInSlidingKeyInputFromModifier;
|
resetKeySelectionByDraggingFinger();
|
||||||
resetSlidingKeyInput();
|
|
||||||
mIsDetectingGesture = false;
|
mIsDetectingGesture = false;
|
||||||
final Key currentKey = mCurrentKey;
|
final Key currentKey = mCurrentKey;
|
||||||
mCurrentKey = null;
|
mCurrentKey = null;
|
||||||
|
@ -1280,11 +1282,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentKey != null && currentKey.isRepeatable()
|
if (currentKey != null && currentKey.isRepeatable()
|
||||||
&& (currentKey.getCode() == currentRepeatingKeyCode) && !isInSlidingKeyInput) {
|
&& (currentKey.getCode() == currentRepeatingKeyCode) && !isInDraggingFinger) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
detectAndSendKey(currentKey, mKeyX, mKeyY, eventTime);
|
detectAndSendKey(currentKey, mKeyX, mKeyY, eventTime);
|
||||||
if (isInSlidingKeyInputFromModifier) {
|
if (isInSlidingKeyInput) {
|
||||||
callListenerOnFinishSlidingInput();
|
callListenerOnFinishSlidingInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1306,7 +1308,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLongPressed() {
|
public void onLongPressed() {
|
||||||
resetSlidingKeyInput();
|
resetKeySelectionByDraggingFinger();
|
||||||
cancelTrackingForAction();
|
cancelTrackingForAction();
|
||||||
setReleasedKeyGraphics(mCurrentKey);
|
setReleasedKeyGraphics(mCurrentKey);
|
||||||
sPointerTrackerQueue.remove(this);
|
sPointerTrackerQueue.remove(this);
|
||||||
|
@ -1326,7 +1328,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
private void onCancelEventInternal() {
|
private void onCancelEventInternal() {
|
||||||
mTimerProxy.cancelKeyTimers();
|
mTimerProxy.cancelKeyTimers();
|
||||||
setReleasedKeyGraphics(mCurrentKey);
|
setReleasedKeyGraphics(mCurrentKey);
|
||||||
resetSlidingKeyInput();
|
resetKeySelectionByDraggingFinger();
|
||||||
if (isShowingMoreKeysPanel()) {
|
if (isShowingMoreKeysPanel()) {
|
||||||
mMoreKeysPanel.dismissMoreKeysPanel();
|
mMoreKeysPanel.dismissMoreKeysPanel();
|
||||||
mMoreKeysPanel = null;
|
mMoreKeysPanel = null;
|
||||||
|
@ -1347,7 +1349,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
// Here curKey points to the different key from newKey.
|
// Here curKey points to the different key from newKey.
|
||||||
final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(
|
final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(
|
||||||
mIsInSlidingKeyInputFromModifier);
|
mIsInSlidingKeyInput);
|
||||||
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
|
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
|
||||||
if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
|
if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
|
@ -1358,7 +1360,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sNeedsProximateBogusDownMoveUpEventHack && !mIsAllowedSlidingKeyInput
|
if (sNeedsProximateBogusDownMoveUpEventHack && !mIsAllowedDraggingFinger
|
||||||
&& sTimeRecorder.isInFastTyping(eventTime)
|
&& sTimeRecorder.isInFastTyping(eventTime)
|
||||||
&& mBogusMoveEventDetector.hasTraveledLongDistance(x, y)) {
|
&& mBogusMoveEventDetector.hasTraveledLongDistance(x, y)) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
|
@ -1382,8 +1384,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
// Caveat: Please note that isLongPressEnabled() can be true even if the current key
|
// Caveat: Please note that isLongPressEnabled() can be true even if the current key
|
||||||
// doesn't have its more keys. (e.g. spacebar, globe key)
|
// doesn't have its more keys. (e.g. spacebar, globe key)
|
||||||
// We always need to start the long press timer if the key has its more keys regardless of
|
// We always need to start the long press timer if the key has its more keys regardless of
|
||||||
// whether or not we are in the sliding input mode.
|
// whether or not we are in the dragging finger mode.
|
||||||
if (mIsInSlidingKeyInput && key.getMoreKeys() == null) return;
|
if (mIsInDraggingFinger && key.getMoreKeys() == null) return;
|
||||||
final int delay;
|
final int delay;
|
||||||
switch (key.getCode()) {
|
switch (key.getCode()) {
|
||||||
case Constants.CODE_SHIFT:
|
case Constants.CODE_SHIFT:
|
||||||
|
@ -1391,7 +1393,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
final int longpressTimeout = Settings.getInstance().getCurrent().mKeyLongpressTimeout;
|
final int longpressTimeout = Settings.getInstance().getCurrent().mKeyLongpressTimeout;
|
||||||
if (mIsInSlidingKeyInputFromModifier) {
|
if (mIsInSlidingKeyInput) {
|
||||||
// We use longer timeout for sliding finger input started from the modifier key.
|
// We use longer timeout for sliding finger input started from the modifier key.
|
||||||
delay = longpressTimeout * MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
|
delay = longpressTimeout * MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1417,8 +1419,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
||||||
if (sInGesture) return;
|
if (sInGesture) return;
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
if (!key.isRepeatable()) return;
|
if (!key.isRepeatable()) return;
|
||||||
// Don't start key repeat when we are in sliding input mode.
|
// Don't start key repeat when we are in the dragging finger mode.
|
||||||
if (mIsInSlidingKeyInput) return;
|
if (mIsInDraggingFinger) return;
|
||||||
final int startRepeatCount = 1;
|
final int startRepeatCount = 1;
|
||||||
mTimerProxy.startKeyRepeatTimer(this, startRepeatCount, sParams.mKeyRepeatStartTimeout);
|
mTimerProxy.startKeyRepeatTimer(this, startRepeatCount, sParams.mKeyRepeatStartTimeout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public final class PointerTrackerQueue {
|
||||||
|
|
||||||
public interface Element {
|
public interface Element {
|
||||||
public boolean isModifier();
|
public boolean isModifier();
|
||||||
public boolean isInSlidingKeyInput();
|
public boolean isInDraggingFinger();
|
||||||
public void onPhantomUpEvent(long eventTime);
|
public void onPhantomUpEvent(long eventTime);
|
||||||
public void cancelTrackingForAction();
|
public void cancelTrackingForAction();
|
||||||
}
|
}
|
||||||
|
@ -193,13 +193,13 @@ public final class PointerTrackerQueue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAnyInSlidingKeyInput() {
|
public boolean isAnyInDraggingFinger() {
|
||||||
synchronized (mExpandableArrayOfActivePointers) {
|
synchronized (mExpandableArrayOfActivePointers) {
|
||||||
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
||||||
final int arraySize = mArraySize;
|
final int arraySize = mArraySize;
|
||||||
for (int index = 0; index < arraySize; index++) {
|
for (int index = 0; index < arraySize; index++) {
|
||||||
final Element element = expandableArray.get(index);
|
final Element element = expandableArray.get(index);
|
||||||
if (element.isInSlidingKeyInput()) {
|
if (element.isInDraggingFinger()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3081,8 +3081,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
private void hapticAndAudioFeedback(final int code, final int repeatCount) {
|
private void hapticAndAudioFeedback(final int code, final int repeatCount) {
|
||||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (keyboardView != null && keyboardView.isInSlidingKeyInput()) {
|
if (keyboardView != null && keyboardView.isInDraggingFinger()) {
|
||||||
// No need to feedback while sliding input.
|
// No need to feedback while finger is dragging.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (repeatCount > 0) {
|
if (repeatCount > 0) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
|
||||||
|
|
||||||
public final int mId;
|
public final int mId;
|
||||||
public boolean mIsModifier;
|
public boolean mIsModifier;
|
||||||
public boolean mIsInSlidingKeyInput;
|
public boolean mIsInDraggingFinger;
|
||||||
public long mPhantomUpEventTime = NOT_HAPPENED;
|
public long mPhantomUpEventTime = NOT_HAPPENED;
|
||||||
|
|
||||||
public Element(int id) {
|
public Element(int id) {
|
||||||
|
@ -40,8 +40,8 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isInDraggingFinger() {
|
||||||
return mIsInSlidingKeyInput;
|
return mIsInDraggingFinger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,19 +297,19 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
|
||||||
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
|
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsAnyInSlidingKeyInput() {
|
public void testIsAnyInDraggingFinger() {
|
||||||
Element.sPhantomUpCount = 0;
|
Element.sPhantomUpCount = 0;
|
||||||
assertFalse(mQueue.isAnyInSlidingKeyInput());
|
assertFalse(mQueue.isAnyInDraggingFinger());
|
||||||
|
|
||||||
mQueue.add(mElement1);
|
mQueue.add(mElement1);
|
||||||
mQueue.add(mElement2);
|
mQueue.add(mElement2);
|
||||||
mQueue.add(mElement3);
|
mQueue.add(mElement3);
|
||||||
mQueue.add(mElement4);
|
mQueue.add(mElement4);
|
||||||
|
|
||||||
assertFalse(mQueue.isAnyInSlidingKeyInput());
|
assertFalse(mQueue.isAnyInDraggingFinger());
|
||||||
|
|
||||||
mElement3.mIsInSlidingKeyInput = true;
|
mElement3.mIsInDraggingFinger = true;
|
||||||
assertTrue(mQueue.isAnyInSlidingKeyInput());
|
assertTrue(mQueue.isAnyInDraggingFinger());
|
||||||
|
|
||||||
assertEquals(0, Element.sPhantomUpCount);
|
assertEquals(0, Element.sPhantomUpCount);
|
||||||
assertEquals(4, mQueue.size());
|
assertEquals(4, mQueue.size());
|
||||||
|
|
Loading…
Reference in a new issue