Merge "Remove unused stuff."

main
Jean Chalard 2012-06-27 01:56:16 -07:00 committed by Android (Google) Code Review
commit d05d1d04d0
3 changed files with 2 additions and 28 deletions

View File

@ -470,8 +470,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged()
// is not guaranteed. It may even be called at the same time on a different thread. // is not guaranteed. It may even be called at the same time on a different thread.
if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mUserHistoryDictionary = UserHistoryDictionary.getInstance( mUserHistoryDictionary = UserHistoryDictionary.getInstance(this, localeStr, mPrefs);
this, localeStr, Suggest.DIC_USER_HISTORY, mPrefs);
mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary);
} }

View File

@ -28,7 +28,6 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -47,16 +46,6 @@ public class Suggest {
// TODO: rename this to CORRECTION_ON // TODO: rename this to CORRECTION_ON
public static final int CORRECTION_FULL = 1; public static final int CORRECTION_FULL = 1;
// It seems the following values are only used for logging.
public static final int DIC_USER_TYPED = 0;
public static final int DIC_MAIN = 1;
public static final int DIC_USER = 2;
public static final int DIC_USER_HISTORY = 3;
public static final int DIC_CONTACTS = 4;
public static final int DIC_WHITELIST = 6;
// If you add a type of dictionary, increment DIC_TYPE_LAST_ID
// TODO: this value seems unused. Remove it?
public static final int DIC_TYPE_LAST_ID = 6;
public static final String DICT_KEY_USER_TYPED = "user_typed"; public static final String DICT_KEY_USER_TYPED = "user_typed";
public static final String DICT_KEY_MAIN = "main"; public static final String DICT_KEY_MAIN = "main";
public static final String DICT_KEY_CONTACTS = "contacts"; public static final String DICT_KEY_CONTACTS = "contacts";
@ -65,17 +54,6 @@ public class Suggest {
// User history dictionary internal to LatinIME // User history dictionary internal to LatinIME
public static final String DICT_KEY_USER_HISTORY = "history"; public static final String DICT_KEY_USER_HISTORY = "history";
public static final String DICT_KEY_WHITELIST ="whitelist"; public static final String DICT_KEY_WHITELIST ="whitelist";
// TODO: remove this map. This only serves as backward compatibility with a feature
// that has never been used and has been broken for a while.
private static final HashMap<String, Integer> sDictKeyToDictIndex
= new HashMap<String, Integer>();
static {
sDictKeyToDictIndex.put(DICT_KEY_MAIN, DIC_MAIN);
sDictKeyToDictIndex.put(DICT_KEY_USER, DIC_USER);
sDictKeyToDictIndex.put(DICT_KEY_USER_HISTORY, DIC_USER_HISTORY);
sDictKeyToDictIndex.put(DICT_KEY_CONTACTS, DIC_CONTACTS);
sDictKeyToDictIndex.put(DICT_KEY_WHITELIST, DIC_WHITELIST);
}
private static final boolean DBG = LatinImeLogger.sDBG; private static final boolean DBG = LatinImeLogger.sDBG;
@ -246,7 +224,6 @@ public class Suggest {
lowerPrevWord = null; lowerPrevWord = null;
} }
for (final String key : mDictionaries.keySet()) { for (final String key : mDictionaries.keySet()) {
final int dicTypeId = sDictKeyToDictIndex.get(key);
final Dictionary dictionary = mDictionaries.get(key); final Dictionary dictionary = mDictionaries.get(key);
final ArrayList<SuggestedWordInfo> localSuggestions = final ArrayList<SuggestedWordInfo> localSuggestions =
dictionary.getBigrams(wordComposer, prevWordForBigram); dictionary.getBigrams(wordComposer, prevWordForBigram);
@ -273,7 +250,6 @@ public class Suggest {
// Skip UserUnigramDictionary and WhitelistDictionary to lookup // Skip UserUnigramDictionary and WhitelistDictionary to lookup
if (key.equals(DICT_KEY_USER_HISTORY) || key.equals(DICT_KEY_WHITELIST)) if (key.equals(DICT_KEY_USER_HISTORY) || key.equals(DICT_KEY_WHITELIST))
continue; continue;
final int dicTypeId = sDictKeyToDictIndex.get(key);
final Dictionary dictionary = mDictionaries.get(key); final Dictionary dictionary = mDictionaries.get(key);
final ArrayList<SuggestedWordInfo> localSuggestions = dictionary.getWords( final ArrayList<SuggestedWordInfo> localSuggestions = dictionary.getWords(
wordComposerForLookup, prevWordForBigram, proximityInfo); wordComposerForLookup, prevWordForBigram, proximityInfo);

View File

@ -115,8 +115,7 @@ public class UserHistoryDictionary extends ExpandableDictionary {
} }
public synchronized static UserHistoryDictionary getInstance( public synchronized static UserHistoryDictionary getInstance(
final Context context, final String locale, final Context context, final String locale, final SharedPreferences sp) {
final int dictTypeId, final SharedPreferences sp) {
if (sLangDictCache.containsKey(locale)) { if (sLangDictCache.containsKey(locale)) {
final SoftReference<UserHistoryDictionary> ref = sLangDictCache.get(locale); final SoftReference<UserHistoryDictionary> ref = sLangDictCache.get(locale);
final UserHistoryDictionary dict = ref == null ? null : ref.get(); final UserHistoryDictionary dict = ref == null ? null : ref.get();