am 80b66bb1: General cleanup.

* commit '80b66bb166f7f45adfcadcb84788477df9930828':
  General cleanup.
main
Jean Chalard 2011-12-16 03:44:27 -08:00 committed by Android Git Automerger
commit 8c9461425c
2 changed files with 14 additions and 28 deletions

View File

@ -34,16 +34,11 @@ 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) {
final boolean insertSpaceOnPickSuggestionManually;
final boolean inputTypeNoAutoCorrect;
final boolean isSettingsSuggestionStripOn;
final boolean applicationSpecifiedCompletionOn;
if (editorInfo == null || editorInfo.inputType == InputType.TYPE_CLASS_TEXT) { if (editorInfo == null || editorInfo.inputType == InputType.TYPE_CLASS_TEXT) {
insertSpaceOnPickSuggestionManually = false; mInsertSpaceOnPickSuggestionManually = false;
isSettingsSuggestionStripOn = false; mIsSettingsSuggestionStripOn = false;
inputTypeNoAutoCorrect = false; mInputTypeNoAutoCorrect = false;
applicationSpecifiedCompletionOn = false; mApplicationSpecifiedCompletionOn = false;
} else { } else {
final int inputType = editorInfo.inputType; final int inputType = editorInfo.inputType;
if (inputType == InputType.TYPE_NULL) { if (inputType == InputType.TYPE_NULL) {
@ -53,6 +48,7 @@ public class InputAttributes {
final int inputClass = inputType & InputType.TYPE_MASK_CLASS; final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
final int variation = inputType & InputType.TYPE_MASK_VARIATION; final int variation = inputType & InputType.TYPE_MASK_VARIATION;
if (inputClass == 0) { if (inputClass == 0) {
// 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));
@ -74,18 +70,18 @@ public class InputAttributes {
|| InputType.TYPE_TEXT_VARIATION_FILTER == variation || InputType.TYPE_TEXT_VARIATION_FILTER == variation
|| flagNoSuggestions || flagNoSuggestions
|| flagAutoComplete) { || flagAutoComplete) {
isSettingsSuggestionStripOn = false; mIsSettingsSuggestionStripOn = false;
} else { } else {
isSettingsSuggestionStripOn = true; mIsSettingsSuggestionStripOn = true;
} }
if (InputTypeCompatUtils.isEmailVariation(variation) if (InputTypeCompatUtils.isEmailVariation(variation)
|| variation == InputType.TYPE_TEXT_VARIATION_PERSON_NAME) { || variation == InputType.TYPE_TEXT_VARIATION_PERSON_NAME) {
// The point in turning this off is that we don't want to insert a space after // The point in turning this off is that we don't want to insert a space after
// a name when filling a form: we can't delete trailing spaces when changing fields // a name when filling a form: we can't delete trailing spaces when changing fields
insertSpaceOnPickSuggestionManually = false; mInsertSpaceOnPickSuggestionManually = false;
} else { } else {
insertSpaceOnPickSuggestionManually = true; mInsertSpaceOnPickSuggestionManually = true;
} }
// 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
@ -96,17 +92,12 @@ public class InputAttributes {
&& !flagAutoCorrect) && !flagAutoCorrect)
|| flagNoSuggestions || flagNoSuggestions
|| (!flagAutoCorrect && !flagMultiLine)) { || (!flagAutoCorrect && !flagMultiLine)) {
inputTypeNoAutoCorrect = true; mInputTypeNoAutoCorrect = true;
} else { } else {
inputTypeNoAutoCorrect = false; mInputTypeNoAutoCorrect = false;
} }
applicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode;
} }
mInsertSpaceOnPickSuggestionManually = insertSpaceOnPickSuggestionManually;
mInputTypeNoAutoCorrect = inputTypeNoAutoCorrect;
mIsSettingsSuggestionStripOn = isSettingsSuggestionStripOn;
mApplicationSpecifiedCompletionOn = applicationSpecifiedCompletionOn;
} }
} }

View File

@ -176,6 +176,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private int mSpaceState; private int mSpaceState;
private SettingsValues mSettingsValues; private SettingsValues mSettingsValues;
private InputAttributes mInputAttributes;
private View mExtractArea; private View mExtractArea;
private View mKeyPreviewBackingView; private View mKeyPreviewBackingView;
@ -196,8 +197,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private UserUnigramDictionary mUserUnigramDictionary; private UserUnigramDictionary mUserUnigramDictionary;
private boolean mIsUserDictionaryAvailable; private boolean mIsUserDictionaryAvailable;
private InputAttributes mInputAttributes;
private WordComposer mWordComposer = new WordComposer(); private WordComposer mWordComposer = new WordComposer();
private boolean mHasUncommittedTypedChars; private boolean mHasUncommittedTypedChars;
@ -754,7 +753,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// The EditorInfo might have a flag that affects fullscreen mode. // The EditorInfo might have a flag that affects fullscreen mode.
// Note: This call should be done by InputMethodService? // Note: This call should be done by InputMethodService?
updateFullscreenMode(); updateFullscreenMode();
initializeInputAttributes(editorInfo); mInputAttributes = new InputAttributes(editorInfo, isFullscreenMode());
mApplicationSpecifiedCompletions = null; mApplicationSpecifiedCompletions = null;
inputView.closing(); inputView.closing();
@ -796,10 +795,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
} }
private void initializeInputAttributes(final EditorInfo editorInfo) {
mInputAttributes = new InputAttributes(editorInfo, isFullscreenMode());
}
@Override @Override
public void onWindowHidden() { public void onWindowHidden() {
super.onWindowHidden(); super.onWindowHidden();