From f8552f61a4150a23779dc969c831368381af8301 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Wed, 26 Feb 2014 19:14:16 +0900 Subject: [PATCH] Set additional attributes in dictionary facilitator. Bug: 13197276 Change-Id: I206cf4e599ca9cdf40d669358a1067a2954d11e3 --- .../latin/DictionaryFacilitatorForSuggest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java index 2dba7131e..cd18a6ba5 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; @@ -142,7 +143,8 @@ public class DictionaryFacilitatorForSuggest { @UsedForTesting public DictionaryFacilitatorForSuggest(final Context context, final Locale locale, - final ArrayList dictionaryTypes, final HashMap dictionaryFiles) { + final ArrayList dictionaryTypes, final HashMap dictionaryFiles, + final Map> additionalDictAttributes) { mContext = context; mLocale = locale; mLatchForWaitingLoadingMainDictionary = new CountDownLatch(0); @@ -159,6 +161,10 @@ public class DictionaryFacilitatorForSuggest { userHistoryDictionary.reloadDictionaryIfRequired(); userHistoryDictionary.waitAllTasksForTests(); setUserHistoryDictionary(userHistoryDictionary); + if (additionalDictAttributes.containsKey(dictType)) { + userHistoryDictionary.clearAndFlushDictionaryWithAdditionalAttributes( + additionalDictAttributes.get(dictType)); + } } else if (dictType.equals(Dictionary.TYPE_PERSONALIZATION)) { final PersonalizationDictionary personalizationDictionary = PersonalizationHelper.getPersonalizationDictionary(context, locale); @@ -167,6 +173,10 @@ public class DictionaryFacilitatorForSuggest { personalizationDictionary.reloadDictionaryIfRequired(); personalizationDictionary.waitAllTasksForTests(); setPersonalizationDictionary(personalizationDictionary); + if (additionalDictAttributes.containsKey(dictType)) { + personalizationDictionary.clearAndFlushDictionaryWithAdditionalAttributes( + additionalDictAttributes.get(dictType)); + } } else if (dictType.equals(Dictionary.TYPE_USER)) { final File file = dictionaryFiles.get(dictType); final UserBinaryDictionary userDictionary = new UserBinaryDictionary(