aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java2
-rw-r--r--java/src/com/android/inputmethod/latin/AutoCorrection.java9
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java22
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java40
4 files changed, 11 insertions, 62 deletions
diff --git a/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
index f33a46277..36ffe2dce 100644
--- a/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
+++ b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java
@@ -57,7 +57,7 @@ public class RecorrectionSuggestionEntries {
private static SuggestedWords.Builder getTypedSuggestions(
Suggest suggest, KeyboardSwitcher keyboardSwitcher, WordComposer word) {
- return suggest.getSuggestedWordBuilder(keyboardSwitcher.getKeyboardView(), word, null,
+ return suggest.getSuggestedWordBuilder(word, null,
keyboardSwitcher.getLatinKeyboard().getProximityInfo());
}
}
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index e6ae2c5c7..fc9771065 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -50,7 +50,7 @@ public class AutoCorrection {
public void updateAutoCorrectionStatus(Map<String, Dictionary> dictionaries,
WordComposer wordComposer, ArrayList<CharSequence> suggestions, int[] sortedScores,
CharSequence typedWord, double autoCorrectionThreshold, int correctionMode,
- CharSequence quickFixedWord, CharSequence whitelistedWord) {
+ CharSequence whitelistedWord) {
if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
mHasAutoCorrection = true;
mAutoCorrectionWord = whitelistedWord;
@@ -58,9 +58,6 @@ public class AutoCorrection {
dictionaries, wordComposer, suggestions, typedWord, correctionMode)) {
mHasAutoCorrection = true;
mAutoCorrectionWord = typedWord;
- } else if (hasAutoCorrectionForQuickFix(quickFixedWord)) {
- mHasAutoCorrection = true;
- mAutoCorrectionWord = quickFixedWord;
} else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestions, correctionMode,
sortedScores, typedWord, autoCorrectionThreshold)) {
mHasAutoCorrection = true;
@@ -109,10 +106,6 @@ public class AutoCorrection {
|| correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}
- private static boolean hasAutoCorrectionForQuickFix(CharSequence quickFixedWord) {
- return quickFixedWord != null;
- }
-
private boolean hasAutoCorrectionForBinaryDictionary(WordComposer wordComposer,
ArrayList<CharSequence> suggestions, int correctionMode, int[] sortedScores,
CharSequence typedWord, double autoCorrectionThreshold) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index dfb4d0622..777881ca1 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -550,7 +550,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSettingsValues.mAutoCorrectEnabled) {
mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
}
- updateAutoTextEnabled();
mUserDictionary = new UserDictionary(this, localeStr);
mSuggest.setUserDictionary(mUserDictionary);
@@ -734,7 +733,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
loadSettings();
updateCorrectionMode();
- updateAutoTextEnabled();
updateSuggestionVisibility(mPrefs, mResources);
if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) {
@@ -1673,8 +1671,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
// getSuggestedWordBuilder handles gracefully a null value of prevWord
final SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
- mKeyboardSwitcher.getKeyboardView(), wordComposer, prevWord,
- mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
+ wordComposer, prevWord, mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
boolean autoCorrectionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasAutoCorrection();
final CharSequence typedWord = wordComposer.getTypedWord();
@@ -1907,9 +1904,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
mSettingsValues.mWordSeparators);
- SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
- mKeyboardSwitcher.getKeyboardView(), sEmptyWordComposer, prevWord,
- mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
+ SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(sEmptyWordComposer,
+ prevWord, mKeyboardSwitcher.getLatinKeyboard().getProximityInfo());
if (builder.size() > 0) {
// Explicitly supply an empty typed word (the no-second-arg version of
@@ -2214,18 +2210,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- private void updateAutoTextEnabled() {
- if (mSuggest == null) return;
- // We want to use autotext if the settings are asking for auto corrections, and if
- // the input language is the same as the system language (because autotext will only
- // work in the system language so if we are entering text in a different language we
- // do not want it on).
- // We used to look at the "quick fixes" option instead of mAutoCorrectEnabled, but
- // this option was redundant and confusing and therefore removed.
- mSuggest.setQuickFixesEnabled(mSettingsValues.mAutoCorrectEnabled
- && SubtypeSwitcher.getInstance().isSystemLanguageSameAsInputLanguage());
- }
-
private void updateSuggestionVisibility(final SharedPreferences prefs, final Resources res) {
final String suggestionVisiblityStr = prefs.getString(
Settings.PREF_SHOW_SUGGESTIONS_SETTING,
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 16dccf824..208fd13ec 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -17,10 +17,8 @@
package com.android.inputmethod.latin;
import android.content.Context;
-import android.text.AutoText;
import android.text.TextUtils;
import android.util.Log;
-import android.view.View;
import com.android.inputmethod.keyboard.ProximityInfo;
@@ -97,8 +95,6 @@ public class Suggest implements Dictionary.WordCallback {
private static final int PREF_MAX_BIGRAMS = 60;
- private boolean mQuickFixesEnabled;
-
private double mAutoCorrectionThreshold;
private int[] mScores = new int[mPrefMaxSuggestions];
private int[] mBigramScores = new int[PREF_MAX_BIGRAMS];
@@ -160,6 +156,7 @@ public class Suggest implements Dictionary.WordCallback {
final Locale locale) {
mMainDict = null;
new Thread("InitializeBinaryDictionary") {
+ @Override
public void run() {
final Dictionary newMainDict = DictionaryFactory.createDictionaryFromManager(
context, locale, dictionaryResId);
@@ -170,11 +167,6 @@ public class Suggest implements Dictionary.WordCallback {
}.start();
}
-
- public void setQuickFixesEnabled(boolean enabled) {
- mQuickFixesEnabled = enabled;
- }
-
public int getCorrectionMode() {
return mCorrectionMode;
}
@@ -256,14 +248,13 @@ public class Suggest implements Dictionary.WordCallback {
/**
* Returns a object which represents suggested words that match the list of character codes
* passed in. This object contents will be overwritten the next time this function is called.
- * @param view a view for retrieving the context for AutoText
* @param wordComposer contains what is currently being typed
* @param prevWordForBigram previous word (used only for bigram)
* @return suggested words object.
*/
- public SuggestedWords getSuggestions(final View view, final WordComposer wordComposer,
+ public SuggestedWords getSuggestions(final WordComposer wordComposer,
final CharSequence prevWordForBigram, final ProximityInfo proximityInfo) {
- return getSuggestedWordBuilder(view, wordComposer, prevWordForBigram,
+ return getSuggestedWordBuilder(wordComposer, prevWordForBigram,
proximityInfo).build();
}
@@ -295,7 +286,7 @@ public class Suggest implements Dictionary.WordCallback {
}
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
- public SuggestedWords.Builder getSuggestedWordBuilder(final View view,
+ public SuggestedWords.Builder getSuggestedWordBuilder(
final WordComposer wordComposer, CharSequence prevWordForBigram,
final ProximityInfo proximityInfo) {
LatinImeLogger.onStartSuggestion(prevWordForBigram);
@@ -336,6 +327,7 @@ public class Suggest implements Dictionary.WordCallback {
}
} else {
// Word entered: return only bigrams that match the first char of the typed word
+ @SuppressWarnings("null")
final char currentChar = typedWord.charAt(0);
// TODO: Must pay attention to locale when changing case.
final char currentCharUpper = Character.toUpperCase(currentChar);
@@ -363,34 +355,14 @@ public class Suggest implements Dictionary.WordCallback {
dictionary.getWords(wordComposer, this, proximityInfo);
}
}
- CharSequence autoText = null;
final String typedWordString = typedWord == null ? null : typedWord.toString();
- if (typedWord != null) {
- // Apply quick fix only for the typed word.
- if (mQuickFixesEnabled) {
- final String lowerCaseTypedWord = typedWordString.toLowerCase();
- // Is there an AutoText (also known as Quick Fixes) correction?
- // Capitalize as needed
- autoText = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized, AutoText.get(
- lowerCaseTypedWord, 0, lowerCaseTypedWord.length(), view));
- if (DBG) {
- if (autoText != null) {
- Log.d(TAG, "Auto corrected by AUTOTEXT: " + typedWord + " -> " + autoText);
- }
- }
- }
- }
CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized,
mWhiteListDictionary.getWhiteListedWord(typedWordString));
mAutoCorrection.updateAutoCorrectionStatus(mUnigramDictionaries, wordComposer,
mSuggestions, mScores, typedWord, mAutoCorrectionThreshold, mCorrectionMode,
- autoText, whitelistedWord);
-
- if (autoText != null) {
- mSuggestions.add(0, autoText);
- }
+ whitelistedWord);
if (whitelistedWord != null) {
mSuggestions.add(0, whitelistedWord);