From f87e8f7ec1efb93398d909c67468d716b0248fe7 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 2 Jul 2013 18:07:35 +0900 Subject: Handling key repeat by emulating key press and code input This change also eliminates a reference of AudioAndHapticFeedbackManager from KeyboardSwitcher and MainKeyboard. Bug: 6522943 Change-Id: Iac42ec8ff00c66deb76a660ffc07477923a58959 --- java/src/com/android/inputmethod/latin/LatinIME.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 243928f8b..f4f9dcc50 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1360,14 +1360,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen showSubtypeSelectorAndSettings(); } - // Virtual codes representing custom requests. These are used in onCustomRequest() below. - public static final int CODE_SHOW_INPUT_METHOD_PICKER = 1; - @Override public boolean onCustomRequest(final int requestCode) { if (isShowingOptionDialog()) return false; switch (requestCode) { - case CODE_SHOW_INPUT_METHOD_PICKER: + case Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER: if (mRichImm.hasMultipleEnabledIMEsOrSubtypes(true /* include aux subtypes */)) { mRichImm.getInputMethodManager().showInputMethodPicker(); return true; @@ -2678,15 +2675,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } } - // Callback called by PointerTracker through the KeyboardActionListener. This is called when a - // key is depressed; release matching call is onReleaseKey below. + // Callback of the {@link KeyboardActionListener}. This is called when a key is depressed; + // release matching call is {@link #onReleaseKey(int,boolean)} below. @Override public void onPressKey(final int primaryCode, final boolean isSinglePointer) { mKeyboardSwitcher.onPressKey(primaryCode, isSinglePointer); + final MainKeyboardView mKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); + final boolean noFeedback = (mKeyboardView != null && mKeyboardView.isInSlidingKeyInput()) + || (primaryCode == Constants.CODE_DELETE && !mConnection.canDeleteCharacters()); + if (!noFeedback) { + AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback( + primaryCode, mKeyboardView); + } } - // Callback by PointerTracker through the KeyboardActionListener. This is called when a key - // is released; press matching call is onPressKey above. + // Callback of the {@link KeyboardActionListener}. This is called when a key is released; + // press matching call is {@link #onPressKey(int,boolean)} above. @Override public void onReleaseKey(final int primaryCode, final boolean withSliding) { mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding); -- cgit v1.2.3-83-g751a