Loading java/src/com/android/inputmethod/keyboard/KeyboardId.java +45 −32 Original line number Diff line number Diff line Loading @@ -63,46 +63,39 @@ public class KeyboardId { // TODO: Remove this field. private final int mXmlId; public final int mElementState; public final boolean mNavigateAction; public final boolean mPasswordInput; private final int mInputType; private final int mImeOptions; private final boolean mSettingsKeyEnabled; public final boolean mClobberSettingsKey; public final boolean mShortcutKeyEnabled; public final boolean mHasShortcutKey; public final int mImeAction; // TODO: Remove this field. private final EditorInfo mEditorInfo; private final int mHashCode; public KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width, int mode, EditorInfo editorInfo, boolean settingsKeyEnabled, boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) { final int inputType = (editorInfo != null) ? editorInfo.inputType : 0; final int imeOptions = (editorInfo != null) ? editorInfo.imeOptions : 0; this.mElementState = elementState; this(xmlId, elementState, locale, orientation, width, mode, (editorInfo != null ? editorInfo.inputType : 0), (editorInfo != null ? editorInfo.imeOptions : 0), settingsKeyEnabled, clobberSettingsKey, shortcutKeyEnabled, hasShortcutKey); } private KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width, int mode, int inputType, int imeOptions, boolean settingsKeyEnabled, boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) { this.mLocale = locale; this.mOrientation = orientation; this.mWidth = width; this.mMode = mode; this.mXmlId = xmlId; // Note: Turn off checking navigation flag to show TAB key for now. this.mNavigateAction = InputTypeCompatUtils.isWebInputType(inputType); // || EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions) // || EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions); this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType) || InputTypeCompatUtils.isVisiblePasswordInputType(inputType); this.mElementState = elementState; this.mInputType = inputType; this.mImeOptions = imeOptions; this.mSettingsKeyEnabled = settingsKeyEnabled; this.mClobberSettingsKey = clobberSettingsKey; this.mShortcutKeyEnabled = shortcutKeyEnabled; this.mHasShortcutKey = hasShortcutKey; // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}. this.mImeAction = imeOptions & ( EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION); this.mEditorInfo = editorInfo; this.mHashCode = hashCode(this); } Loading @@ -114,14 +107,14 @@ public class KeyboardId { id.mMode, id.mWidth, id.mXmlId, id.mNavigateAction, id.mPasswordInput, id.navigateAction(), id.passwordInput(), id.mSettingsKeyEnabled, id.mClobberSettingsKey, id.mShortcutKeyEnabled, id.mHasShortcutKey, id.mImeAction, id.mLocale, id.imeAction(), id.mLocale }); } Loading @@ -133,19 +126,19 @@ public class KeyboardId { && other.mMode == this.mMode && other.mWidth == this.mWidth && other.mXmlId == this.mXmlId && other.mNavigateAction == this.mNavigateAction && other.mPasswordInput == this.mPasswordInput && other.navigateAction() == this.navigateAction() && other.passwordInput() == this.passwordInput() && other.mSettingsKeyEnabled == this.mSettingsKeyEnabled && other.mClobberSettingsKey == this.mClobberSettingsKey && other.mShortcutKeyEnabled == this.mShortcutKeyEnabled && other.mHasShortcutKey == this.mHasShortcutKey && other.mImeAction == this.mImeAction && other.imeAction() == this.imeAction() && other.mLocale.equals(this.mLocale); } public KeyboardId cloneWithNewXml(int xmlId) { return new KeyboardId(xmlId, mElementState, mLocale, mOrientation, mWidth, mMode, mEditorInfo, false, false, false, false); mInputType, mImeOptions, false, false, false, false); } // Remove this method. Loading @@ -169,6 +162,26 @@ public class KeyboardId { return mElementState == ELEMENT_PHONE_SHIFT; } public boolean navigateAction() { // Note: Turn off checking navigation flag to show TAB key for now. boolean navigateAction = InputTypeCompatUtils.isWebInputType(mInputType); // || EditorInfoCompatUtils.hasFlagNavigateNext(mImeOptions) // || EditorInfoCompatUtils.hasFlagNavigatePrevious(mImeOptions); return navigateAction; } public boolean passwordInput() { return InputTypeCompatUtils.isPasswordInputType(mInputType) || InputTypeCompatUtils.isVisiblePasswordInputType(mInputType); } public int imeAction() { // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}. return mImeOptions & ( EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION); } public boolean hasSettingsKey() { return mSettingsKeyEnabled && !mClobberSettingsKey; } Loading Loading @@ -205,11 +218,11 @@ public class KeyboardId { mLocale, (mOrientation == 1 ? "port" : "land"), mWidth, modeName(mMode), EditorInfoCompatUtils.imeOptionsName(mImeAction), EditorInfoCompatUtils.imeOptionsName(imeAction()), f2KeyModeName(f2KeyMode()), (mClobberSettingsKey ? " clobberSettingsKey" : ""), (mNavigateAction ? " navigateAction" : ""), (mPasswordInput ? " passwordInput" : ""), (navigateAction() ? " navigateAction" : ""), (passwordInput() ? " passwordInput" : ""), (hasSettingsKey() ? " hasSettingsKey" : ""), (mShortcutKeyEnabled ? " shortcutKeyEnabled" : ""), (mHasShortcutKey ? " hasShortcutKey" : "") Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +3 −3 Original line number Diff line number Diff line Loading @@ -609,9 +609,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> { final boolean modeMatched = matchTypedValue(a, R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode)); final boolean navigateActionMatched = matchBoolean(a, R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction); R.styleable.Keyboard_Case_navigateAction, id.navigateAction()); final boolean passwordInputMatched = matchBoolean(a, R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput); R.styleable.Keyboard_Case_passwordInput, id.passwordInput()); final boolean hasSettingsKeyMatched = matchBoolean(a, R.styleable.Keyboard_Case_hasSettingsKey, id.hasSettingsKey()); final boolean f2KeyModeMatched = matchInteger(a, Loading @@ -627,7 +627,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> { // {@link android.view.inputmethod.EditorInfo#IME_FLAG_NO_ENTER_ACTION}. So matching // this attribute with id.mImeOptions as integer value is enough for our purpose. final boolean imeActionMatched = matchInteger(a, R.styleable.Keyboard_Case_imeAction, id.mImeAction); R.styleable.Keyboard_Case_imeAction, id.imeAction()); final boolean localeCodeMatched = matchString(a, R.styleable.Keyboard_Case_localeCode, id.mLocale.toString()); final boolean languageCodeMatched = matchString(a, Loading tests/src/com/android/inputmethod/latin/SuggestTestsBase.java +1 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.res.Configuration; import android.test.AndroidTestCase; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.keyboard.KeyboardId; Loading Loading @@ -52,7 +51,7 @@ public class SuggestTestsBase extends AndroidTestCase { } return new KeyboardId(com.android.inputmethod.latin.R.xml.kbd_qwerty, KeyboardId.ELEMENT_ALPHABET, locale, orientation, width, KeyboardId.MODE_TEXT, new EditorInfo(), false, false, false, false); null, false, false, false, false); } protected InputStream openTestRawResource(int resIdInTest) { Loading Loading
java/src/com/android/inputmethod/keyboard/KeyboardId.java +45 −32 Original line number Diff line number Diff line Loading @@ -63,46 +63,39 @@ public class KeyboardId { // TODO: Remove this field. private final int mXmlId; public final int mElementState; public final boolean mNavigateAction; public final boolean mPasswordInput; private final int mInputType; private final int mImeOptions; private final boolean mSettingsKeyEnabled; public final boolean mClobberSettingsKey; public final boolean mShortcutKeyEnabled; public final boolean mHasShortcutKey; public final int mImeAction; // TODO: Remove this field. private final EditorInfo mEditorInfo; private final int mHashCode; public KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width, int mode, EditorInfo editorInfo, boolean settingsKeyEnabled, boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) { final int inputType = (editorInfo != null) ? editorInfo.inputType : 0; final int imeOptions = (editorInfo != null) ? editorInfo.imeOptions : 0; this.mElementState = elementState; this(xmlId, elementState, locale, orientation, width, mode, (editorInfo != null ? editorInfo.inputType : 0), (editorInfo != null ? editorInfo.imeOptions : 0), settingsKeyEnabled, clobberSettingsKey, shortcutKeyEnabled, hasShortcutKey); } private KeyboardId(int xmlId, int elementState, Locale locale, int orientation, int width, int mode, int inputType, int imeOptions, boolean settingsKeyEnabled, boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) { this.mLocale = locale; this.mOrientation = orientation; this.mWidth = width; this.mMode = mode; this.mXmlId = xmlId; // Note: Turn off checking navigation flag to show TAB key for now. this.mNavigateAction = InputTypeCompatUtils.isWebInputType(inputType); // || EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions) // || EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions); this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType) || InputTypeCompatUtils.isVisiblePasswordInputType(inputType); this.mElementState = elementState; this.mInputType = inputType; this.mImeOptions = imeOptions; this.mSettingsKeyEnabled = settingsKeyEnabled; this.mClobberSettingsKey = clobberSettingsKey; this.mShortcutKeyEnabled = shortcutKeyEnabled; this.mHasShortcutKey = hasShortcutKey; // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}. this.mImeAction = imeOptions & ( EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION); this.mEditorInfo = editorInfo; this.mHashCode = hashCode(this); } Loading @@ -114,14 +107,14 @@ public class KeyboardId { id.mMode, id.mWidth, id.mXmlId, id.mNavigateAction, id.mPasswordInput, id.navigateAction(), id.passwordInput(), id.mSettingsKeyEnabled, id.mClobberSettingsKey, id.mShortcutKeyEnabled, id.mHasShortcutKey, id.mImeAction, id.mLocale, id.imeAction(), id.mLocale }); } Loading @@ -133,19 +126,19 @@ public class KeyboardId { && other.mMode == this.mMode && other.mWidth == this.mWidth && other.mXmlId == this.mXmlId && other.mNavigateAction == this.mNavigateAction && other.mPasswordInput == this.mPasswordInput && other.navigateAction() == this.navigateAction() && other.passwordInput() == this.passwordInput() && other.mSettingsKeyEnabled == this.mSettingsKeyEnabled && other.mClobberSettingsKey == this.mClobberSettingsKey && other.mShortcutKeyEnabled == this.mShortcutKeyEnabled && other.mHasShortcutKey == this.mHasShortcutKey && other.mImeAction == this.mImeAction && other.imeAction() == this.imeAction() && other.mLocale.equals(this.mLocale); } public KeyboardId cloneWithNewXml(int xmlId) { return new KeyboardId(xmlId, mElementState, mLocale, mOrientation, mWidth, mMode, mEditorInfo, false, false, false, false); mInputType, mImeOptions, false, false, false, false); } // Remove this method. Loading @@ -169,6 +162,26 @@ public class KeyboardId { return mElementState == ELEMENT_PHONE_SHIFT; } public boolean navigateAction() { // Note: Turn off checking navigation flag to show TAB key for now. boolean navigateAction = InputTypeCompatUtils.isWebInputType(mInputType); // || EditorInfoCompatUtils.hasFlagNavigateNext(mImeOptions) // || EditorInfoCompatUtils.hasFlagNavigatePrevious(mImeOptions); return navigateAction; } public boolean passwordInput() { return InputTypeCompatUtils.isPasswordInputType(mInputType) || InputTypeCompatUtils.isVisiblePasswordInputType(mInputType); } public int imeAction() { // We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and // {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}. return mImeOptions & ( EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION); } public boolean hasSettingsKey() { return mSettingsKeyEnabled && !mClobberSettingsKey; } Loading Loading @@ -205,11 +218,11 @@ public class KeyboardId { mLocale, (mOrientation == 1 ? "port" : "land"), mWidth, modeName(mMode), EditorInfoCompatUtils.imeOptionsName(mImeAction), EditorInfoCompatUtils.imeOptionsName(imeAction()), f2KeyModeName(f2KeyMode()), (mClobberSettingsKey ? " clobberSettingsKey" : ""), (mNavigateAction ? " navigateAction" : ""), (mPasswordInput ? " passwordInput" : ""), (navigateAction() ? " navigateAction" : ""), (passwordInput() ? " passwordInput" : ""), (hasSettingsKey() ? " hasSettingsKey" : ""), (mShortcutKeyEnabled ? " shortcutKeyEnabled" : ""), (mHasShortcutKey ? " hasShortcutKey" : "") Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +3 −3 Original line number Diff line number Diff line Loading @@ -609,9 +609,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> { final boolean modeMatched = matchTypedValue(a, R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode)); final boolean navigateActionMatched = matchBoolean(a, R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction); R.styleable.Keyboard_Case_navigateAction, id.navigateAction()); final boolean passwordInputMatched = matchBoolean(a, R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput); R.styleable.Keyboard_Case_passwordInput, id.passwordInput()); final boolean hasSettingsKeyMatched = matchBoolean(a, R.styleable.Keyboard_Case_hasSettingsKey, id.hasSettingsKey()); final boolean f2KeyModeMatched = matchInteger(a, Loading @@ -627,7 +627,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> { // {@link android.view.inputmethod.EditorInfo#IME_FLAG_NO_ENTER_ACTION}. So matching // this attribute with id.mImeOptions as integer value is enough for our purpose. final boolean imeActionMatched = matchInteger(a, R.styleable.Keyboard_Case_imeAction, id.mImeAction); R.styleable.Keyboard_Case_imeAction, id.imeAction()); final boolean localeCodeMatched = matchString(a, R.styleable.Keyboard_Case_localeCode, id.mLocale.toString()); final boolean languageCodeMatched = matchString(a, Loading
tests/src/com/android/inputmethod/latin/SuggestTestsBase.java +1 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.res.Configuration; import android.test.AndroidTestCase; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.keyboard.KeyboardId; Loading Loading @@ -52,7 +51,7 @@ public class SuggestTestsBase extends AndroidTestCase { } return new KeyboardId(com.android.inputmethod.latin.R.xml.kbd_qwerty, KeyboardId.ELEMENT_ALPHABET, locale, orientation, width, KeyboardId.MODE_TEXT, new EditorInfo(), false, false, false, false); null, false, false, false, false); } protected InputStream openTestRawResource(int resIdInTest) { Loading