aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java39
1 files changed, 29 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 187252a31..caa7f9312 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -140,6 +140,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
*/
private static final String SCHEME_PACKAGE = "package";
+ /** Whether to use the binary version of the contacts dictionary */
+ public static final boolean USE_BINARY_CONTACTS_DICTIONARY = true;
+
// TODO: migrate this to SettingsValues
private int mSuggestionVisibility;
private static final int SUGGESTION_VISIBILILTY_SHOW_VALUE
@@ -439,6 +442,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadSettings();
+ mImm.setAdditionalInputMethodSubtypes(
+ SubtypeUtils.getInputMethodId(getPackageName()),
+ mSettingsValues.getPrefefinedAdditionalSubtypes());
+
// TODO: remove the following when it's not needed by updateCorrectionMode() any more
mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */);
updateCorrectionMode();
@@ -493,14 +500,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final String localeStr = mSubtypeSwitcher.getInputLocaleStr();
final Locale keyboardLocale = mSubtypeSwitcher.getInputLocale();
- final ContactsDictionary oldContactsDictionary;
+ final Dictionary oldContactsDictionary;
if (mSuggest != null) {
oldContactsDictionary = mSuggest.getContactsDictionary();
mSuggest.close();
} else {
oldContactsDictionary = null;
}
-
mSuggest = new Suggest(this, keyboardLocale);
if (mSettingsValues.mAutoCorrectEnabled) {
mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
@@ -526,10 +532,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
*
* @param oldContactsDictionary an optional dictionary to use, or null
*/
- private void resetContactsDictionary(final ContactsDictionary oldContactsDictionary) {
+ private void resetContactsDictionary(final Dictionary oldContactsDictionary) {
final boolean shouldSetDictionary = (null != mSuggest && mSettingsValues.mUseContactsDict);
- final ContactsDictionary dictionaryToUse;
+ final Dictionary dictionaryToUse;
if (!shouldSetDictionary) {
// Make sure the dictionary is closed. If it is already closed, this is a no-op,
// so it's safe to call it anyways.
@@ -538,10 +544,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} else if (null != oldContactsDictionary) {
// Make sure the old contacts dictionary is opened. If it is already open, this is a
// no-op, so it's safe to call it anyways.
- oldContactsDictionary.reopen(this);
+ if (USE_BINARY_CONTACTS_DICTIONARY) {
+ ((ContactsBinaryDictionary)oldContactsDictionary).reopen(this);
+ } else {
+ ((ContactsDictionary)oldContactsDictionary).reopen(this);
+ }
dictionaryToUse = oldContactsDictionary;
} else {
- dictionaryToUse = new ContactsDictionary(this, Suggest.DIC_CONTACTS);
+ if (USE_BINARY_CONTACTS_DICTIONARY) {
+ dictionaryToUse = new ContactsBinaryDictionary(this, Suggest.DIC_CONTACTS,
+ mSubtypeSwitcher.getInputLocale());
+ } else {
+ dictionaryToUse = new ContactsDictionary(this, Suggest.DIC_CONTACTS);
+ }
}
if (null != mSuggest) {
@@ -1783,6 +1798,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
+ "is empty? Impossible! I must commit suicide.");
}
Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCodePoint);
+ if (ProductionFlag.IS_EXPERIMENTAL) {
+ ResearchLogger.LatinIME_commitCurrentAutoCorrection(typedWord,
+ autoCorrection.toString());
+ }
mExpectingUpdateSelection = true;
commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD,
separatorCodePoint);
@@ -2222,15 +2241,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- protected void launchSettings() {
- launchSettingsClass(Settings.class);
+ private void launchSettings() {
+ launchSettingsClass(SettingsActivity.class);
}
public void launchDebugSettings() {
- launchSettingsClass(DebugSettings.class);
+ launchSettingsClass(DebugSettingsActivity.class);
}
- protected void launchSettingsClass(Class<? extends PreferenceActivity> settingsClass) {
+ private void launchSettingsClass(Class<? extends PreferenceActivity> settingsClass) {
handleClose();
Intent intent = new Intent();
intent.setClass(LatinIME.this, settingsClass);