From d4bb7df412e13197570436e9b8ec7db4f1199a06 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi <ksk@google.com> Date: Mon, 16 Dec 2013 19:17:31 +0900 Subject: [PATCH] Add option to enable personalization dictionaries. Bug: 11757851 Change-Id: I4872c10793d4fd55c0bd9e5bc4650925de6d2c1d --- java/res/values/strings.xml | 5 +++++ java/res/xml/prefs.xml | 6 ++++++ .../com/android/inputmethod/latin/settings/Settings.java | 1 + .../android/inputmethod/latin/settings/SettingsValues.java | 5 +++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index a269d4979a..f4d072dd52 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -87,6 +87,11 @@ <!-- Description for option enabling or disabling the use of names of people in Contacts for suggestion and correction [CHAR LIMIT=65] --> <string name="use_contacts_dict_summary">Use names from Contacts for suggestions and corrections</string> + <!-- Option name for enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=25] --> + <string name="use_personalized_dicts">Personalized suggestions</string> + <!-- Description for option enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=65] --> + <string name="use_personalized_dicts_summary">Learn from your communications and typed data to improve suggestions</string> + <!-- Option name for enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=30] --> <string name="use_double_space_period">Double-space period</string> <!-- Description for option enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=65] --> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index bf3b623532..4f7c9f0587 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -133,6 +133,12 @@ android:summary="@string/use_contacts_dict_summary" android:persistent="true" android:defaultValue="true" /> + <CheckBoxPreference + android:key="pref_key_use_personalized_dicts" + android:title="@string/use_personalized_dicts" + android:summary="@string/use_personalized_dicts_summary" + android:persistent="true" + android:defaultValue="true" /> <CheckBoxPreference android:key="pref_key_use_double_space_period" android:title="@string/use_double_space_period" diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java index 714c3a97ae..94f1458133 100644 --- a/java/src/com/android/inputmethod/latin/settings/Settings.java +++ b/java/src/com/android/inputmethod/latin/settings/Settings.java @@ -53,6 +53,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang public static final String PREF_MISC_SETTINGS = "misc_settings"; public static final String PREF_ADVANCED_SETTINGS = "pref_advanced_settings"; public static final String PREF_KEY_USE_CONTACTS_DICT = "pref_key_use_contacts_dict"; + public static final String PREF_KEY_USE_PERSONALIZED_DICTS = "pref_key_use_personalized_dicts"; public static final String PREF_KEY_USE_DOUBLE_SPACE_PERIOD = "pref_key_use_double_space_period"; public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE = diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java index 06406c19b2..d98e547fc1 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java @@ -29,11 +29,9 @@ import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.InputAttributes; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.RichInputMethodManager; -import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.utils.CollectionUtils; -import com.android.inputmethod.latin.utils.InputTypeUtils; import com.android.inputmethod.latin.utils.StringUtils; import java.util.ArrayList; @@ -71,6 +69,7 @@ public final class SettingsValues { public final boolean mIncludesOtherImesInLanguageSwitchList; public final boolean mShowsLanguageSwitchKey; public final boolean mUseContactsDict; + public final boolean mUsePersonalizedDicts; public final boolean mUseDoubleSpacePeriod; public final boolean mBlockPotentiallyOffensive; // Use bigrams to predict the next word when there is no input for it yet @@ -148,6 +147,7 @@ public final class SettingsValues { Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false); mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); + mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true); mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true); mBlockPotentiallyOffensive = Settings.readBlockPotentiallyOffensive(prefs, res); mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(autoCorrectionThresholdRawValue, res); @@ -206,6 +206,7 @@ public final class SettingsValues { mIncludesOtherImesInLanguageSwitchList = false; mShowsLanguageSwitchKey = true; mUseContactsDict = true; + mUsePersonalizedDicts = true; mUseDoubleSpacePeriod = true; mBlockPotentiallyOffensive = true; mAutoCorrectEnabled = true; -- GitLab