aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-07-02 18:07:35 +0900
committerTadashi G. Takaoka <takaoka@google.com>2013-07-02 19:50:34 +0900
commitf87e8f7ec1efb93398d909c67468d716b0248fe7 (patch)
treeb39b0364c084541bf61d97d30b91a51998f47452 /java/src/com/android/inputmethod/latin/LatinIME.java
parentb6f5d3e39d1f3073c4e7d75e9d4309112879dc6e (diff)
downloadlatinime-f87e8f7ec1efb93398d909c67468d716b0248fe7.tar.gz
latinime-f87e8f7ec1efb93398d909c67468d716b0248fe7.tar.xz
latinime-f87e8f7ec1efb93398d909c67468d716b0248fe7.zip
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
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java20
1 files changed, 12 insertions, 8 deletions
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);