Refactoring.
Small simplification of the code. Change-Id: I1f67ae529bbb2c9316bf5e083d367c57040ea22c
This commit is contained in:
parent
e35e13fc7d
commit
b588003426
1 changed files with 15 additions and 17 deletions
|
@ -1586,7 +1586,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
mHandler.postUpdateSuggestions();
|
mHandler.postUpdateSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean pickedDefault = false;
|
|
||||||
// Handle separator
|
// Handle separator
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
if (ic != null) {
|
if (ic != null) {
|
||||||
|
@ -1603,13 +1602,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled
|
final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled
|
||||||
&& !mInputTypeNoAutoCorrect;
|
&& !mInputTypeNoAutoCorrect;
|
||||||
if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) {
|
if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) {
|
||||||
pickedDefault = pickDefaultSuggestion(primaryCode);
|
final boolean pickedDefaultSuggestion = pickDefaultSuggestion(primaryCode);
|
||||||
} else {
|
if (pickedDefaultSuggestion) {
|
||||||
commitTyped(ic);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pickedDefault) {
|
|
||||||
final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull();
|
final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull();
|
||||||
final String typedWord = mWordComposer.getTypedWord();
|
final String typedWord = mWordComposer.getTypedWord();
|
||||||
if (TextUtils.isEmpty(typedWord)) {
|
if (TextUtils.isEmpty(typedWord)) {
|
||||||
|
@ -1619,8 +1613,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
if (!typedWord.equals(autoCorrection)) {
|
if (!typedWord.equals(autoCorrection)) {
|
||||||
// This will make the correction flash for a short while as a visual clue
|
// This will make the correction flash for a short while as a visual clue
|
||||||
// to the user that auto-correction happened.
|
// to the user that auto-correction happened.
|
||||||
InputConnectionCompatUtils.commitCorrection(
|
InputConnectionCompatUtils.commitCorrection(ic,
|
||||||
ic, mLastSelectionEnd - typedWord.length(), typedWord, autoCorrection);
|
mLastSelectionEnd - typedWord.length(), typedWord, autoCorrection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commitTyped(ic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue