From 80b66bb166f7f45adfcadcb84788477df9930828 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 16 Dec 2011 14:21:50 +0900 Subject: [PATCH] General cleanup. Move variables around, inline useless functions, remove useless local variables. Change-Id: Icb89d8b211a2ad4bc3619137c2276a649c2a5e34 --- .../inputmethod/latin/InputAttributes.java | 33 +++++++------------ .../android/inputmethod/latin/LatinIME.java | 9 ++--- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java index 6d3f3e46a..c5b9703aa 100644 --- a/java/src/com/android/inputmethod/latin/InputAttributes.java +++ b/java/src/com/android/inputmethod/latin/InputAttributes.java @@ -34,16 +34,11 @@ public class InputAttributes { final public boolean mApplicationSpecifiedCompletionOn; 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) { - insertSpaceOnPickSuggestionManually = false; - isSettingsSuggestionStripOn = false; - inputTypeNoAutoCorrect = false; - applicationSpecifiedCompletionOn = false; + mInsertSpaceOnPickSuggestionManually = false; + mIsSettingsSuggestionStripOn = false; + mInputTypeNoAutoCorrect = false; + mApplicationSpecifiedCompletionOn = false; } else { final int inputType = editorInfo.inputType; if (inputType == InputType.TYPE_NULL) { @@ -53,6 +48,7 @@ public class InputAttributes { 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? Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x" + " imeOptions=0x%08x", inputType, editorInfo.imeOptions)); @@ -74,18 +70,18 @@ public class InputAttributes { || InputType.TYPE_TEXT_VARIATION_FILTER == variation || flagNoSuggestions || flagAutoComplete) { - isSettingsSuggestionStripOn = false; + mIsSettingsSuggestionStripOn = false; } else { - isSettingsSuggestionStripOn = true; + mIsSettingsSuggestionStripOn = true; } if (InputTypeCompatUtils.isEmailVariation(variation) || variation == InputType.TYPE_TEXT_VARIATION_PERSON_NAME) { // 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 - insertSpaceOnPickSuggestionManually = false; + mInsertSpaceOnPickSuggestionManually = false; } else { - insertSpaceOnPickSuggestionManually = true; + mInsertSpaceOnPickSuggestionManually = true; } // If it's a browser edit field and auto correct is not ON explicitly, then @@ -96,17 +92,12 @@ public class InputAttributes { && !flagAutoCorrect) || flagNoSuggestions || (!flagAutoCorrect && !flagMultiLine)) { - inputTypeNoAutoCorrect = true; + mInputTypeNoAutoCorrect = true; } else { - inputTypeNoAutoCorrect = false; + mInputTypeNoAutoCorrect = false; } - applicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; + mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode; } - - mInsertSpaceOnPickSuggestionManually = insertSpaceOnPickSuggestionManually; - mInputTypeNoAutoCorrect = inputTypeNoAutoCorrect; - mIsSettingsSuggestionStripOn = isSettingsSuggestionStripOn; - mApplicationSpecifiedCompletionOn = applicationSpecifiedCompletionOn; } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 47759f373..e6e1cba7c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -176,6 +176,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private int mSpaceState; private SettingsValues mSettingsValues; + private InputAttributes mInputAttributes; private View mExtractArea; private View mKeyPreviewBackingView; @@ -196,8 +197,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private UserUnigramDictionary mUserUnigramDictionary; private boolean mIsUserDictionaryAvailable; - private InputAttributes mInputAttributes; - private WordComposer mWordComposer = new WordComposer(); private boolean mHasUncommittedTypedChars; @@ -754,7 +753,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // The EditorInfo might have a flag that affects fullscreen mode. // Note: This call should be done by InputMethodService? updateFullscreenMode(); - initializeInputAttributes(editorInfo); + mInputAttributes = new InputAttributes(editorInfo, isFullscreenMode()); mApplicationSpecifiedCompletions = null; inputView.closing(); @@ -796,10 +795,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } - private void initializeInputAttributes(final EditorInfo editorInfo) { - mInputAttributes = new InputAttributes(editorInfo, isFullscreenMode()); - } - @Override public void onWindowHidden() { super.onWindowHidden();