aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-07-16 10:26:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-16 10:26:10 +0000
commit1a894aeb82b635d345fbdf1e520d7c21395d7acb (patch)
treed033f5c45b71cbd7eb8f559f8f830994b4860e56 /java/src/com/android/inputmethod/latin/LatinIME.java
parent06aa3d0286173bd6ffde646e2c813fbf489943f1 (diff)
parent6455172a707a1137eb15db8073774982db9dd1fa (diff)
downloadlatinime-1a894aeb82b635d345fbdf1e520d7c21395d7acb.tar.gz
latinime-1a894aeb82b635d345fbdf1e520d7c21395d7acb.tar.xz
latinime-1a894aeb82b635d345fbdf1e520d7c21395d7acb.zip
Merge "Distinguish key press in repeat key"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8f5e57182..7890dbb3f 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2677,22 +2677,30 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
+ private void hapticAndAudioFeedback(final int code, final boolean isRepeatKey) {
+ final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
+ if (keyboardView != null && keyboardView.isInSlidingKeyInput()) {
+ // No need to feedback while sliding input.
+ return;
+ }
+ if (isRepeatKey && code == Constants.CODE_DELETE && !mConnection.canDeleteCharacters()) {
+ // No need to feedback when repeating delete key will have no effect.
+ return;
+ }
+ AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(code, keyboardView);
+ }
+
// 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) {
+ public void onPressKey(final int primaryCode, final boolean isRepeatKey,
+ 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);
- }
+ hapticAndAudioFeedback(primaryCode, isRepeatKey);
}
// Callback of the {@link KeyboardActionListener}. This is called when a key is released;
- // press matching call is {@link #onPressKey(int,boolean)} above.
+ // press matching call is {@link #onPressKey(int,boolean,boolean)} above.
@Override
public void onReleaseKey(final int primaryCode, final boolean withSliding) {
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding);