Merge "Make AutoCorrection static and non-instantiable (A5)"
commit
23a5e9d1a7
|
@ -26,7 +26,11 @@ public class AutoCorrection {
|
|||
private static final boolean DBG = LatinImeLogger.sDBG;
|
||||
private static final String TAG = AutoCorrection.class.getSimpleName();
|
||||
|
||||
public static CharSequence updateAutoCorrectionStatus(Map<String, Dictionary> dictionaries,
|
||||
private AutoCorrection() {
|
||||
// Purely static class: can't instantiate.
|
||||
}
|
||||
|
||||
public static CharSequence computeAutoCorrectionWord(Map<String, Dictionary> dictionaries,
|
||||
WordComposer wordComposer, ArrayList<CharSequence> suggestions, int[] sortedScores,
|
||||
CharSequence typedWord, double autoCorrectionThreshold, int correctionMode,
|
||||
CharSequence whitelistedWord) {
|
||||
|
|
|
@ -83,7 +83,6 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
|
||||
private static final boolean DBG = LatinImeLogger.sDBG;
|
||||
|
||||
private AutoCorrection mAutoCorrection;
|
||||
private boolean mHasAutoCorrection;
|
||||
|
||||
private Dictionary mMainDict;
|
||||
|
@ -125,7 +124,6 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
private void initWhitelistAndAutocorrectAndPool(final Context context, final Locale locale) {
|
||||
mWhiteListDictionary = new WhitelistDictionary(context, locale);
|
||||
addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_WHITELIST, mWhiteListDictionary);
|
||||
mAutoCorrection = new AutoCorrection();
|
||||
StringBuilderPool.ensureCapacity(mPrefMaxSuggestions, getApproxMaxWordLength());
|
||||
}
|
||||
|
||||
|
@ -273,7 +271,6 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
||||
final ProximityInfo proximityInfo, final int correctionMode) {
|
||||
LatinImeLogger.onStartSuggestion(prevWordForBigram);
|
||||
mAutoCorrection.init();
|
||||
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
|
||||
mIsAllUpperCase = wordComposer.isAllUpperCase();
|
||||
mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
|
||||
|
@ -354,7 +351,7 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
mWhiteListDictionary.getWhitelistedWord(consideredWordString));
|
||||
|
||||
final CharSequence autoCorrection =
|
||||
mAutoCorrection.updateAutoCorrectionStatus(mUnigramDictionaries, wordComposer,
|
||||
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
|
||||
mSuggestions, mScores, consideredWord, mAutoCorrectionThreshold, correctionMode,
|
||||
whitelistedWord);
|
||||
mHasAutoCorrection = (null != autoCorrection);
|
||||
|
|
Loading…
Reference in New Issue