diff options
author | 2014-09-18 09:25:24 +0000 | |
---|---|---|
committer | 2014-09-18 09:25:24 +0000 | |
commit | 9b5afb5d1de42e1d3e98a125f8a1c2db73093369 (patch) | |
tree | 1adf2ad5328204b2d01ab1394cc11f2438a6b271 /java/src | |
parent | dee75631dddfb77b38e120bdac077d36c3bff48f (diff) | |
parent | cdabc71c6da00ea1c2254e13021973c762c79be4 (diff) | |
download | latinime-9b5afb5d1de42e1d3e98a125f8a1c2db73093369.tar.gz latinime-9b5afb5d1de42e1d3e98a125f8a1c2db73093369.tar.xz latinime-9b5afb5d1de42e1d3e98a125f8a1c2db73093369.zip |
am cdabc71c: Merge "Add a Dictionary.isUserSpecific method."
* commit 'cdabc71c6da00ea1c2254e13021973c762c79be4':
Add a Dictionary.isUserSpecific method.
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Dictionary.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/Dictionary.java b/java/src/com/android/inputmethod/latin/Dictionary.java index 2f79c7662..cad9ee7d8 100644 --- a/java/src/com/android/inputmethod/latin/Dictionary.java +++ b/java/src/com/android/inputmethod/latin/Dictionary.java @@ -22,6 +22,8 @@ import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion; import java.util.ArrayList; import java.util.Locale; +import java.util.Arrays; +import java.util.HashSet; /** * Abstract base class for a dictionary that can do a fuzzy search for words based on a set of key @@ -65,6 +67,14 @@ public abstract class Dictionary { // The locale for this dictionary. May be null if unknown (phony dictionary for example). public final Locale mLocale; + /** + * Set out of the dictionary types listed above that are based on data specific to the user, + * e.g., the user's contacts. + */ + private static final HashSet<String> sUserSpecificDictionaryTypes = + new HashSet(Arrays.asList(new String[] { TYPE_USER_TYPED, TYPE_USER, TYPE_CONTACTS, + TYPE_USER_HISTORY, TYPE_PERSONALIZATION, TYPE_CONTEXTUAL })); + public Dictionary(final String dictType, final Locale locale) { mDictType = dictType; mLocale = locale; @@ -159,6 +169,14 @@ public abstract class Dictionary { } /** + * Whether this dictionary is based on data specific to the user, e.g., the user's contacts. + * @return Whether this dictionary is specific to the user. + */ + public boolean isUserSpecific() { + return sUserSpecificDictionaryTypes.contains(mDictType); + } + + /** * Not a true dictionary. A placeholder used to indicate suggestions that don't come from any * real dictionary. */ |