diff options
Diffstat (limited to 'java/src')
4 files changed, 12 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 8d40e7aa5..a57b9d172 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -75,6 +75,7 @@ public class Keyboard { public static final int CODE_DELETE = -5; public static final int CODE_SETTINGS = -6; public static final int CODE_SHORTCUT = -7; + public static final int CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY = -98; // Code value representing the code is not specified. public static final int CODE_UNSPECIFIED = -99; diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 4ec16bdcf..a24195e87 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -193,9 +193,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke // Detected a double tap on shift key. If we are in the ignoring double tap // mode, it means we have already turned off caps lock in // {@link KeyboardSwitcher#onReleaseShift} . - final boolean ignoringDoubleTap = mKeyTimerHandler.isIgnoringDoubleTap(); - if (!ignoringDoubleTap) - onDoubleTapShiftKey(tracker); + onDoubleTapShiftKey(tracker, mKeyTimerHandler.isIgnoringDoubleTap()); return true; } // Otherwise these events should not be handled as double tap. @@ -346,11 +344,14 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke return onLongPress(parentKey, tracker); } - private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker) { + private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker, + final boolean ignore) { // When shift key is double tapped, the first tap is correctly processed as usual tap. And // the second tap is treated as this double tap event, so that we need not mark tracker // calling setAlreadyProcessed() nor remove the tracker from mPointerQueue. - mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, null, 0, 0); + final int primaryCode = ignore ? Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY + : Keyboard.CODE_CAPSLOCK; + mKeyboardActionListener.onCodeInput(primaryCode, null, 0, 0); } // This default implementation returns a more keys panel. diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 28d920557..c53d13e26 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1264,7 +1264,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar break; case Keyboard.CODE_CAPSLOCK: switcher.toggleCapsLock(); + //$FALL-THROUGH$ + case Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY: + // Dummy code for haptic and audio feedbacks. vibrate(); + playKeyClick(primaryCode); break; case Keyboard.CODE_SHORTCUT: mSubtypeSwitcher.switchToShortcutIME(); diff --git a/java/src/com/android/inputmethod/latin/WhitelistDictionary.java b/java/src/com/android/inputmethod/latin/WhitelistDictionary.java index 8f349ce6f..a90ef290b 100644 --- a/java/src/com/android/inputmethod/latin/WhitelistDictionary.java +++ b/java/src/com/android/inputmethod/latin/WhitelistDictionary.java @@ -22,8 +22,6 @@ import android.text.TextUtils; import android.util.Log; import android.util.Pair; -import com.android.inputmethod.keyboard.ProximityInfo; - import java.util.HashMap; import java.util.Locale; @@ -40,9 +38,7 @@ public class WhitelistDictionary extends ExpandableDictionary { super(context, Suggest.DIC_WHITELIST); final Resources res = context.getResources(); final Locale previousLocale = LocaleUtils.setSystemLocale(res, locale); - if (context != null) { - initWordlist(context.getResources().getStringArray(R.array.wordlist_whitelist)); - } + initWordlist(res.getStringArray(R.array.wordlist_whitelist)); LocaleUtils.setSystemLocale(res, previousLocale); } |