aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-08 22:09:20 +0900
committerJean Chalard <jchalard@google.com>2012-06-12 10:29:55 +0900
commit140adf204bdf68e25a760b371516e23f6ac51cf2 (patch)
tree092b360d63ad400df359340ad4e248ecc2e18586 /java/src
parent2010aad741bc1a7266913bcb8b8348d6e401c95b (diff)
downloadlatinime-140adf204bdf68e25a760b371516e23f6ac51cf2.tar.gz
latinime-140adf204bdf68e25a760b371516e23f6ac51cf2.tar.xz
latinime-140adf204bdf68e25a760b371516e23f6ac51cf2.zip
Consolidate auto-correction settings.
For some reason, there were several ways, not exactly identical, to get this setting. The ones that used mAutoCorrectionEnabled would kick in when the input field was specifying no correction, so it would be a little strange (although harmless in the practice because the settings set in this way would not get used later, because the correct test would be done at that time). Also perform a very small refactoring Change-Id: Ica9f32b238d98009ae1852d3c1e940398f5d341c
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java2
2 files changed, 8 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 94e0ac836..4670bedb4 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -449,7 +449,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
oldContactsDictionary = null;
}
mSuggest = new Suggest(this, subtypeLocale);
- if (mCurrentSettings.mAutoCorrectEnabled) {
+ if (mCurrentSettings.isCorrectionOn()) {
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
}
@@ -680,7 +680,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadSettings();
- if (mSuggest != null && mCurrentSettings.mAutoCorrectEnabled) {
+ if (mSuggest != null && mCurrentSettings.isCorrectionOn()) {
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
}
@@ -1553,8 +1553,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// not to auto correct, but accept the typed word. For instance,
// in Italian dov' should not be expanded to dove' because the elision
// requires the last vowel to be removed.
- final boolean shouldAutoCorrect = mCurrentSettings.mAutoCorrectEnabled
- && !mInputAttributes.mInputTypeNoAutoCorrect;
+ final boolean shouldAutoCorrect = mCurrentSettings.isCorrectionOn();
if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) {
commitCurrentAutoCorrection(primaryCode);
didAutoCorrect = true;
@@ -1914,14 +1913,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
this, chosenWord, suggestedWords, mIsMainDictionaryAvailable),
1);
- if (ProductionFlag.IS_EXPERIMENTAL) {
- ResearchLogger.latinIME_commitText(chosenWord);
- }
} else {
mConnection.commitText(chosenWord, 1);
- if (ProductionFlag.IS_EXPERIMENTAL) {
- ResearchLogger.latinIME_commitText(chosenWord);
- }
+ }
+ if (ProductionFlag.IS_EXPERIMENTAL) {
+ ResearchLogger.latinIME_commitText(chosenWord);
}
// Add the word to the user history dictionary
final CharSequence prevWord = addToUserHistoryDictionary(chosenWord);
@@ -2231,7 +2227,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
p.println(" mIsSuggestionsRequested=" + mInputAttributes.mIsSettingsSuggestionStripOn);
p.println(" mCorrectionMode=" + mCurrentSettings.mCorrectionMode);
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
- p.println(" mAutoCorrectEnabled=" + mCurrentSettings.mAutoCorrectEnabled);
+ p.println(" isCorrectionOn=" + mCurrentSettings.isCorrectionOn());
p.println(" mSoundOn=" + mCurrentSettings.mSoundOn);
p.println(" mVibrateOn=" + mCurrentSettings.mVibrateOn);
p.println(" mKeyPreviewPopupOn=" + mCurrentSettings.mKeyPreviewPopupOn);
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 10094b5ad..6a79aa611 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -91,7 +91,7 @@ public class SettingsValues {
public final int mKeypressVibrationDuration;
public final float mFxVolume;
public final int mKeyPreviewPopupDismissDelay;
- public final boolean mAutoCorrectEnabled;
+ private final boolean mAutoCorrectEnabled;
public final float mAutoCorrectionThreshold;
public final int mCorrectionMode;
public final int mSuggestionVisibility;