aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java52
-rw-r--r--java/src/com/android/inputmethod/latin/InputAttributes.java3
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java5
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java15
4 files changed, 39 insertions, 36 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 58bd845e1..84564c87a 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -110,7 +110,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
private final PointerTrackerParams mPointerTrackerParams;
- private final boolean mIsSpacebarTriggeringPopupByLongPress;
private final SuddenJumpingTouchEventHandler mTouchScreenRegulator;
protected KeyDetector mKeyDetector;
@@ -197,29 +196,27 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
@Override
public void startLongPressTimer(PointerTracker tracker) {
cancelLongPressTimer();
- if (tracker != null) {
- final Key key = tracker.getKey();
- final int delay;
- switch (key.mCode) {
- case Keyboard.CODE_SHIFT:
- delay = mParams.mLongPressShiftKeyTimeout;
- break;
- case Keyboard.CODE_SPACE:
- delay = mParams.mLongPressSpaceKeyTimeout;
- break;
- default:
- if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) {
- // We use longer timeout for sliding finger input started from the symbols
- // mode key.
- delay = mParams.mLongPressKeyTimeout * 3;
- } else {
- delay = mParams.mLongPressKeyTimeout;
- }
- break;
- }
- if (delay > 0) {
- sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay);
+ if (tracker == null) {
+ return;
+ }
+ final Key key = tracker.getKey();
+ final int delay;
+ switch (key.mCode) {
+ case Keyboard.CODE_SHIFT:
+ delay = mParams.mLongPressShiftKeyTimeout;
+ break;
+ default:
+ if (KeyboardSwitcher.getInstance().isInMomentarySwitchState()) {
+ // We use longer timeout for sliding finger input started from the symbols
+ // mode key.
+ delay = mParams.mLongPressKeyTimeout * 3;
+ } else {
+ delay = mParams.mLongPressKeyTimeout;
}
+ break;
+ }
+ if (delay > 0) {
+ sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, tracker), delay);
}
}
@@ -314,7 +311,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
public final int mKeyRepeatInterval;
public final int mLongPressKeyTimeout;
public final int mLongPressShiftKeyTimeout;
- public final int mLongPressSpaceKeyTimeout;
public final int mIgnoreAltCodeKeyTimeout;
public KeyTimerParams(TypedArray latinKeyboardViewAttr) {
@@ -326,8 +322,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
R.styleable.LatinKeyboardView_longPressKeyTimeout, 0);
mLongPressShiftKeyTimeout = latinKeyboardViewAttr.getInt(
R.styleable.LatinKeyboardView_longPressShiftKeyTimeout, 0);
- mLongPressSpaceKeyTimeout = latinKeyboardViewAttr.getInt(
- R.styleable.LatinKeyboardView_longPressSpaceKeyTimeout, 0);
mIgnoreAltCodeKeyTimeout = latinKeyboardViewAttr.getInt(
R.styleable.LatinKeyboardView_ignoreAltCodeKeyTimeout, 0);
}
@@ -369,7 +363,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
final KeyTimerParams keyTimerParams = new KeyTimerParams(a);
mPointerTrackerParams = new PointerTrackerParams(a);
- mIsSpacebarTriggeringPopupByLongPress = (keyTimerParams.mLongPressSpaceKeyTimeout > 0);
final float keyHysteresisDistance = a.getDimension(
R.styleable.LatinKeyboardView_keyHysteresisDistance, 0);
@@ -881,9 +874,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
drawSpacebar(key, canvas, paint);
// Whether space key needs to show the "..." popup hint for special purposes
- if (mIsSpacebarTriggeringPopupByLongPress
- && ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
- getContext(), true /* include aux subtypes */)) {
+ if (key.isLongPressEnabled() && ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
+ getContext(), true /* include aux subtypes */)) {
drawKeyPopupHint(key, canvas, paint, params);
}
} else if (key.mCode == Keyboard.CODE_LANGUAGE_SWITCH) {
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index 9c32f947c..229ae2f3c 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -29,6 +29,7 @@ public class InputAttributes {
final public boolean mInputTypeNoAutoCorrect;
final public boolean mIsSettingsSuggestionStripOn;
final public boolean mApplicationSpecifiedCompletionOn;
+ final public int mEditorAction;
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) {
final int inputType = null != editorInfo ? editorInfo.inputType : 0;
@@ -91,6 +92,8 @@ public class InputAttributes {
mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode;
}
+ mEditorAction = (editorInfo == null) ? EditorInfo.IME_ACTION_UNSPECIFIED
+ : editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
}
@SuppressWarnings("unused")
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 7232a4883..796d4ac79 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1257,6 +1257,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
handleLanguageSwitchKey();
break;
default:
+ if (primaryCode == Keyboard.CODE_TAB
+ && mInputAttributes.mEditorAction == EditorInfo.IME_ACTION_NEXT) {
+ performEditorAction(EditorInfo.IME_ACTION_NEXT);
+ break;
+ }
mSpaceState = SPACE_STATE_NONE;
if (mSettingsValues.isWordSeparator(primaryCode)) {
didAutoCorrect = handleSeparator(primaryCode, x, y, spaceState);
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index aa25faef5..f41645283 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -90,6 +90,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
public static final int SCRIPT_LATIN = 0;
public static final int SCRIPT_CYRILLIC = 1;
+ private static final String SINGLE_QUOTE = "\u0027";
+ private static final String APOSTROPHE = "\u2019";
private static final TreeMap<String, Integer> mLanguageToScript;
static {
// List of the supported languages and their associated script. We won't check
@@ -574,24 +576,24 @@ public class AndroidSpellCheckerService extends SpellCheckerService
public SuggestionsInfo onGetSuggestions(final TextInfo textInfo,
final int suggestionsLimit) {
try {
- final String text = textInfo.getText();
+ final String inText = textInfo.getText();
final SuggestionsParams cachedSuggestionsParams =
- mSuggestionsCache.getSuggestionsFromCache(text);
+ mSuggestionsCache.getSuggestionsFromCache(inText);
if (cachedSuggestionsParams != null) {
if (DBG) {
- Log.d(TAG, "Cache hit: " + text + ", " + cachedSuggestionsParams.mFlags);
+ Log.d(TAG, "Cache hit: " + inText + ", " + cachedSuggestionsParams.mFlags);
}
return new SuggestionsInfo(
cachedSuggestionsParams.mFlags, cachedSuggestionsParams.mSuggestions);
}
- if (shouldFilterOut(text, mScript)) {
+ if (shouldFilterOut(inText, mScript)) {
DictAndProximity dictInfo = null;
try {
dictInfo = mDictionaryPool.takeOrGetNull();
if (null == dictInfo) return getNotInDictEmptySuggestions();
- return dictInfo.mDictionary.isValidWord(text) ? getInDictEmptySuggestions()
- : getNotInDictEmptySuggestions();
+ return dictInfo.mDictionary.isValidWord(inText) ?
+ getInDictEmptySuggestions() : getNotInDictEmptySuggestions();
} finally {
if (null != dictInfo) {
if (!mDictionaryPool.offer(dictInfo)) {
@@ -600,6 +602,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
}
}
}
+ final String text = inText.replaceAll(APOSTROPHE, SINGLE_QUOTE);
// TODO: Don't gather suggestions if the limit is <= 0 unless necessary
final SuggestionsGatherer suggestionsGatherer = new SuggestionsGatherer(text,