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.java34
1 files changed, 27 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 786e766d6..0c3509c77 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -209,6 +209,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;
@@ -417,7 +425,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
private void initSuggest() {
- updateAutoTextEnabled();
String locale = mSubtypeSwitcher.getInputLocaleStr();
Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(new Locale(locale));
@@ -431,6 +438,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);
@@ -1131,7 +1139,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;
@@ -1256,7 +1264,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()) {
@@ -1297,7 +1305,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
@@ -1633,9 +1641,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
@@ -1704,7 +1724,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)));
}