am a327d4a4: Merge "Use fixed order of dictionaries to get suggestions."
* commit 'a327d4a475cad1a71405466ecff2ab60c6d2ce21': Use fixed order of dictionaries to get suggestions.main
commit
543bb91539
|
@ -36,7 +36,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -54,6 +53,15 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
// To synchronize assigning mDictionaries to ensure closing dictionaries.
|
// To synchronize assigning mDictionaries to ensure closing dictionaries.
|
||||||
private Object mLock = new Object();
|
private Object mLock = new Object();
|
||||||
|
|
||||||
|
private static final String[] dictTypesOrderedToGetSuggestion =
|
||||||
|
new String[] {
|
||||||
|
Dictionary.TYPE_MAIN,
|
||||||
|
Dictionary.TYPE_USER_HISTORY,
|
||||||
|
Dictionary.TYPE_PERSONALIZATION,
|
||||||
|
Dictionary.TYPE_USER,
|
||||||
|
Dictionary.TYPE_CONTACTS
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class contains dictionaries for a locale.
|
* Class contains dictionaries for a locale.
|
||||||
*/
|
*/
|
||||||
|
@ -453,7 +461,8 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
final Map<String, Dictionary> dictMap = dictionaries.mDictMap;
|
final Map<String, Dictionary> dictMap = dictionaries.mDictMap;
|
||||||
final SuggestionResults suggestionResults =
|
final SuggestionResults suggestionResults =
|
||||||
new SuggestionResults(dictionaries.mLocale, SuggestedWords.MAX_SUGGESTIONS);
|
new SuggestionResults(dictionaries.mLocale, SuggestedWords.MAX_SUGGESTIONS);
|
||||||
for (final Dictionary dictionary : dictMap.values()) {
|
for (final String dictType : dictTypesOrderedToGetSuggestion) {
|
||||||
|
final Dictionary dictionary = dictMap.get(dictType);
|
||||||
if (null == dictionary) continue;
|
if (null == dictionary) continue;
|
||||||
final ArrayList<SuggestedWordInfo> dictionarySuggestions =
|
final ArrayList<SuggestedWordInfo> dictionarySuggestions =
|
||||||
dictionary.getSuggestionsWithSessionId(composer, prevWord, proximityInfo,
|
dictionary.getSuggestionsWithSessionId(composer, prevWord, proximityInfo,
|
||||||
|
|
Loading…
Reference in New Issue