aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-01-25 07:28:31 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-25 07:28:31 -0800
commit8e13c338afce490197d799fd86bc7bef3057b79b (patch)
tree97893489682b8de2f2032db83b649367d1d99a7b /java/src
parentf73d2386dc63664a42fe90fe86c12742432f18d7 (diff)
parente5ce433a9ef9dc3d8261e82a5543f80d7ebc50bd (diff)
downloadlatinime-8e13c338afce490197d799fd86bc7bef3057b79b.tar.gz
latinime-8e13c338afce490197d799fd86bc7bef3057b79b.tar.xz
latinime-8e13c338afce490197d799fd86bc7bef3057b79b.zip
am e5ce433a: Check second down event of double tap is on shift key
* commit 'e5ce433a9ef9dc3d8261e82a5543f80d7ebc50bd': Check second down event of double tap is on shift key
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java34
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboard.java6
2 files changed, 25 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 6d7bfb8d5..582705866 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -403,7 +403,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
GestureDetector.SimpleOnGestureListener listener =
new GestureDetector.SimpleOnGestureListener() {
- private boolean mProcessingDoubleTapEvent = false;
+ private boolean mProcessingShiftDoubleTapEvent = false;
@Override
public boolean onFling(MotionEvent me1, MotionEvent me2, float velocityX,
@@ -424,25 +424,39 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
}
@Override
- public boolean onDoubleTap(MotionEvent e) {
+ public boolean onDoubleTap(MotionEvent firstDown) {
if (ENABLE_CAPSLOCK_BY_DOUBLETAP && mKeyboard instanceof LatinKeyboard
&& ((LatinKeyboard) mKeyboard).isAlphaKeyboard()) {
- final int pointerIndex = e.getActionIndex();
- final int id = e.getPointerId(pointerIndex);
+ final int pointerIndex = firstDown.getActionIndex();
+ final int id = firstDown.getPointerId(pointerIndex);
final PointerTracker tracker = getPointerTracker(id);
- if (tracker.isOnShiftKey((int)e.getX(), (int)e.getY())) {
- onDoubleTapShiftKey(tracker);
- mProcessingDoubleTapEvent = true;
+ // If the first down event is on shift key.
+ if (tracker.isOnShiftKey((int)firstDown.getX(), (int)firstDown.getY())) {
+ mProcessingShiftDoubleTapEvent = true;
return true;
}
}
- mProcessingDoubleTapEvent = false;
+ mProcessingShiftDoubleTapEvent = false;
return false;
}
@Override
- public boolean onDoubleTapEvent(MotionEvent e) {
- return mProcessingDoubleTapEvent;
+ public boolean onDoubleTapEvent(MotionEvent secondTap) {
+ if (mProcessingShiftDoubleTapEvent
+ && secondTap.getAction() == MotionEvent.ACTION_DOWN) {
+ final MotionEvent secondDown = secondTap;
+ final int pointerIndex = secondDown.getActionIndex();
+ final int id = secondDown.getPointerId(pointerIndex);
+ final PointerTracker tracker = getPointerTracker(id);
+ // If the second down event is also on shift key.
+ if (tracker.isOnShiftKey((int)secondDown.getX(), (int)secondDown.getY())) {
+ onDoubleTapShiftKey(tracker);
+ return true;
+ }
+ // Otherwise these events should not be handled as double tap.
+ mProcessingShiftDoubleTapEvent = false;
+ }
+ return mProcessingShiftDoubleTapEvent;
}
};
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index 888375b93..1977f5fae 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -315,11 +315,7 @@ public class LatinKeyboard extends Keyboard {
int x = pointX;
int y = pointY;
final int code = key.mCode;
- if (code == CODE_SHIFT || code == CODE_DELETE) {
- y -= key.mHeight / 10;
- if (code == CODE_SHIFT) x += key.mWidth / 6;
- if (code == CODE_DELETE) x -= key.mWidth / 6;
- } else if (code == CODE_SPACE) {
+ if (code == CODE_SPACE) {
y += LatinKeyboard.sSpacebarVerticalCorrection;
if (SubtypeSwitcher.getInstance().useSpacebarLanguageSwitcher()
&& SubtypeSwitcher.getInstance().getEnabledKeyboardLocaleCount() > 1) {