aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values/bools.xml1
-rw-r--r--java/res/values/strings.xml4
-rw-r--r--java/res/xml/prefs.xml7
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java38
4 files changed, 35 insertions, 15 deletions
diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml
index f5f2c3d0e..1f8051bfd 100644
--- a/java/res/values/bools.xml
+++ b/java/res/values/bools.xml
@@ -28,4 +28,5 @@
<bool name="config_swipeDisambiguation">true</bool>
<!-- Whether or not Popup on key press is enabled by default -->
<bool name="default_popup_preview">true</bool>
+ <bool name="default_recorrection_enabled">true</bool>
</resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 7b760f002..456151b62 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -339,6 +339,10 @@
<string name="prefs_enable_log">Enable user feedback</string>
<!-- Description for enabling to send user statistics to Google. -->
<string name="prefs_description_log">Help improve this input method editor by automatically sending usage statistics and crash reports to Google.</string>
+ <!-- Preferences item for enabling to re-correct suggestions . -->
+ <string name="prefs_enable_recorrection">Tap to re-correction</string>
+ <!-- The summary for the preferences item for enabling to re-correct suggestions . -->
+ <string name="prefs_enable_recorrection_summary">You can re-correct words by tapping words you have typed</string>
<!-- Description for keyboard theme switcher -->
<string name="keyboard_layout">Keyboard Theme</string>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index b4d2d903d..762ada00c 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -38,6 +38,13 @@
/>
<CheckBoxPreference
+ android:key="recorrection_enabled"
+ android:title="@string/prefs_enable_recorrection"
+ android:persistent="true"
+ android:defaultValue="@bool/default_recorrection_enabled"
+ />
+
+ <CheckBoxPreference
android:key="auto_cap"
android:title="@string/auto_cap"
android:persistent="true"
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));
}
}