Merge "Handle contacts dictionary as an ExpandableBinaryDictionary."

main
Keisuke Kuroyanagi 2014-04-25 04:54:08 +00:00 committed by Android (Google) Code Review
commit 194d64fa58
1 changed files with 4 additions and 7 deletions

View File

@ -72,26 +72,23 @@ public class DictionaryFacilitatorForSuggest {
public final ConcurrentHashMap<String, ExpandableBinaryDictionary> mSubDictMap = public final ConcurrentHashMap<String, ExpandableBinaryDictionary> mSubDictMap =
CollectionUtils.newConcurrentHashMap(); CollectionUtils.newConcurrentHashMap();
// TODO: Remove sub dictionary members and use mSubDictMap. // TODO: Remove sub dictionary members and use mSubDictMap.
public final ContactsBinaryDictionary mContactsDictionary;
public final UserBinaryDictionary mUserDictionary; public final UserBinaryDictionary mUserDictionary;
public final PersonalizationDictionary mPersonalizationDictionary; public final PersonalizationDictionary mPersonalizationDictionary;
public Dictionaries() { public Dictionaries() {
mLocale = null; mLocale = null;
mContactsDictionary = null;
mUserDictionary = null; mUserDictionary = null;
mPersonalizationDictionary = null; mPersonalizationDictionary = null;
} }
public Dictionaries(final Locale locale, final Dictionary mainDict, public Dictionaries(final Locale locale, final Dictionary mainDict,
final ContactsBinaryDictionary contactsDict, final UserBinaryDictionary userDict, final ExpandableBinaryDictionary contactsDict, final UserBinaryDictionary userDict,
final ExpandableBinaryDictionary userHistoryDict, final ExpandableBinaryDictionary userHistoryDict,
final PersonalizationDictionary personalizationDict) { final PersonalizationDictionary personalizationDict) {
mLocale = locale; mLocale = locale;
// Main dictionary can be asynchronously loaded. // Main dictionary can be asynchronously loaded.
setMainDict(mainDict); setMainDict(mainDict);
mContactsDictionary = contactsDict; setSubDict(Dictionary.TYPE_CONTACTS, contactsDict);
setSubDict(Dictionary.TYPE_CONTACTS, mContactsDictionary);
mUserDictionary = userDict; mUserDictionary = userDict;
setSubDict(Dictionary.TYPE_USER, mUserDictionary); setSubDict(Dictionary.TYPE_USER, mUserDictionary);
setSubDict(Dictionary.TYPE_USER_HISTORY, userHistoryDict); setSubDict(Dictionary.TYPE_USER_HISTORY, userHistoryDict);
@ -172,9 +169,9 @@ public class DictionaryFacilitatorForSuggest {
} }
// Open or move contacts dictionary. // Open or move contacts dictionary.
final ContactsBinaryDictionary newContactsDict; final ExpandableBinaryDictionary newContactsDict;
if (!closeContactsDictionary && mDictionaries.hasDict(Dictionary.TYPE_CONTACTS)) { if (!closeContactsDictionary && mDictionaries.hasDict(Dictionary.TYPE_CONTACTS)) {
newContactsDict = mDictionaries.mContactsDictionary; newContactsDict = mDictionaries.getSubDict(Dictionary.TYPE_CONTACTS);
} else if (useContactsDict) { } else if (useContactsDict) {
newContactsDict = new ContactsBinaryDictionary(context, newLocale); newContactsDict = new ContactsBinaryDictionary(context, newLocale);
} else { } else {