Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e2d810d authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Remove web mode and add webInput boolean

Bug: 4490948
Change-Id: I6fe23c9ab4918eab6806cc621c4d6821c2e1baf9
Cherry-Pick: I4cd1af0b
parent 144e97f1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -184,9 +184,10 @@
            <enum name="url" value="1" />
            <enum name="email" value="2" />
            <enum name="im" value="3" />
            <enum name="web" value="4" />
            <enum name="phone" value="5" />
            <enum name="phone" value="4" />
            <enum name="number" value="5" />
        </attr>
        <attr name="webInput" format="boolean" />
        <attr name="passwordInput" format="boolean" />
        <attr name="hasSettingsKey" format="string" />
        <attr name="voiceKeyEnabled" format="string" />
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
                </case>
                <!-- latin:hasVoiceKey="false" -->
                <case
                    latin:mode="web"
                    latin:webInput="true"
                >
                    <Key
                        latin:keyLabel="."
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
                    latin:keyWidth="40%p" />
                <switch>
                    <case
                        latin:mode="web"
                        latin:webInput="true"
                    >
                         <Key
                            latin:keyHintIcon="@drawable/hint_popup"
@@ -90,7 +90,7 @@
                    latin:keyWidth="30%p" />
                <switch>
                    <case
                        latin:mode="web"
                        latin:webInput="true"
                    >
                         <Key
                            latin:keyHintIcon="@drawable/hint_popup"
+22 −3
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public class InputTypeCompatUtils {
            (Integer) CompatUtils.getFieldValue(null, null,
                    FIELD_InputType_TYPE_NUMBER_VARIATION_PASSWORD);
    private static final int WEB_TEXT_PASSWORD_INPUT_TYPE;
    private static final int WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
    private static final int NUMBER_PASSWORD_INPUT_TYPE;
    private static final int TEXT_PASSWORD_INPUT_TYPE =
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
@@ -48,6 +49,11 @@ public class InputTypeCompatUtils {
            OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD != null
                    ? InputType.TYPE_CLASS_TEXT | OBJ_InputType_TYPE_TEXT_VARIATION_WEB_PASSWORD
                    : 0;
        WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE =
            OBJ_InputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != null
                    ? InputType.TYPE_CLASS_TEXT
                            | OBJ_InputType_TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
                    : 0;
        NUMBER_PASSWORD_INPUT_TYPE =
                OBJ_InputType_TYPE_NUMBER_VARIATION_PASSWORD != null
                        ? InputType.TYPE_CLASS_NUMBER | OBJ_InputType_TYPE_NUMBER_VARIATION_PASSWORD
@@ -59,6 +65,11 @@ public class InputTypeCompatUtils {
                && inputType == WEB_TEXT_PASSWORD_INPUT_TYPE;
    }

    private static boolean isWebEmailAddressInputType(int inputType) {
        return WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE != 0
                && inputType == WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE;
    }

    private static boolean isNumberPasswordInputType(int inputType) {
        return NUMBER_PASSWORD_INPUT_TYPE != 0
                && inputType == NUMBER_PASSWORD_INPUT_TYPE;
@@ -78,6 +89,14 @@ public class InputTypeCompatUtils {
                || isWebEmailAddressVariation(variation);
    }

    public static boolean isWebInputType(int inputType) {
        final int maskedInputType =
                inputType & (InputType.TYPE_MASK_CLASS | InputType.TYPE_MASK_VARIATION);
        return maskedInputType == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
                || isWebPasswordInputType(maskedInputType)
                || isWebEmailAddressInputType(maskedInputType);
    }

    // Please refer to TextView.isPasswordInputType
    public static boolean isPasswordInputType(int inputType) {
        final int maskedInputType =
+10 −7
Original line number Diff line number Diff line
@@ -34,9 +34,8 @@ public class KeyboardId {
    public static final int MODE_URL = 1;
    public static final int MODE_EMAIL = 2;
    public static final int MODE_IM = 3;
    public static final int MODE_WEB = 4;
    public static final int MODE_PHONE = 5;
    public static final int MODE_NUMBER = 6;
    public static final int MODE_PHONE = 4;
    public static final int MODE_NUMBER = 5;

    public final Locale mLocale;
    public final int mOrientation;
@@ -44,6 +43,7 @@ public class KeyboardId {
    public final int mMode;
    public final int mXmlId;
    public final int mColorScheme;
    public final boolean mWebInput;
    public final boolean mPasswordInput;
    public final boolean mHasSettingsKey;
    public final boolean mVoiceKeyEnabled;
@@ -67,6 +67,7 @@ public class KeyboardId {
        this.mMode = mode;
        this.mXmlId = xmlId;
        this.mColorScheme = colorScheme;
        this.mWebInput = InputTypeCompatUtils.isWebInputType(inputType);
        this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
                || InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
        this.mHasSettingsKey = hasSettingsKey;
@@ -88,6 +89,7 @@ public class KeyboardId {
                mode,
                xmlId,
                colorScheme,
                mWebInput,
                mPasswordInput,
                hasSettingsKey,
                voiceKeyEnabled,
@@ -141,6 +143,7 @@ public class KeyboardId {
            && other.mMode == this.mMode
            && other.mXmlId == this.mXmlId
            && other.mColorScheme == this.mColorScheme
            && other.mWebInput == this.mWebInput
            && other.mPasswordInput == this.mPasswordInput
            && other.mHasSettingsKey == this.mHasSettingsKey
            && other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
@@ -156,18 +159,19 @@ public class KeyboardId {

    @Override
    public String toString() {
        return String.format("[%s.xml %s %s%d %s %s %s%s%s%s%s%s]",
        return String.format("[%s.xml %s %s%d %s %s %s %s%s%s%s%s%s]",
                mXmlName,
                mLocale,
                (mOrientation == 1 ? "port" : "land"), mWidth,
                modeName(mMode),
                EditorInfoCompatUtils.imeOptionsName(mImeAction),
                colorSchemeName(mColorScheme),
                (mWebInput ? " webInput" : ""),
                (mPasswordInput ? " passwordInput" : ""),
                (mHasSettingsKey ? " hasSettingsKey" : ""),
                (mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
                (mHasVoiceKey ? " hasVoiceKey" : ""),
                (mEnableShiftLock ? " enableShiftLock" : ""),
                colorSchemeName(mColorScheme)
                (mEnableShiftLock ? " enableShiftLock" : "")
        );
    }

@@ -177,7 +181,6 @@ public class KeyboardId {
        case MODE_URL: return "url";
        case MODE_EMAIL: return "email";
        case MODE_IM: return "im";
        case MODE_WEB: return "web";
        case MODE_PHONE: return "phone";
        case MODE_NUMBER: return "number";
        }
Loading