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

Commit ae7746e5 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Add Key.altCode attribute"

parents db5aedb5 2013bab8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -185,6 +185,8 @@
    <declare-styleable name="Keyboard_Key">
        <!-- The unicode value that this key outputs. -->
        <attr name="code" format="integer" />
        <!-- The alternate unicode value that this key outputs while typing. -->
        <attr name="altCode" format="integer" />
        <!-- The keys to display in the more keys keyboard. -->
        <attr name="moreKeys" format="string" />
        <!-- Maximum column of more keys keyboard -->
@@ -201,7 +203,7 @@
            <!-- This should be aligned with Key.ACTION_FLAGS_* -->
            <flag name="isRepeatable" value="0x01" />
            <flag name="noKeyPreview" value="0x02" />
            <flag name="ignoreWhileTyping" value="0x04" />
            <flag name="altCodeWhileTyping" value="0x04" />
        </attr>
        <!-- The string of characters to output when this key is pressed. -->
        <attr name="keyOutputText" format="string" />
+4 −2
Original line number Diff line number Diff line
@@ -77,13 +77,15 @@
        latin:styleName="shortcutKeyStyle"
        latin:code="@integer/key_shortcut"
        latin:keyIcon="iconShortcutKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:parentStyle="f2PopupStyle" />
    <key-style
        latin:styleName="settingsKeyStyle"
        latin:code="@integer/key_settings"
        latin:keyIcon="iconSettingsKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:backgroundType="functional" />
    <key-style
        latin:styleName="tabKeyStyle"
+4 −2
Original line number Diff line number Diff line
@@ -59,13 +59,15 @@
        latin:styleName="shortcutKeyStyle"
        latin:code="@integer/key_shortcut"
        latin:keyIcon="iconShortcutKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:backgroundType="functional" />
    <key-style
        latin:styleName="settingsKeyStyle"
        latin:code="@integer/key_settings"
        latin:keyIcon="iconSettingsKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:backgroundType="functional" />
    <key-style
        latin:styleName="tabKeyStyle"
+4 −2
Original line number Diff line number Diff line
@@ -163,13 +163,15 @@
        latin:styleName="shortcutKeyStyle"
        latin:code="@integer/key_shortcut"
        latin:keyIcon="iconShortcutKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:parentStyle="f1PopupStyle" />
    <key-style
        latin:styleName="settingsKeyStyle"
        latin:code="@integer/key_settings"
        latin:keyIcon="iconSettingsKey"
        latin:keyActionFlags="noKeyPreview|ignoreWhileTyping"
        latin:keyActionFlags="noKeyPreview|altCodeWhileTyping"
        latin:altCode="@integer/key_space"
        latin:backgroundType="functional" />
    <key-style
        latin:styleName="tabKeyStyle"
+7 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public class Key {
     * The key code (unicode or custom code) that this key generates.
     */
    public final int mCode;
    public final int mAltCode;

    /** Label to display */
    public final CharSequence mLabel;
@@ -108,7 +109,7 @@ public class Key {
    private final int mActionFlags;
    private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01;
    private static final int ACTION_FLAGS_NO_KEY_PREVIEW = 0x02;
    private static final int ACTION_FLAGS_IGNORE_WHILE_TYPING = 0x04;
    private static final int ACTION_FLAGS_ALT_CODE_WHILE_TYPING = 0x04;

    /** The current pressed state of this key */
    private boolean mPressed;
@@ -191,6 +192,7 @@ public class Key {
        mLabel = label;
        mOutputText = outputText;
        mCode = code;
        mAltCode = Keyboard.CODE_DUMMY;
        mIcon = icon;
        // Horizontal gap is divided equally to both sides of the key.
        mX = x + mHorizontalGap / 2;
@@ -290,6 +292,8 @@ public class Key {
        } else {
            mCode = Keyboard.CODE_DUMMY;
        }
        mAltCode = style.getInt(keyAttr,
                R.styleable.Keyboard_Key_altCode, Keyboard.CODE_DUMMY);

        keyAttr.recycle();
    }
@@ -334,8 +338,8 @@ public class Key {
        return (mActionFlags & ACTION_FLAGS_NO_KEY_PREVIEW) != 0;
    }

    public boolean ignoreWhileTyping() {
        return (mActionFlags & ACTION_FLAGS_IGNORE_WHILE_TYPING) != 0;
    public boolean altCodeWhileTyping() {
        return (mActionFlags & ACTION_FLAGS_ALT_CODE_WHILE_TYPING) != 0;
    }

    public Typeface selectTypeface(Typeface defaultTypeface) {
Loading