aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-09-30 13:37:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-30 13:37:40 -0700
commitc29d5654280b1171588e2ff5522bdcfbf276acd6 (patch)
treea4b7eddedf160619c8b2f1b03a0854106e29866e /java/src
parentf06cab73ec29ecd1bdc076698549d0ab726fb6f0 (diff)
parent105f7c36b7fa1845b9edbf47ca55b4a6660303b6 (diff)
downloadlatinime-c29d5654280b1171588e2ff5522bdcfbf276acd6.tar.gz
latinime-c29d5654280b1171588e2ff5522bdcfbf276acd6.tar.xz
latinime-c29d5654280b1171588e2ff5522bdcfbf276acd6.zip
am 105f7c36: am 3297ee80: Merge "Long pressing mic/comma key will show settings menue" into gingerbread
Merge commit '105f7c36b7fa1845b9edbf47ca55b4a6660303b6' * commit '105f7c36b7fa1845b9edbf47ca55b4a6660303b6': Long pressing mic/comma key will show settings menue
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardView.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
index 2872f6b46..c4afd9a27 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.latin;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.inputmethodservice.Keyboard;
@@ -41,6 +42,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
private Keyboard mPhoneKeyboard;
+ private final boolean mLongPressCommaForSettingsEnabled;
+
/** Whether we've started dropping move events because we found a big jump */
private boolean mDroppingEvents;
/**
@@ -54,11 +57,15 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
private int mLastRowY;
public LatinKeyboardView(Context context, AttributeSet attrs) {
- super(context, attrs);
+ this(context, attrs, 0);
}
public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+
+ Resources res = context.getResources();
+ mLongPressCommaForSettingsEnabled = res.getBoolean(
+ R.bool.config_long_press_comma_for_settings_enabled);
}
public void setPhoneKeyboard(Keyboard phoneKeyboard) {
@@ -90,22 +97,25 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
protected boolean onLongPress(Key key) {
int primaryCode = key.codes[0];
if (primaryCode == KEYCODE_OPTIONS) {
- getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS_LONGPRESS, null,
- LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
- LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
- return true;
+ return invokeOnKey(KEYCODE_OPTIONS_LONGPRESS);
} else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) {
// Long pressing on 0 in phone number keypad gives you a '+'.
- getOnKeyboardActionListener().onKey(
- '+', null,
- LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
- LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
- return true;
+ return invokeOnKey('+');
+ } else if (primaryCode == KEYCODE_VOICE
+ || (primaryCode == ',' && mLongPressCommaForSettingsEnabled)) {
+ return invokeOnKey(KEYCODE_OPTIONS);
} else {
return super.onLongPress(key);
}
}
+ private boolean invokeOnKey(int primaryCode) {
+ getOnKeyboardActionListener().onKey(primaryCode, null,
+ LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
+ LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
+ return true;
+ }
+
@Override
protected CharSequence adjustCase(CharSequence label) {
Keyboard keyboard = getKeyboard();