aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-09-06 23:25:54 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-06 23:25:54 -0700
commit36d2d0e736605141006108d573614ab3343a0600 (patch)
tree57b65f6c5cb8db68b562552cdead9c34607b0b8c /java/src
parented34cd19a93528c960380d57e024f49cb17d5e5f (diff)
parent0723056043adee17bc9b49b06a5ca7a81a804d16 (diff)
downloadlatinime-36d2d0e736605141006108d573614ab3343a0600.tar.gz
latinime-36d2d0e736605141006108d573614ab3343a0600.tar.xz
latinime-36d2d0e736605141006108d573614ab3343a0600.zip
am 07230560: Merge "Add shared preference for re-correction" into gingerbread
Merge commit '0723056043adee17bc9b49b06a5ca7a81a804d16' into gingerbread-plus-aosp * commit '0723056043adee17bc9b49b06a5ca7a81a804d16': Add shared preference for re-correction
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java38
1 files changed, 23 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 2cff232a6..e5c6a54ce 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -127,6 +127,7 @@ public class LatinIME extends InputMethodService
public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
public static final String PREF_INPUT_LANGUAGE = "input_language";
+ private static final String PREF_RECORRECTION_ENABLED = "recorrection_enabled";
private static final int MSG_UPDATE_SUGGESTIONS = 0;
private static final int MSG_START_TUTORIAL = 1;
@@ -193,6 +194,7 @@ public class LatinIME extends InputMethodService
private boolean mAutoSpace;
private boolean mJustAddedAutoSpace;
private boolean mAutoCorrectEnabled;
+ private boolean mReCorrectionEnabled;
// Bigram Suggestion is disabled in this version.
private final boolean mBigramSuggestionEnabled = false;
private boolean mAutoCorrectOn;
@@ -361,6 +363,8 @@ public class LatinIME extends InputMethodService
if (inputLanguage == null) {
inputLanguage = conf.locale.toString();
}
+ mReCorrectionEnabled = prefs.getBoolean(PREF_RECORRECTION_ENABLED,
+ getResources().getBoolean(R.bool.default_recorrection_enabled));
LatinIMEUtil.GCUtils.getInstance().reset();
boolean tryGC = true;
@@ -769,21 +773,22 @@ public class LatinIME extends InputMethodService
mLastSelectionStart = newSelStart;
mLastSelectionEnd = newSelEnd;
-
- // Don't look for corrections if the keyboard is not visible
- if (mKeyboardSwitcher != null && mKeyboardSwitcher.getInputView() != null
- && mKeyboardSwitcher.getInputView().isShown()) {
- // Check if we should go in or out of correction mode.
- if (isPredictionOn()
- && mJustRevertedSeparator == null
- && (candidatesStart == candidatesEnd || newSelStart != oldSelStart
- || TextEntryState.isCorrecting())
- && (newSelStart < newSelEnd - 1 || (!mPredicting))
- && !mVoiceInputHighlighted) {
- if (isCursorTouchingWord() || mLastSelectionStart < mLastSelectionEnd) {
- postUpdateOldSuggestions();
- } else {
- abortCorrection(false);
+ if (mReCorrectionEnabled) {
+ // Don't look for corrections if the keyboard is not visible
+ if (mKeyboardSwitcher != null && mKeyboardSwitcher.getInputView() != null
+ && mKeyboardSwitcher.getInputView().isShown()) {
+ // Check if we should go in or out of correction mode.
+ if (isPredictionOn()
+ && mJustRevertedSeparator == null
+ && (candidatesStart == candidatesEnd || newSelStart != oldSelStart
+ || TextEntryState.isCorrecting())
+ && (newSelStart < newSelEnd - 1 || (!mPredicting))
+ && !mVoiceInputHighlighted) {
+ if (isCursorTouchingWord() || mLastSelectionStart < mLastSelectionEnd) {
+ postUpdateOldSuggestions();
+ } else {
+ abortCorrection(false);
+ }
}
}
}
@@ -2181,6 +2186,9 @@ public class LatinIME extends InputMethodService
if (PREF_SELECTED_LANGUAGES.equals(key)) {
mLanguageSwitcher.loadLocales(sharedPreferences);
mRefreshKeyboardRequired = true;
+ } else if (PREF_RECORRECTION_ENABLED.equals(key)) {
+ mReCorrectionEnabled = sharedPreferences.getBoolean(PREF_RECORRECTION_ENABLED,
+ getResources().getBoolean(R.bool.default_recorrection_enabled));
}
}