Merge "Rename ambiguous feature name and related resources"

This commit is contained in:
Tadashi G. Takaoka 2013-11-21 09:05:38 +00:00 committed by Android (Google) Code Review
commit afb95c7967
12 changed files with 83 additions and 81 deletions

View file

@ -31,7 +31,7 @@
Configuration for MainKeyboardView
-->
<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
false -->
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>

View file

@ -29,7 +29,7 @@
<!--
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
false -->
<bool name="config_show_more_keys_keyboard_at_touched_point">true</bool>

View file

@ -89,8 +89,8 @@
<attr name="touchNoiseThresholdTime" format="integer" />
<!-- Touch noise threshold distance in millimeter -->
<attr name="touchNoiseThresholdDistance" format="dimension" />
<!-- Sliding key input enable -->
<attr name="slidingKeyInputEnable" format="boolean" />
<!-- Enable key selection by dragging finger -->
<attr name="keySelectionByDraggingFinger" format="boolean" />
<attr name="slidingKeyInputPreviewColor" format="color" />
<attr name="slidingKeyInputPreviewWidth" format="dimension" />
<attr name="slidingKeyInputPreviewBodyRatio" format="integer" />

View file

@ -53,7 +53,7 @@
<integer name="config_touch_noise_threshold_time">40</integer>
<dimen name="config_touch_noise_threshold_distance">12.6dp</dimen>
<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 -->
<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.

View file

@ -67,7 +67,7 @@
<item name="keyHysteresisDistanceForSlidingModifier">@dimen/config_key_hysteresis_distance_for_sliding_modifier</item>
<item name="touchNoiseThresholdTime">@integer/config_touch_noise_threshold_time</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="slidingKeyInputPreviewBodyRatio">@integer/config_sliding_key_input_preview_body_ratio</item>
<item name="slidingKeyInputPreviewShadowRatio">@integer/config_sliding_key_input_preview_shadow_ratio</item>

View file

