Loading java/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ <!-- Description for delay for dismissing a popup on screen: default value of the delay [CHAR LIMIT=15] --> <string name="key_preview_popup_dismiss_default_delay">Default</string> <!-- Option name for enabling or disabling the use of names of people in Contacts for suggestion and correction [CHAR LIMIT=25] --> <string name="use_contacts_dict">Suggest Contact names</string> <!-- 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 to enable auto capitalization of sentences --> <string name="auto_cap">Auto-capitalization</string> Loading java/res/xml/prefs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,12 @@ <ListPreference android:key="pref_key_preview_popup_dismiss_delay" android:title="@string/key_preview_popup_dismiss_delay" /> <CheckBoxPreference android:key="pref_key_use_contacts_dict" android:title="@string/use_contacts_dict" android:summary="@string/use_contacts_dict_summary" android:persistent="true" android:defaultValue="true" /> </PreferenceScreen> <!-- <Preference android:title="Debug Settings" Loading java/src/com/android/inputmethod/latin/LatinIME.java +9 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; private ContactsDictionary mContactsDictionary; private AutoDictionary mAutoDictionary; // TODO: Create an inner class to group options and pseudo-options to improve readability. Loading Loading @@ -407,6 +406,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (null == mSubtypeSwitcher) mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mSettingsValues = new Settings.Values(mPrefs, this, mSubtypeSwitcher.getInputLocaleStr()); resetContactsDictionary(); } private void initSuggest() { Loading @@ -429,8 +429,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mUserDictionary = new UserDictionary(this, localeStr); mSuggest.setUserDictionary(mUserDictionary); mContactsDictionary = new ContactsDictionary(this, Suggest.DIC_CONTACTS); mSuggest.setContactsDictionary(mContactsDictionary); resetContactsDictionary(); mAutoDictionary = new AutoDictionary(this, this, localeStr, Suggest.DIC_AUTO); mSuggest.setAutoDictionary(mAutoDictionary); Loading @@ -443,6 +442,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar Utils.setSystemLocale(res, savedLocale); } private void resetContactsDictionary() { if (null == mSuggest) return; ContactsDictionary contactsDictionary = mSettingsValues.mUseContactsDict ? new ContactsDictionary(this, Suggest.DIC_CONTACTS) : null; mSuggest.setContactsDictionary(contactsDictionary); } /* package private */ void resetSuggestMainDict() { final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final Locale keyboardLocale = Utils.constructLocaleFromString(localeStr); Loading java/src/com/android/inputmethod/latin/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class Settings extends PreferenceActivity public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY = "pref_key_preview_popup_dismiss_delay"; public static final String PREF_KEY_USE_CONTACTS_DICT = "pref_key_use_contacts_dict"; public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; Loading Loading @@ -114,6 +116,7 @@ public class Settings extends PreferenceActivity public final boolean mBigramSuggestionEnabled; // Prediction: use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled; public final boolean mUseContactsDict; public Values(final SharedPreferences prefs, final Context context, final String localeStr) { Loading Loading @@ -175,6 +178,8 @@ public class Settings extends PreferenceActivity mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); Utils.setSystemLocale(res, savedLocale); } Loading java/src/com/android/inputmethod/latin/Suggest.java +6 −1 Original line number Diff line number Diff line Loading @@ -184,12 +184,17 @@ public class Suggest implements Dictionary.WordCallback { } /** * Sets an optional contacts dictionary resource to be loaded. * Sets an optional contacts dictionary resource to be loaded. It is also possible to remove * the contacts dictionary by passing null to this method. In this case no contacts dictionary * won't be used. */ public void setContactsDictionary(Dictionary contactsDictionary) { if (contactsDictionary != null) { mUnigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary); mBigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary); } else { mUnigramDictionaries.remove(DICT_KEY_CONTACTS); mBigramDictionaries.remove(DICT_KEY_CONTACTS); } } Loading Loading
java/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ <!-- Description for delay for dismissing a popup on screen: default value of the delay [CHAR LIMIT=15] --> <string name="key_preview_popup_dismiss_default_delay">Default</string> <!-- Option name for enabling or disabling the use of names of people in Contacts for suggestion and correction [CHAR LIMIT=25] --> <string name="use_contacts_dict">Suggest Contact names</string> <!-- 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 to enable auto capitalization of sentences --> <string name="auto_cap">Auto-capitalization</string> Loading
java/res/xml/prefs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,12 @@ <ListPreference android:key="pref_key_preview_popup_dismiss_delay" android:title="@string/key_preview_popup_dismiss_delay" /> <CheckBoxPreference android:key="pref_key_use_contacts_dict" android:title="@string/use_contacts_dict" android:summary="@string/use_contacts_dict_summary" android:persistent="true" android:defaultValue="true" /> </PreferenceScreen> <!-- <Preference android:title="Debug Settings" Loading
java/src/com/android/inputmethod/latin/LatinIME.java +9 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; private ContactsDictionary mContactsDictionary; private AutoDictionary mAutoDictionary; // TODO: Create an inner class to group options and pseudo-options to improve readability. Loading Loading @@ -407,6 +406,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (null == mSubtypeSwitcher) mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mSettingsValues = new Settings.Values(mPrefs, this, mSubtypeSwitcher.getInputLocaleStr()); resetContactsDictionary(); } private void initSuggest() { Loading @@ -429,8 +429,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mUserDictionary = new UserDictionary(this, localeStr); mSuggest.setUserDictionary(mUserDictionary); mContactsDictionary = new ContactsDictionary(this, Suggest.DIC_CONTACTS); mSuggest.setContactsDictionary(mContactsDictionary); resetContactsDictionary(); mAutoDictionary = new AutoDictionary(this, this, localeStr, Suggest.DIC_AUTO); mSuggest.setAutoDictionary(mAutoDictionary); Loading @@ -443,6 +442,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar Utils.setSystemLocale(res, savedLocale); } private void resetContactsDictionary() { if (null == mSuggest) return; ContactsDictionary contactsDictionary = mSettingsValues.mUseContactsDict ? new ContactsDictionary(this, Suggest.DIC_CONTACTS) : null; mSuggest.setContactsDictionary(contactsDictionary); } /* package private */ void resetSuggestMainDict() { final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final Locale keyboardLocale = Utils.constructLocaleFromString(localeStr); Loading
java/src/com/android/inputmethod/latin/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class Settings extends PreferenceActivity public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY = "pref_key_preview_popup_dismiss_delay"; public static final String PREF_KEY_USE_CONTACTS_DICT = "pref_key_use_contacts_dict"; public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; Loading Loading @@ -114,6 +116,7 @@ public class Settings extends PreferenceActivity public final boolean mBigramSuggestionEnabled; // Prediction: use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled; public final boolean mUseContactsDict; public Values(final SharedPreferences prefs, final Context context, final String localeStr) { Loading Loading @@ -175,6 +178,8 @@ public class Settings extends PreferenceActivity mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); Utils.setSystemLocale(res, savedLocale); } Loading
java/src/com/android/inputmethod/latin/Suggest.java +6 −1 Original line number Diff line number Diff line Loading @@ -184,12 +184,17 @@ public class Suggest implements Dictionary.WordCallback { } /** * Sets an optional contacts dictionary resource to be loaded. * Sets an optional contacts dictionary resource to be loaded. It is also possible to remove * the contacts dictionary by passing null to this method. In this case no contacts dictionary * won't be used. */ public void setContactsDictionary(Dictionary contactsDictionary) { if (contactsDictionary != null) { mUnigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary); mBigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary); } else { mUnigramDictionaries.remove(DICT_KEY_CONTACTS); mBigramDictionaries.remove(DICT_KEY_CONTACTS); } } Loading