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.java37
1 files changed, 20 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 9f5931de9..fa5a46fca 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -459,6 +459,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// TODO: remove the following when it's not needed by updateCorrectionMode() any more
mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */);
+ updateCorrectionMode();
+
Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
@@ -534,8 +536,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
= new UserBigramDictionary(this, this, localeStr, Suggest.DIC_USER_BIGRAM);
mSuggest.setUserBigramDictionary(mUserBigramDictionary);
- updateCorrectionMode();
-
LocaleUtils.setSystemLocale(res, savedLocale);
}
@@ -931,7 +931,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
false /* typedWordValid */,
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
- false /* isPunctuationSuggestions */);
+ false /* isPunctuationSuggestions */,
+ false /* isObsoleteSuggestions */);
// When in fullscreen mode, show completions generated by the application
final boolean isAutoCorrection = false;
setSuggestions(suggestedWords, isAutoCorrection);
@@ -1715,7 +1716,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
setAutoCorrectionIndicator(false);
}
- public void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) {
+ private void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) {
if (mSuggestionsView != null) {
mSuggestionsView.setSuggestions(words);
mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection);
@@ -1725,15 +1726,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private void setAutoCorrectionIndicator(final boolean newAutoCorrectionIndicator) {
// Put a blue underline to a word in TextView which will be auto-corrected.
final InputConnection ic = getCurrentInputConnection();
- if (ic != null) {
- if (mIsAutoCorrectionIndicatorOn != newAutoCorrectionIndicator) {
- if (mWordComposer.isComposingWord()) {
- mIsAutoCorrectionIndicatorOn = newAutoCorrectionIndicator;
- final CharSequence textWithUnderline =
- getTextWithUnderline(mWordComposer.getTypedWord());
- ic.setComposingText(textWithUnderline, 1);
- }
- }
+ if (ic == null) return;
+ if (mIsAutoCorrectionIndicatorOn != newAutoCorrectionIndicator
+ && mWordComposer.isComposingWord()) {
+ mIsAutoCorrectionIndicatorOn = newAutoCorrectionIndicator;
+ final CharSequence textWithUnderline =
+ getTextWithUnderline(mWordComposer.getTypedWord());
+ ic.setComposingText(textWithUnderline, 1);
}
}
@@ -1766,7 +1765,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
final CharSequence typedWord = mWordComposer.getTypedWord();
- // getSuggestedWordBuilder handles gracefully a null value of prevWord
+ // getSuggestedWords handles gracefully a null value of prevWord
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(), mCorrectionMode);
@@ -1793,7 +1792,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
false /* typedWordValid */,
false /* hasAutoCorrectionCandidate */,
false /* allowsToBeAutoCorrected */,
- false /* isPunctuationSuggestions */);
+ false /* isPunctuationSuggestions */,
+ true /* isObsoleteSuggestions */);
showSuggestions(obsoleteSuggestedWords, typedWord);
}
}
@@ -2059,10 +2059,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (ic == null) return false;
CharSequence before = ic.getTextBeforeCursor(1, 0);
CharSequence after = ic.getTextAfterCursor(1, 0);
- if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0))) {
+ if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0))
+ && !mSettingsValues.isSymbolExcludedFromWordSeparators(before.charAt(0))) {
return true;
}
- if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0))) {
+ if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0))
+ && !mSettingsValues.isSymbolExcludedFromWordSeparators(after.charAt(0))) {
return true;
}
return false;
@@ -2233,6 +2235,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mSettingsValues);
}
initSuggest();
+ updateCorrectionMode();
loadSettings();
// Since we just changed languages, we should re-evaluate suggestions with whatever word
// we are currently composing. If we are not composing anything, we may want to display