From 2b13b4f5e55b2bf5086b112f2d5d438810fdd70f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 21 Dec 2010 17:13:15 +0900 Subject: [PATCH] Suppress long press timer on hinted key while temporary upper case mode Bug: 3301932 Change-Id: I29b5e5a9aa8b44681e763a4d6485109f3f99f6fa --- java/src/com/android/inputmethod/keyboard/Key.java | 4 ++-- .../com/android/inputmethod/keyboard/PointerTracker.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 26c3f3ede..af510b8b7 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -144,7 +144,7 @@ public class Key { mEdgeFlags = row.mRowEdgeFlags; mHintIcon = null; mManualTemporaryUpperCaseHintIcon = null; - mManualTemporaryUpperCaseCode = 0; + mManualTemporaryUpperCaseCode = Keyboard.CODE_DUMMY; mLabelOption = 0; mModifier = false; mSticky = false; @@ -233,7 +233,7 @@ public class Key { mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel); mLabelOption = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption, 0); mManualTemporaryUpperCaseCode = style.getInt(keyAttr, - R.styleable.Keyboard_Key_manualTemporaryUpperCaseCode, 0); + R.styleable.Keyboard_Key_manualTemporaryUpperCaseCode, Keyboard.CODE_DUMMY); mOutputText = style.getText(keyAttr, R.styleable.Keyboard_Key_keyOutputText); // Choose the first letter of the label as primary code if not // specified. diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 7928c4f8e..9bfe9113d 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -414,6 +414,11 @@ public class PointerTracker { Key key = getKey(keyIndex); if (key.mCode == Keyboard.CODE_SHIFT) { mHandler.startLongPressShiftTimer(mLongPressShiftKeyTimeout, keyIndex, this); + } else if (key.mManualTemporaryUpperCaseCode != Keyboard.CODE_DUMMY + && mKeyboard.isManualTemporaryUpperCase()) { + // We need not start long press timer on the key which has manual temporary upper case + // code defined and the keyboard is in manual temporary upper case mode. + return; } else if (mKeyboardSwitcher.isInMomentaryAutoModeSwitchState()) { // We use longer timeout for sliding finger input started from the symbols mode key. mHandler.startLongPressTimer(mLongPressKeyTimeout * 2, keyIndex, this); @@ -438,7 +443,8 @@ public class PointerTracker { // If keyboard is in manual temporary upper case state and key has manual temporary // shift code, alternate character code should be sent. - if (mKeyboard.isManualTemporaryUpperCase() && key.mManualTemporaryUpperCaseCode != 0) { + if (mKeyboard.isManualTemporaryUpperCase() + && key.mManualTemporaryUpperCaseCode != Keyboard.CODE_DUMMY) { code = key.mManualTemporaryUpperCaseCode; codes[0] = code; }