aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java42
1 files changed, 34 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 1e6238e69..97f6b8d83 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -100,7 +100,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
* shown for a given text field. For instance, this is specified by the
* search dialog when the dialog is already showing a voice search button.
*/
- public static final String IME_OPTION_NO_MICROPHONE = "noMicrophone";
+ public static final String IME_OPTION_NO_MICROPHONE = "noMicrophoneKey";
+
+ /**
+ * The private IME option used to indicate that no settings key should be
+ * shown for a given text field.
+ */
+ public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey";
private static final int DELAY_UPDATE_SUGGESTIONS = 180;
private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300;
@@ -205,6 +211,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private final ArrayList<WordAlternatives> mWordHistory = new ArrayList<WordAlternatives>();
+ static {
+ try {
+ System.loadLibrary("jni_latinime");
+ } catch (UnsatisfiedLinkError ule) {
+ Log.e(TAG, "Could not load native library jni_latinime");
+ }
+ }
+
public abstract static class WordAlternatives {
protected CharSequence mChosenWord;
@@ -415,7 +429,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
private void initSuggest() {
- updateAutoTextEnabled();
String locale = mSubtypeSwitcher.getInputLocaleStr();
Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(new Locale(locale));
@@ -429,6 +442,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
int mainDicResId = Utils.getMainDictionaryResourceId(res);
mSuggest = new Suggest(this, mainDicResId);
loadAndSetAutoCorrectionThreshold(prefs);
+ updateAutoTextEnabled();
mUserDictionary = new UserDictionary(this, locale);
mSuggest.setUserDictionary(mUserDictionary);
@@ -1133,7 +1147,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (isWordSeparator(primaryCode)) {
handleSeparator(primaryCode);
} else {
- handleCharacter(primaryCode, keyCodes);
+ handleCharacter(primaryCode, keyCodes, x, y);
}
// Cancel the just reverted state
mJustReverted = false;
@@ -1258,7 +1272,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- private void handleCharacter(int primaryCode, int[] keyCodes) {
+ private void handleCharacter(int primaryCode, int[] keyCodes, int x, int y) {
mVoiceConnector.handleCharacter();
if (mLastSelectionStart == mLastSelectionEnd && TextEntryState.isCorrecting()) {
@@ -1299,7 +1313,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mWord.setFirstCharCapitalized(true);
}
mComposing.append((char) code);
- mWord.add(code, keyCodes);
+ mWord.add(code, keyCodes, x, y);
InputConnection ic = getCurrentInputConnection();
if (ic != null) {
// If it's the first letter, make note of auto-caps state
@@ -1635,9 +1649,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mJustAddedAutoSpace = true;
}
- final boolean showingAddToDictionaryHint = index == 0 && mCorrectionMode > 0
+ // We should show the hint if the user pressed the first entry AND either:
+ // - There is no dictionary (we know that because we tried to load it => null != mSuggest
+ // AND mHasDictionary is false)
+ // - There is a dictionary and the word is not in it
+ // Please note that if mSuggest is null, it means that everything is off: suggestion
+ // and correction, so we shouldn't try to show the hint
+ // We used to look at mCorrectionMode here, but showing the hint should have nothing
+ // to do with the autocorrection setting.
+ final boolean showingAddToDictionaryHint = index == 0 &&
+ // Test for no dictionary:
+ ((!mHasDictionary && null != mSuggest) ||
+ // Test for dictionary && word is inside:
+ (mHasDictionary && null != mSuggest
&& !mSuggest.isValidWord(suggestion)
- && !mSuggest.isValidWord(suggestion.toString().toLowerCase());
+ && !mSuggest.isValidWord(suggestion.toString().toLowerCase())));
if (!correcting) {
// Fool the state watcher so that a subsequent backspace will not do a revert, unless
@@ -1706,7 +1732,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
for (int i = 0; i < touching.mWord.length(); i++) {
foundWord.add(touching.mWord.charAt(i), new int[] {
touching.mWord.charAt(i)
- });
+ }, WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
}
foundWord.setFirstCharCapitalized(Character.isUpperCase(touching.mWord.charAt(0)));
}