aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/compat/SharedPreferencesCompat.java (renamed from java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java)2
-rw-r--r--java/src/com/android/inputmethod/deprecated/VoiceProxy.java2
-rw-r--r--java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java2
-rw-r--r--java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java2
-rw-r--r--java/src/com/android/inputmethod/deprecated/voice/Hints.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java11
-rw-r--r--java/src/com/android/inputmethod/keyboard/ProximityInfo.java7
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java14
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFactory.java25
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java162
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java18
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java16
12 files changed, 179 insertions, 84 deletions
diff --git a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java b/java/src/com/android/inputmethod/compat/SharedPreferencesCompat.java
index 1d36c0b98..38736f3a1 100644
--- a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java
+++ b/java/src/com/android/inputmethod/compat/SharedPreferencesCompat.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.inputmethod.latin;
+package com.android.inputmethod.compat;
import android.content.SharedPreferences;
diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
index a4dfa10d2..3f8c2ef8f 100644
--- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
+++ b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.deprecated;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
+import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.deprecated.voice.FieldContext;
import com.android.inputmethod.deprecated.voice.Hints;
import com.android.inputmethod.deprecated.voice.SettingsUtil;
@@ -28,7 +29,6 @@ import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinIME.UIHandler;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.SharedPreferencesCompat;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils;
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
index b6e0ec9cf..dbe7aec6a 100644
--- a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
@@ -16,12 +16,12 @@
package com.android.inputmethod.deprecated.languageswitcher;
+import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.keyboard.internal.KeyboardBuilder;
import com.android.inputmethod.latin.DictionaryFactory;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Settings;
-import com.android.inputmethod.latin.SharedPreferencesCompat;
import com.android.inputmethod.latin.Utils;
import org.xmlpull.v1.XmlPullParserException;
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
index 8070942d0..7e2627c81 100644
--- a/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
+++ b/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
@@ -16,11 +16,11 @@
package com.android.inputmethod.deprecated.languageswitcher;
+import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.Settings;
-import com.android.inputmethod.latin.SharedPreferencesCompat;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
diff --git a/java/src/com/android/inputmethod/deprecated/voice/Hints.java b/java/src/com/android/inputmethod/deprecated/voice/Hints.java
index 06b234381..17a19bf23 100644
--- a/java/src/com/android/inputmethod/deprecated/voice/Hints.java
+++ b/java/src/com/android/inputmethod/deprecated/voice/Hints.java
@@ -16,8 +16,8 @@
package com.android.inputmethod.deprecated.voice;
+import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.SharedPreferencesCompat;
import android.content.ContentResolver;
import android.content.Context;
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 13e8ba13c..837a53391 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -106,16 +106,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static final KeyboardSwitcher sInstance = new KeyboardSwitcher();
- public class KeyboardLayoutState {
+ private class KeyboardLayoutState {
private boolean mIsValid;
private boolean mIsAlphabetMode;
private boolean mIsShiftLocked;
private boolean mIsShifted;
- public boolean isValid() {
- return mIsValid;
- }
-
public void save() {
if (mCurrentId == null) {
return;
@@ -210,14 +206,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
mLayoutSwitchBackSymbols = mResources.getString(R.string.layout_switch_back_symbols);
setKeyboard(getKeyboard(mSavedKeyboardState.getKeyboardId()));
+ mSavedKeyboardState.restore();
} catch (RuntimeException e) {
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
LatinImeLogger.logOnException(mMainKeyboardId.toString(), e);
}
}
- public KeyboardLayoutState getKeyboardState() {
- return mSavedKeyboardState;
+ public void saveKeyboardState() {
+ mSavedKeyboardState.save();
}
public void onFinishInputView() {
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index d35b1a939..cc6feeb4a 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -19,6 +19,7 @@ package com.android.inputmethod.keyboard;
import android.graphics.Rect;
import com.android.inputmethod.keyboard.Key;
+import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.spellcheck.SpellCheckerProximityInfo;
@@ -31,6 +32,8 @@ public class ProximityInfo {
/** Number of key widths from current touch point to search for nearest keys. */
private static float SEARCH_DISTANCE = 1.2f;
private static final int[] EMPTY_INT_ARRAY = new int[0];
+ private static final String SUPPORT_TOUCH_POSITION_CORRECTION =
+ "SupportTouchPositionCorrection";
private final int mKeyHeight;
private final int mGridWidth;
@@ -120,8 +123,10 @@ public class ProximityInfo {
keyCharCodes[i] = key.mCode;
}
+ final SubtypeSwitcher switcher = SubtypeSwitcher.getInstance();
final boolean hasTouchPositionCorrectionData =
- mTouchPositionCorrectionXs != null
+ switcher.currentSubtypeContainsExtraValueKey(SUPPORT_TOUCH_POSITION_CORRECTION)
+ && mTouchPositionCorrectionXs != null
&& mTouchPositionCorrectionYs != null
&& mTouchPositionCorrectionRadii != null
&& mTouchPositionCorrectionXs.length > 0
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index ab9edb110..18a9e3ab1 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -61,16 +61,26 @@ public class BinaryDictionary extends Dictionary {
public static final Flag FLAG_REQUIRES_GERMAN_UMLAUT_PROCESSING =
new Flag(R.bool.config_require_umlaut_processing, 0x1);
+ // FULL_EDIT_DISTANCE is a flag that forces the dictionary to use full words
+ // when computing edit distance, instead of the default behavior of stopping
+ // the evaluation at the size the user typed.
public static final Flag FLAG_USE_FULL_EDIT_DISTANCE = new Flag(0x2);
// Can create a new flag from extravalue :
// public static final Flag FLAG_MYFLAG =
// new Flag("my_flag", 0x02);
- private static final Flag[] ALL_FLAGS = {
+ // ALL_CONFIG_FLAGS is a collection of flags that enable reading all flags from configuration.
+ // This is but a mask - it does not mean the flags will be on, only that the configuration
+ // will be read for this particular flag.
+ public static final Flag[] ALL_CONFIG_FLAGS = {
// Here should reside all flags that trigger some special processing
// These *must* match the definition in UnigramDictionary enum in
// unigram_dictionary.h so please update both at the same time.
+ // Please note that flags created with a resource are of type CONFIG while flags
+ // created with a string are of type EXTRAVALUE. These behave like masks, and the
+ // actual value will be read from the configuration/extra value at run time for
+ // the configuration at dictionary creation time.
FLAG_REQUIRES_GERMAN_UMLAUT_PROCESSING,
};
@@ -93,7 +103,7 @@ public class BinaryDictionary extends Dictionary {
// the Suggest class knows everything about every single dictionary.
mDicTypeId = Suggest.DIC_MAIN;
// TODO: Stop relying on the state of SubtypeSwitcher, get it as a parameter
- mFlags = Flag.initFlags(null == flagArray ? ALL_FLAGS : flagArray, context,
+ mFlags = Flag.initFlags(null == flagArray ? ALL_CONFIG_FLAGS : flagArray, context,
SubtypeSwitcher.getInstance());
loadDictionary(filename, offset, length);
}
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
index dfaad26bc..1607f86a8 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java
@@ -34,7 +34,7 @@ public class DictionaryFactory {
private static String TAG = DictionaryFactory.class.getSimpleName();
/**
- * Initializes a dictionary from a dictionary pack.
+ * Initializes a dictionary from a dictionary pack, with explicit flags.
*
* This searches for a content provider providing a dictionary pack for the specified
* locale. If none is found, it falls back to using the resource passed as fallBackResId
@@ -42,10 +42,11 @@ public class DictionaryFactory {
* @param context application context for reading resources
* @param locale the locale for which to create the dictionary
* @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @param flagArray an array of flags to use
* @return an initialized instance of DictionaryCollection
*/
- public static DictionaryCollection createDictionaryFromManager(Context context, Locale locale,
- int fallbackResId) {
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId, final Flag[] flagArray) {
if (null == locale) {
Log.e(TAG, "No locale defined for dictionary");
return new DictionaryCollection(createBinaryDictionary(context, fallbackResId, locale));
@@ -57,7 +58,7 @@ public class DictionaryFactory {
if (null != assetFileList) {
for (final AssetFileAddress f : assetFileList) {
final BinaryDictionary binaryDictionary =
- new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, null);
+ new BinaryDictionary(context, f.mFilename, f.mOffset, f.mLength, flagArray);
if (binaryDictionary.isValidDictionary()) {
dictList.add(binaryDictionary);
}
@@ -71,6 +72,22 @@ public class DictionaryFactory {
}
/**
+ * Initializes a dictionary from a dictionary pack, with default flags.
+ *
+ * This searches for a content provider providing a dictionary pack for the specified
+ * locale. If none is found, it falls back to using the resource passed as fallBackResId
+ * as a dictionary.
+ * @param context application context for reading resources
+ * @param locale the locale for which to create the dictionary
+ * @param fallbackResId the id of the resource to use as a fallback if no pack is found
+ * @return an initialized instance of DictionaryCollection
+ */
+ public static DictionaryCollection createDictionaryFromManager(final Context context,
+ final Locale locale, final int fallbackResId) {
+ return createDictionaryFromManager(context, locale, fallbackResId, null);
+ }
+
+ /**
* Initializes a dictionary from a raw resource file
* @param context application context for reading resources
* @param resId the resource containing the raw binary dictionary
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index cf1cb8f25..dfb4d0622 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -65,7 +65,6 @@ import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
-import com.android.inputmethod.keyboard.KeyboardSwitcher.KeyboardLayoutState;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
@@ -132,9 +131,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Key events coming any faster than this are long-presses.
private static final int QUICK_PRESS = 200;
- private static final int START_INPUT_VIEW_DELAY_WHEN_SCREEN_ORIENTATION_STARTED = 10;
- private static final int ACCUMULATE_START_INPUT_VIEW_DELAY = 20;
- private static final int RESTORE_KEYBOARD_STATE_DELAY = 500;
+ private static final int PENDING_IMS_CALLBACK_DURATION = 800;
/**
* The name of the scheme used by the Package Manager to warn of a new package installation,
@@ -239,10 +236,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private static final int MSG_DISMISS_LANGUAGE_ON_SPACEBAR = 5;
private static final int MSG_SPACE_TYPED = 6;
private static final int MSG_SET_BIGRAM_PREDICTIONS = 7;
- private static final int MSG_START_ORIENTATION_CHANGE = 8;
- private static final int MSG_START_INPUT_VIEW = 9;
- private static final int MSG_DISPLAY_COMPLETIONS = 10;
- private static final int MSG_RESTORE_KEYBOARD_LAYOUT = 11;
+ private static final int MSG_PENDING_IMS_CALLBACK = 8;
public UIHandler(LatinIME outerInstance) {
super(outerInstance);
@@ -291,16 +285,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
(LatinKeyboard)msg.obj);
}
break;
- case MSG_START_INPUT_VIEW:
- latinIme.onStartInputView((EditorInfo)msg.obj, false);
- break;
- case MSG_DISPLAY_COMPLETIONS:
- latinIme.onDisplayCompletions((CompletionInfo[])msg.obj);
- break;
- case MSG_RESTORE_KEYBOARD_LAYOUT:
- removeMessages(MSG_UPDATE_SHIFT_STATE);
- ((KeyboardLayoutState)msg.obj).restore();
- break;
}
}
@@ -391,47 +375,89 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return hasMessages(MSG_SPACE_TYPED);
}
- public void postRestoreKeyboardLayout() {
- final LatinIME latinIme = getOuterInstance();
- final KeyboardLayoutState state = latinIme.mKeyboardSwitcher.getKeyboardState();
- if (state.isValid()) {
- removeMessages(MSG_RESTORE_KEYBOARD_LAYOUT);
- sendMessageDelayed(
- obtainMessage(MSG_RESTORE_KEYBOARD_LAYOUT, state),
- RESTORE_KEYBOARD_STATE_DELAY);
- }
- }
+ // Working variables for the following methods.
+ private boolean mIsOrientationChanging;
+ private boolean mPendingSuccesiveImsCallback;
+ private boolean mHasPendingStartInput;
+ private boolean mHasPendingFinishInputView;
+ private boolean mHasPendingFinishInput;
public void startOrientationChanging() {
- sendMessageDelayed(obtainMessage(MSG_START_ORIENTATION_CHANGE),
- START_INPUT_VIEW_DELAY_WHEN_SCREEN_ORIENTATION_STARTED);
+ mIsOrientationChanging = true;
final LatinIME latinIme = getOuterInstance();
- latinIme.mKeyboardSwitcher.getKeyboardState().save();
- postRestoreKeyboardLayout();
+ latinIme.mKeyboardSwitcher.saveKeyboardState();
}
- public boolean postStartInputView(EditorInfo attribute) {
- if (hasMessages(MSG_START_ORIENTATION_CHANGE) || hasMessages(MSG_START_INPUT_VIEW)) {
- removeMessages(MSG_START_INPUT_VIEW);
- // Postpone onStartInputView by ACCUMULATE_START_INPUT_VIEW_DELAY and see if
- // orientation change has finished.
- sendMessageDelayed(obtainMessage(MSG_START_INPUT_VIEW, attribute),
- ACCUMULATE_START_INPUT_VIEW_DELAY);
- return true;
+ private void resetPendingImsCallback() {
+ mHasPendingFinishInputView = false;
+ mHasPendingFinishInput = false;
+ mHasPendingStartInput = false;
+ }
+
+ private void executePendingImsCallback(LatinIME latinIme, EditorInfo attribute,
+ boolean restarting) {
+ if (mHasPendingFinishInputView)
+ latinIme.onFinishInputViewInternal(mHasPendingFinishInput);
+ if (mHasPendingFinishInput)
+ latinIme.onFinishInputInternal();
+ if (mHasPendingStartInput)
+ latinIme.onStartInputInternal(attribute, restarting);
+ resetPendingImsCallback();
+ }
+
+ public void onStartInput(EditorInfo attribute, boolean restarting) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the second onStartInput after orientation changed.
+ mHasPendingStartInput = true;
+ } else {
+ if (mIsOrientationChanging && restarting) {
+ // This is the first onStartInput after orientation changed.
+ mIsOrientationChanging = false;
+ mPendingSuccesiveImsCallback = true;
+ }
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, attribute, restarting);
+ latinIme.onStartInputInternal(attribute, restarting);
}
- return false;
}
- public boolean postDisplayCompletions(CompletionInfo[] applicationSpecifiedCompletions) {
- if (hasMessages(MSG_START_INPUT_VIEW) || hasMessages(MSG_DISPLAY_COMPLETIONS)) {
- removeMessages(MSG_DISPLAY_COMPLETIONS);
- // Postpone onDisplayCompletions by ACCUMULATE_START_INPUT_VIEW_DELAY.
- sendMessageDelayed(
- obtainMessage(MSG_DISPLAY_COMPLETIONS, applicationSpecifiedCompletions),
- ACCUMULATE_START_INPUT_VIEW_DELAY);
- return true;
+ public void onStartInputView(EditorInfo attribute, boolean restarting) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the second onStartInputView after orientation changed.
+ resetPendingImsCallback();
+ } else {
+ if (mPendingSuccesiveImsCallback) {
+ // This is the first onStartInputView after orientation changed.
+ mPendingSuccesiveImsCallback = false;
+ resetPendingImsCallback();
+ sendMessageDelayed(obtainMessage(MSG_PENDING_IMS_CALLBACK),
+ PENDING_IMS_CALLBACK_DURATION);
+ }
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, attribute, restarting);
+ latinIme.onStartInputViewInternal(attribute, restarting);
+ }
+ }
+
+ public void onFinishInputView(boolean finishingInput) {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the first onFinishInputView after orientation changed.
+ mHasPendingFinishInputView = true;
+ } else {
+ final LatinIME latinIme = getOuterInstance();
+ latinIme.onFinishInputViewInternal(finishingInput);
+ }
+ }
+
+ public void onFinishInput() {
+ if (hasMessages(MSG_PENDING_IMS_CALLBACK)) {
+ // Typically this is the first onFinishInput after orientation changed.
+ mHasPendingFinishInput = true;
+ } else {
+ final LatinIME latinIme = getOuterInstance();
+ executePendingImsCallback(latinIme, null, false);
+ latinIme.onFinishInputInternal();
}
- return false;
}
}
@@ -646,12 +672,31 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
@Override
+ public void onStartInput(EditorInfo attribute, boolean restarting) {
+ mHandler.onStartInput(attribute, restarting);
+ }
+
+ @Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
- mHandler.postRestoreKeyboardLayout();
- if (mHandler.postStartInputView(attribute)) {
- return;
- }
+ mHandler.onStartInputView(attribute, restarting);
+ }
+ @Override
+ public void onFinishInputView(boolean finishingInput) {
+ mHandler.onFinishInputView(finishingInput);
+ }
+
+ @Override
+ public void onFinishInput() {
+ mHandler.onFinishInput();
+ }
+
+ private void onStartInputInternal(EditorInfo attribute, boolean restarting) {
+ super.onStartInput(attribute, restarting);
+ }
+
+ private void onStartInputViewInternal(EditorInfo attribute, boolean restarting) {
+ super.onStartInputView(attribute, restarting);
final KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getKeyboardView();
@@ -785,8 +830,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (inputView != null) inputView.closing();
}
- @Override
- public void onFinishInput() {
+ private void onFinishInputInternal() {
super.onFinishInput();
LatinImeLogger.commit();
@@ -799,8 +843,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites();
}
- @Override
- public void onFinishInputView(boolean finishingInput) {
+ private void onFinishInputViewInternal(boolean finishingInput) {
super.onFinishInputView(finishingInput);
mKeyboardSwitcher.onFinishInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
@@ -939,9 +982,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onDisplayCompletions(CompletionInfo[] applicationSpecifiedCompletions) {
- if (mHandler.postDisplayCompletions(applicationSpecifiedCompletions)) {
- return;
- }
if (DEBUG) {
Log.i(TAG, "Received completions:");
if (applicationSpecifiedCompletions != null) {
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index a2e896619..bd94bab34 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -328,6 +328,7 @@ public class Settings extends InputMethodSettingsActivity
}
private PreferenceScreen mInputLanguageSelection;
+ private PreferenceScreen mVibrationDurationSettingsPref;
private ListPreference mVoicePreference;
private CheckBoxPreference mShowSettingsKeyPreference;
private ListPreference mShowCorrectionSuggestionsPreference;
@@ -483,10 +484,10 @@ public class Settings extends InputMethodSettingsActivity
}
}
- final PreferenceScreen vibrationSettingsPref =
+ mVibrationDurationSettingsPref =
(PreferenceScreen) findPreference(PREF_VIBRATION_DURATION_SETTINGS);
- if (vibrationSettingsPref != null) {
- vibrationSettingsPref.setOnPreferenceClickListener(
+ if (mVibrationDurationSettingsPref != null) {
+ mVibrationDurationSettingsPref.setOnPreferenceClickListener(
new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
@@ -494,6 +495,7 @@ public class Settings extends InputMethodSettingsActivity
return true;
}
});
+ updateVibrationDurationSettingsSummary(prefs, res);
}
}
@@ -642,9 +644,18 @@ public class Settings extends InputMethodSettingsActivity
}
}
+ private void updateVibrationDurationSettingsSummary(SharedPreferences sp, Resources res) {
+ if (mVibrationDurationSettingsPref != null) {
+ mVibrationDurationSettingsPref.setSummary(
+ Utils.getCurrentVibrationDuration(sp, res)
+ + res.getString(R.string.settings_ms));
+ }
+ }
+
private void showVibrationSettingsDialog() {
final SharedPreferences sp = getPreferenceManager().getSharedPreferences();
final Activity context = getActivityInternal();
+ final Resources res = context.getResources();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.prefs_vibration_duration_settings);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@@ -652,6 +663,7 @@ public class Settings extends InputMethodSettingsActivity
public void onClick(DialogInterface dialog, int whichButton) {
final int ms = Integer.valueOf(mVibrationSettingsTextView.getText().toString());
sp.edit().putInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, ms).apply();
+ updateVibrationDurationSettingsSummary(sp, res);
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 1d5986ef9..9e030eb90 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -28,11 +28,13 @@ import android.text.TextUtils;
import com.android.inputmethod.compat.ArraysCompatUtils;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.ProximityInfo;
+import com.android.inputmethod.latin.BinaryDictionary;
import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.Dictionary.DataType;
import com.android.inputmethod.latin.Dictionary.WordCallback;
import com.android.inputmethod.latin.DictionaryCollection;
import com.android.inputmethod.latin.DictionaryFactory;
+import com.android.inputmethod.latin.Flag;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SynchronouslyLoadedUserDictionary;
@@ -65,6 +67,17 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS =
new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
EMPTY_STRING_ARRAY);
+ private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY;
+ static {
+ // See BinaryDictionary.java for an explanation of these flags
+ // Specifially, ALL_CONFIG_FLAGS means that we want to consider all flags with the
+ // current dictionary configuration - for example, consider the UMLAUT flag
+ // so that it will be turned on for German dictionaries and off for others.
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY = Arrays.copyOf(BinaryDictionary.ALL_CONFIG_FLAGS,
+ BinaryDictionary.ALL_CONFIG_FLAGS.length + 1);
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY[BinaryDictionary.ALL_CONFIG_FLAGS.length] =
+ BinaryDictionary.FLAG_USE_FULL_EDIT_DISTANCE;
+ }
private Map<String, DictionaryPool> mDictionaryPools =
Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
private Map<String, Dictionary> mUserDictionaries =
@@ -263,7 +276,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final Resources resources = getResources();
final int fallbackResourceId = Utils.getMainDictionaryResourceId(resources);
final DictionaryCollection dictionaryCollection =
- DictionaryFactory.createDictionaryFromManager(this, locale, fallbackResourceId);
+ DictionaryFactory.createDictionaryFromManager(this, locale, fallbackResourceId,
+ USE_FULL_EDIT_DISTANCE_FLAG_ARRAY);
final String localeStr = locale.toString();
Dictionary userDict = mUserDictionaries.get(localeStr);
if (null == userDict) {