aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java1
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java8
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
3 files changed, 16 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index a57b9d172..8d40e7aa5 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -75,7 +75,6 @@ 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 a24195e87..4b7c94d8a 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -349,9 +349,11 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
// 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.
- final int primaryCode = ignore ? Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY
- : Keyboard.CODE_CAPSLOCK;
- mKeyboardActionListener.onCodeInput(primaryCode, null, 0, 0);
+ if (ignore) {
+ mKeyboardActionListener.onCustomRequest(LatinIME.CODE_HAPTIC_AND_AUDIO_FEEDBACK);
+ } else {
+ mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, 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 94be6f0fd..b6f189b35 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1227,6 +1227,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Virtual codes representing custom requests. These are used in onCustomRequest() below.
public static final int CODE_SHOW_INPUT_METHOD_PICKER = 1;
+ public static final int CODE_HAPTIC_AND_AUDIO_FEEDBACK = 2;
@Override
public boolean onCustomRequest(int requestCode) {
@@ -1238,6 +1239,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return true;
}
return false;
+ case CODE_HAPTIC_AND_AUDIO_FEEDBACK:
+ hapticAndAudioFeedback(Keyboard.CODE_UNSPECIFIED);
+ return true;
}
return false;
}
@@ -1293,11 +1297,7 @@ 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);
+ hapticAndAudioFeedback(primaryCode);
break;
case Keyboard.CODE_SHORTCUT:
mSubtypeSwitcher.switchToShortcutIME();
@@ -2129,12 +2129,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
loadSettings();
}
+ private void hapticAndAudioFeedback(int primaryCode) {
+ vibrate();
+ playKeyClick(primaryCode);
+ }
+
@Override
public void onPress(int primaryCode, boolean withSliding) {
final KeyboardSwitcher switcher = mKeyboardSwitcher;
if (switcher.isVibrateAndSoundFeedbackRequired()) {
- vibrate();
- playKeyClick(primaryCode);
+ hapticAndAudioFeedback(primaryCode);
}
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) {