@ -81,7 +81,7 @@ public class KeyDetector {
return mKeyboard;
}
public boolean alwaysAllowsSlidingInput() {
public boolean alwaysAllowsKeySelectionByDraggingFinger() {
return false;
}

View file

@ -90,7 +90,7 @@ import java.util.WeakHashMap;
* @attr ref R.styleable#MainKeyboardView_keyHysteresisDistance
* @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdTime
* @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_keyRepeatInterval
* @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
@ -985,11 +985,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
tracker.onShowMoreKeysPanel(moreKeysPanel);
}
public boolean isInSlidingKeyInput() {
public boolean isInDraggingFinger() {
if (isShowingMoreKeysPanel()) {
return true;
}
return PointerTracker.isAnyInSlidingKeyInput();
return PointerTracker.isAnyInDraggingFinger();
}
@Override

View file

@ -28,7 +28,7 @@ public final class MoreKeysDetector extends KeyDetector {
}
@Override
public boolean alwaysAllowsSlidingInput() {
public boolean alwaysAllowsKeySelectionByDraggingFinger() {
return true;
}

View file

@ -134,7 +134,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
static final class PointerTrackerParams {
public final boolean mSlidingKeyInputEnabled;
public final boolean mKeySelectionByDraggingFinger;
public final int mTouchNoiseThresholdTime;
public final int mTouchNoiseThresholdDistance;
public final int mSuppressKeyPreviewAfterBatchInputDuration;
@ -145,7 +145,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
public static final PointerTrackerParams DEFAULT = new PointerTrackerParams();
private PointerTrackerParams() {
mSlidingKeyInputEnabled = false;
mKeySelectionByDraggingFinger = false;
mTouchNoiseThresholdTime = 0;
mTouchNoiseThresholdDistance = 0;
mSuppressKeyPreviewAfterBatchInputDuration = 0;
@ -155,8 +155,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
public PointerTrackerParams(final TypedArray mainKeyboardViewAttr) {
mSlidingKeyInputEnabled = mainKeyboardViewAttr.getBoolean(
R.styleable.MainKeyboardView_slidingKeyInputEnable, false);
mKeySelectionByDraggingFinger = mainKeyboardViewAttr.getBoolean(
R.styleable.MainKeyboardView_keySelectionByDraggingFinger, false);
mTouchNoiseThresholdTime = mainKeyboardViewAttr.getInt(
R.styleable.MainKeyboardView_touchNoiseThresholdTime, 0);
mTouchNoiseThresholdDistance = mainKeyboardViewAttr.getDimensionPixelSize(
@ -341,16 +341,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
private MoreKeysPanel mMoreKeysPanel;
private static final int MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT = 3;
// true if this pointer is in a sliding key input.
boolean mIsInSlidingKeyInput;
// true if this pointer is in a sliding key input from a modifier key,
// true if this pointer is in the dragging finger mode.
boolean mIsInDraggingFinger;
// 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.
boolean mIsInSlidingKeyInputFromModifier;
boolean mIsInSlidingKeyInput;
// if not a NOT_A_CODE, the key of this code is repeating
private int mCurrentRepeatingKeyCode = Constants.NOT_A_CODE;
// true if a sliding key input is allowed.
private boolean mIsAllowedSlidingKeyInput;
// true if dragging finger is allowed.
private boolean mIsAllowedDraggingFinger;
private final GestureStrokeWithPreviewPoints mGestureStrokeWithPreviewPoints;
@ -425,8 +425,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
return trackers.get(id);
}
public static boolean isAnyInSlidingKeyInput() {
return sPointerTrackerQueue.isAnyInSlidingKeyInput();
public static boolean isAnyInDraggingFinger() {
return sPointerTrackerQueue.isAnyInDraggingFinger();
}
public static void cancelAllPointerTrackers() {
@ -500,7 +500,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
return false;
}
final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier();
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onPress : %s%s%s%s", mPointerId,
KeyDetector.printableCode(key),
@ -525,7 +525,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
// primaryCode is different from {@link Key#mCode}.
private void callListenerOnCodeInput(final Key key, final int primaryCode, final int x,
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 int code = altersCode ? key.getAltCode() : primaryCode;
if (DEBUG_LISTENER) {
@ -561,7 +561,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
return;
}
final boolean ignoreModifierKey = mIsInSlidingKeyInput && key.isModifier();
final boolean ignoreModifierKey = mIsInDraggingFinger && key.isModifier();
if (DEBUG_LISTENER) {
Log.d(TAG, String.format("[%d] onRelease : %s%s%s%s", mPointerId,
Constants.printableCode(primaryCode),
@ -619,8 +619,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
@Override
public boolean isInSlidingKeyInput() {
return mIsInSlidingKeyInput;
public boolean isInDraggingFinger() {
return mIsInDraggingFinger;
}
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) {
Key key = onDownKey(x, y, eventTime);
// Sliding key is allowed when 1) enabled by configuration, 2) this pointer starts sliding
// from modifier key, or 3) this pointer's KeyDetector always allows sliding input.
mIsAllowedSlidingKeyInput = sParams.mSlidingKeyInputEnabled
// Key selection by dragging finger is allowed when 1) key selection by dragging finger is
// enabled by configuration, 2) this pointer starts dragging from modifier key, or 3) this
// pointer's KeyDetector always allows key selection by dragging finger, such as
// {@link MoreKeysKeyboard}.
mIsAllowedDraggingFinger = sParams.mKeySelectionByDraggingFinger
|| (key != null && key.isModifier())
|| mKeyDetector.alwaysAllowsSlidingInput();
|| mKeyDetector.alwaysAllowsKeySelectionByDraggingFinger();
mKeyboardLayoutHasBeenChanged = false;
mIsTrackingForActionDisabled = false;
resetSlidingKeyInput();
resetKeySelectionByDraggingFinger();
if (key != null) {
// 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
@ -982,16 +984,16 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
}
private void startSlidingKeyInput(final Key key) {
if (!mIsInSlidingKeyInput) {
mIsInSlidingKeyInputFromModifier = key.isModifier();
private void startKeySelectionByDraggingFinger(final Key key) {
if (!mIsInDraggingFinger) {
mIsInSlidingKeyInput = key.isModifier();
}
mIsInSlidingKeyInput = true;
mIsInDraggingFinger = true;
}
private void resetSlidingKeyInput() {
private void resetKeySelectionByDraggingFinger() {
mIsInDraggingFinger = false;
mIsInSlidingKeyInput = false;
mIsInSlidingKeyInputFromModifier = false;
mDrawingProxy.dismissSlidingKeyInputPreview();
}
@ -1048,7 +1050,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final int translatedY = mMoreKeysPanel.translateY(y);
mMoreKeysPanel.onMoveEvent(translatedX, translatedY, mPointerId, eventTime);
onMoveKey(x, y);
if (mIsInSlidingKeyInputFromModifier) {
if (mIsInSlidingKeyInput) {
mDrawingProxy.showSlidingKeyInputPreview(this);
}
return;
@ -1056,7 +1058,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
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) {
// This onPress call may have changed keyboard layout. Those cases are detected
// 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);
}
private void processSildeOutFromOldKey(final Key oldKey) {
private void processDraggingFingerOutFromOldKey(final Key oldKey) {
setReleasedKeyGraphics(oldKey);
callListenerOnRelease(oldKey, oldKey.getCode(), true /* withSliding */);
startSlidingKeyInput(oldKey);
startKeySelectionByDraggingFinger(oldKey);
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) {
// 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
// onPress() to notify that the new key is being pressed.
processSildeOutFromOldKey(oldKey);
processDraggingFingerOutFromOldKey(oldKey);
startRepeatKey(key);
if (mIsAllowedSlidingKeyInput) {
processSlidingKeyInput(key, x, y, eventTime);
if (mIsAllowedDraggingFinger) {
processDraggingFingerInToNewKey(key, x, y, eventTime);
}
// 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
@ -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
// notify that the previous key has been released.
processSildeOutFromOldKey(oldKey);
if (mIsAllowedSlidingKeyInput) {
processDraggingFingerOutFromOldKey(oldKey);
if (mIsAllowedDraggingFinger) {
onMoveToNewKey(null, x, y);
} else {
if (!mIsDetectingGesture) {
@ -1194,18 +1196,18 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (newKey != null) {
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) {
// 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.
processSlidingKeyInput(newKey, x, y, eventTime);
processDraggingFingerInToNewKey(newKey, x, y, eventTime);
}
} else { // newKey == null
if (oldKey != null && isMajorEnoughMoveToBeOnNewKey(x, y, eventTime, newKey)) {
slideOutFromOldKey(oldKey, x, y);
dragFingerOutFromOldKey(oldKey, x, y);
}
}
if (mIsInSlidingKeyInputFromModifier) {
if (mIsInSlidingKeyInput) {
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) {
mTimerProxy.cancelKeyTimers();
final boolean isInDraggingFinger = mIsInDraggingFinger;
final boolean isInSlidingKeyInput = mIsInSlidingKeyInput;
final boolean isInSlidingKeyInputFromModifier = mIsInSlidingKeyInputFromModifier;
resetSlidingKeyInput();
resetKeySelectionByDraggingFinger();
mIsDetectingGesture = false;
final Key currentKey = mCurrentKey;
mCurrentKey = null;
@ -1280,11 +1282,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
return;
}
if (currentKey != null && currentKey.isRepeatable()
&& (currentKey.getCode() == currentRepeatingKeyCode) && !isInSlidingKeyInput) {
&& (currentKey.getCode() == currentRepeatingKeyCode) && !isInDraggingFinger) {
return;
}
detectAndSendKey(currentKey, mKeyX, mKeyY, eventTime);
if (isInSlidingKeyInputFromModifier) {
if (isInSlidingKeyInput) {
callListenerOnFinishSlidingInput();
}
}
@ -1306,7 +1308,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
public void onLongPressed() {
resetSlidingKeyInput();
resetKeySelectionByDraggingFinger();
cancelTrackingForAction();
setReleasedKeyGraphics(mCurrentKey);
sPointerTrackerQueue.remove(this);
@ -1326,7 +1328,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
private void onCancelEventInternal() {
mTimerProxy.cancelKeyTimers();
setReleasedKeyGraphics(mCurrentKey);
resetSlidingKeyInput();
resetKeySelectionByDraggingFinger();
if (isShowingMoreKeysPanel()) {
mMoreKeysPanel.dismissMoreKeysPanel();
mMoreKeysPanel = null;
@ -1347,7 +1349,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
// Here curKey points to the different key from newKey.
final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(
mIsInSlidingKeyInputFromModifier);
mIsInSlidingKeyInput);
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
if (DEBUG_MODE) {
@ -1358,7 +1360,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
return true;
}
if (sNeedsProximateBogusDownMoveUpEventHack && !mIsAllowedSlidingKeyInput
if (sNeedsProximateBogusDownMoveUpEventHack && !mIsAllowedDraggingFinger
&& sTimeRecorder.isInFastTyping(eventTime)
&& mBogusMoveEventDetector.hasTraveledLongDistance(x, y)) {
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
// 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
// whether or not we are in the sliding input mode.
if (mIsInSlidingKeyInput && key.getMoreKeys() == null) return;
// whether or not we are in the dragging finger mode.
if (mIsInDraggingFinger && key.getMoreKeys() == null) return;
final int delay;
switch (key.getCode()) {
case Constants.CODE_SHIFT:
@ -1391,7 +1393,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
break;
default:
final int longpressTimeout = Settings.getInstance().getCurrent().mKeyLongpressTimeout;
if (mIsInSlidingKeyInputFromModifier) {
if (mIsInSlidingKeyInput) {
// We use longer timeout for sliding finger input started from the modifier key.
delay = longpressTimeout * MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
} else {
@ -1417,8 +1419,8 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if (sInGesture) return;
if (key == null) return;
if (!key.isRepeatable()) return;
// Don't start key repeat when we are in sliding input mode.
if (mIsInSlidingKeyInput) return;
// Don't start key repeat when we are in the dragging finger mode.
if (mIsInDraggingFinger) return;
final int startRepeatCount = 1;
mTimerProxy.startKeyRepeatTimer(this, startRepeatCount, sParams.mKeyRepeatStartTimeout);
}

View file

@ -28,7 +28,7 @@ public final class PointerTrackerQueue {
public interface Element {
public boolean isModifier();
public boolean isInSlidingKeyInput();
public boolean isInDraggingFinger();
public void onPhantomUpEvent(long eventTime);
public void cancelTrackingForAction();
}
@ -193,13 +193,13 @@ public final class PointerTrackerQueue {
}
}
public boolean isAnyInSlidingKeyInput() {
public boolean isAnyInDraggingFinger() {
synchronized (mExpandableArrayOfActivePointers) {
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
final int arraySize = mArraySize;
for (int index = 0; index < arraySize; index++) {
final Element element = expandableArray.get(index);
if (element.isInSlidingKeyInput()) {
if (element.isInDraggingFinger()) {
return true;
}
}

View file

@ -3081,8 +3081,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void hapticAndAudioFeedback(final int code, final int repeatCount) {
final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
if (keyboardView != null && keyboardView.isInSlidingKeyInput()) {
// No need to feedback while sliding input.
if (keyboardView != null && keyboardView.isInDraggingFinger()) {
// No need to feedback while finger is dragging.
return;
}
if (repeatCount > 0) {

View file

@ -27,7 +27,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
public final int mId;
public boolean mIsModifier;
public boolean mIsInSlidingKeyInput;
public boolean mIsInDraggingFinger;
public long mPhantomUpEventTime = NOT_HAPPENED;
public Element(int id) {
@ -40,8 +40,8 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
}
@Override
public boolean isInSlidingKeyInput() {
return mIsInSlidingKeyInput;
public boolean isInDraggingFinger() {
return mIsInDraggingFinger;
}
@Override
@ -297,19 +297,19 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
public void testIsAnyInSlidingKeyInput() {
public void testIsAnyInDraggingFinger() {
Element.sPhantomUpCount = 0;
assertFalse(mQueue.isAnyInSlidingKeyInput());
assertFalse(mQueue.isAnyInDraggingFinger());
mQueue.add(mElement1);
mQueue.add(mElement2);
mQueue.add(mElement3);
mQueue.add(mElement4);
assertFalse(mQueue.isAnyInSlidingKeyInput());
assertFalse(mQueue.isAnyInDraggingFinger());
mElement3.mIsInSlidingKeyInput = true;
assertTrue(mQueue.isAnyInSlidingKeyInput());
mElement3.mIsInDraggingFinger = true;
assertTrue(mQueue.isAnyInDraggingFinger());
assertEquals(0, Element.sPhantomUpCount);
assertEquals(4, mQueue.size());