Cleanup, part 8 (C8)
Change-Id: Iecc9b3d43c191614c2951408e14085cb77eefd4d
This commit is contained in:
parent
2f3a694e29
commit
ca6b7d5265
2 changed files with 11 additions and 16 deletions
|
@ -452,7 +452,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
oldContactsDictionary = null;
|
oldContactsDictionary = null;
|
||||||
}
|
}
|
||||||
mSuggest = new Suggest(this, subtypeLocale);
|
mSuggest = new Suggest(this, subtypeLocale);
|
||||||
if (mCurrentSettings.isCorrectionOn()) {
|
if (mCurrentSettings.mCorrectionEnabled) {
|
||||||
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
|
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
if (mSuggest != null && mCurrentSettings.isCorrectionOn()) {
|
if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) {
|
||||||
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
|
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,8 +1557,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// not to auto correct, but accept the typed word. For instance,
|
// not to auto correct, but accept the typed word. For instance,
|
||||||
// in Italian dov' should not be expanded to dove' because the elision
|
// in Italian dov' should not be expanded to dove' because the elision
|
||||||
// requires the last vowel to be removed.
|
// requires the last vowel to be removed.
|
||||||
final boolean shouldAutoCorrect = mCurrentSettings.isCorrectionOn();
|
if (mCurrentSettings.mCorrectionEnabled && primaryCode != Keyboard.CODE_SINGLE_QUOTE) {
|
||||||
if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) {
|
|
||||||
commitCurrentAutoCorrection(primaryCode);
|
commitCurrentAutoCorrection(primaryCode);
|
||||||
didAutoCorrect = true;
|
didAutoCorrect = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1712,7 +1711,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// getSuggestedWords handles gracefully a null value of prevWord
|
// getSuggestedWords handles gracefully a null value of prevWord
|
||||||
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
|
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
|
||||||
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
|
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
|
||||||
mCurrentSettings.isCorrectionOn());
|
mCurrentSettings.mCorrectionEnabled);
|
||||||
|
|
||||||
// Basically, we update the suggestion strip only when suggestion count > 1. However,
|
// Basically, we update the suggestion strip only when suggestion count > 1. However,
|
||||||
// there is an exception: We update the suggestion strip whenever typed word's length
|
// there is an exception: We update the suggestion strip whenever typed word's length
|
||||||
|
@ -1926,7 +1925,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
final SuggestedWords suggestedWords;
|
final SuggestedWords suggestedWords;
|
||||||
if (mCurrentSettings.isCorrectionOn()) {
|
if (mCurrentSettings.mCorrectionEnabled) {
|
||||||
final CharSequence prevWord = mConnection.getThisWord(mCurrentSettings.mWordSeparators);
|
final CharSequence prevWord = mConnection.getThisWord(mCurrentSettings.mWordSeparators);
|
||||||
if (!TextUtils.isEmpty(prevWord)) {
|
if (!TextUtils.isEmpty(prevWord)) {
|
||||||
suggestedWords = mSuggest.getBigramPredictions(prevWord);
|
suggestedWords = mSuggest.getBigramPredictions(prevWord);
|
||||||
|
@ -1959,10 +1958,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private CharSequence addToUserHistoryDictionary(final CharSequence suggestion) {
|
private CharSequence addToUserHistoryDictionary(final CharSequence suggestion) {
|
||||||
if (TextUtils.isEmpty(suggestion)) return null;
|
if (TextUtils.isEmpty(suggestion)) return null;
|
||||||
|
|
||||||
// Only auto-add to dictionary if auto-correct is ON. Otherwise we'll be
|
// If correction is not enabled, we don't add words to the user history dictionary.
|
||||||
// adding words in situations where the user or application really didn't
|
// That's to avoid unintended additions in some sensitive fields, or fields that
|
||||||
// want corrections enabled or learned.
|
// expect to receive non-words.
|
||||||
if (!mCurrentSettings.isCorrectionOn()) return null;
|
if (!mCurrentSettings.mCorrectionEnabled) return null;
|
||||||
|
|
||||||
if (mUserHistoryDictionary != null) {
|
if (mUserHistoryDictionary != null) {
|
||||||
final CharSequence prevWord
|
final CharSequence prevWord
|
||||||
|
@ -2220,7 +2219,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
+ mCurrentSettings.isSuggestionsRequested(mDisplayOrientation));
|
+ mCurrentSettings.isSuggestionsRequested(mDisplayOrientation));
|
||||||
p.println(" mCorrectionEnabled=" + mCurrentSettings.mCorrectionEnabled);
|
p.println(" mCorrectionEnabled=" + mCurrentSettings.mCorrectionEnabled);
|
||||||
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
|
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
|
||||||
p.println(" isCorrectionOn=" + mCurrentSettings.isCorrectionOn());
|
|
||||||
p.println(" mSoundOn=" + mCurrentSettings.mSoundOn);
|
p.println(" mSoundOn=" + mCurrentSettings.mSoundOn);
|
||||||
p.println(" mVibrateOn=" + mCurrentSettings.mVibrateOn);
|
p.println(" mVibrateOn=" + mCurrentSettings.mVibrateOn);
|
||||||
p.println(" mKeyPreviewPopupOn=" + mCurrentSettings.mKeyPreviewPopupOn);
|
p.println(" mKeyPreviewPopupOn=" + mCurrentSettings.mKeyPreviewPopupOn);
|
||||||
|
|
|
@ -233,11 +233,8 @@ public class SettingsValues {
|
||||||
|
|
||||||
public boolean isSuggestionsRequested(final int displayOrientation) {
|
public boolean isSuggestionsRequested(final int displayOrientation) {
|
||||||
return mInputAttributes.mIsSettingsSuggestionStripOn
|
return mInputAttributes.mIsSettingsSuggestionStripOn
|
||||||
&& (isCorrectionOn() || isSuggestionStripVisibleInOrientation(displayOrientation));
|
&& (mCorrectionEnabled
|
||||||
}
|
|| isSuggestionStripVisibleInOrientation(displayOrientation));
|
||||||
|
|
||||||
public boolean isCorrectionOn() {
|
|
||||||
return mCorrectionEnabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuggestionStripVisibleInOrientation(final int orientation) {
|
public boolean isSuggestionStripVisibleInOrientation(final int orientation) {
|
||||||
|
|
Loading…
Reference in a new issue