am 752d8cc4: Fix a bug with TYPE_TEXT_CLASS

* commit '752d8cc4fc8550e5ec4eee921f5d611c49f57497':
  Fix a bug with TYPE_TEXT_CLASS
main
Jean Chalard 2011-12-19 23:03:01 -08:00 committed by Android Git Automerger
commit fd54ee23c3
1 changed files with 17 additions and 12 deletions

View File

@ -34,25 +34,30 @@ public class InputAttributes {
final public boolean mApplicationSpecifiedCompletionOn; final public boolean mApplicationSpecifiedCompletionOn;
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) { public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) {
if (editorInfo == null || editorInfo.inputType == InputType.TYPE_CLASS_TEXT) { final int inputType = null != editorInfo ? editorInfo.inputType : 0;
mInsertSpaceOnPickSuggestionManually = false; final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
mIsSettingsSuggestionStripOn = false; if (inputClass != InputType.TYPE_CLASS_TEXT) {
mInputTypeNoAutoCorrect = false; // If we are not looking at a TYPE_CLASS_TEXT field, the following strange
mApplicationSpecifiedCompletionOn = false; // cases may arise, so we do a couple sanity checks for them. If it's a
} else { // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
final int inputType = editorInfo.inputType; // of the flags.
if (inputType == InputType.TYPE_NULL) { if (null == editorInfo) {
Log.w(TAG, "No editor info for this field. Bug?");
} else if (InputType.TYPE_NULL == inputType) {
// TODO: We should honor TYPE_NULL specification. // TODO: We should honor TYPE_NULL specification.
Log.i(TAG, "InputType.TYPE_NULL is specified"); Log.i(TAG, "InputType.TYPE_NULL is specified");
} } else if (inputClass == 0) {
final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
final int variation = inputType & InputType.TYPE_MASK_VARIATION;
if (inputClass == 0) {
// TODO: is this check still necessary? // TODO: is this check still necessary?
Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
+ " imeOptions=0x%08x", + " imeOptions=0x%08x",
inputType, editorInfo.imeOptions)); inputType, editorInfo.imeOptions));
} }
mInsertSpaceOnPickSuggestionManually = false;
mIsSettingsSuggestionStripOn = false;
mInputTypeNoAutoCorrect = false;
mApplicationSpecifiedCompletionOn = false;
} else {
final int variation = inputType & InputType.TYPE_MASK_VARIATION;
final boolean flagNoSuggestions = final boolean flagNoSuggestions =
0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
final boolean flagMultiLine = final boolean flagMultiLine =