am 1ba17f97: Small refactoring

* commit '1ba17f97d51ad34e6d8015a22d6bc6afd3eeb321':
  Small refactoring
main
Jean Chalard 2011-12-16 01:34:04 -08:00 committed by Android Git Automerger
commit 135336f643
1 changed files with 12 additions and 5 deletions

View File

@ -819,6 +819,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
+ " imeOptions=0x%08x", + " imeOptions=0x%08x",
inputType, editorInfo.imeOptions)); inputType, editorInfo.imeOptions));
} }
final boolean flagNoSuggestions =
0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
final boolean flagMultiLine =
0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE);
final boolean flagAutoCorrect =
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
final boolean flagAutoComplete =
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
mApplicationSpecifiedCompletions = null; mApplicationSpecifiedCompletions = null;
@ -845,22 +853,21 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} else if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) { } else if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) {
// If it's a browser edit field and auto correct is not ON explicitly, then // If it's a browser edit field and auto correct is not ON explicitly, then
// disable auto correction, but keep suggestions on. // disable auto correction, but keep suggestions on.
if ((inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0) { if (!flagAutoCorrect) {
inputTypeNoAutoCorrect = true; inputTypeNoAutoCorrect = true;
} }
} }
// If NO_SUGGESTIONS is set, don't do prediction. // If NO_SUGGESTIONS is set, don't do prediction.
if ((inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) != 0) { if (flagNoSuggestions) {
isSettingsSuggestionStripOn = false; isSettingsSuggestionStripOn = false;
inputTypeNoAutoCorrect = true; inputTypeNoAutoCorrect = true;
} }
// If it's not multiline and the autoCorrect flag is not set, then don't correct // If it's not multiline and the autoCorrect flag is not set, then don't correct
if ((inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0 if (!flagAutoCorrect && !flagMultiLine) {
&& (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) == 0) {
inputTypeNoAutoCorrect = true; inputTypeNoAutoCorrect = true;
} }
if ((inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) { if (flagAutoComplete) {
isSettingsSuggestionStripOn = false; isSettingsSuggestionStripOn = false;
applicationSpecifiedCompletionOn = isFullscreenMode(); applicationSpecifiedCompletionOn = isFullscreenMode();
} }