mirror of
				https://github.com/SimpleMobileTools/Simple-Keyboard.git
				synced 2025-06-05 21:49:26 +02:00 
			
		
		
		
	refer to our keyboard attributes, not the system ones
This commit is contained in:
		@@ -24,9 +24,9 @@ import android.text.TextUtils
 | 
			
		||||
import android.util.TypedValue
 | 
			
		||||
import android.util.Xml
 | 
			
		||||
import androidx.annotation.XmlRes
 | 
			
		||||
import com.simplemobiletools.commons.helpers.mydebug
 | 
			
		||||
import com.simplemobiletools.keyboard.R
 | 
			
		||||
import org.xmlpull.v1.XmlPullParserException
 | 
			
		||||
import java.io.IOException
 | 
			
		||||
import java.io.FileNotFoundException
 | 
			
		||||
import java.util.*
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -87,7 +87,7 @@ class MyKeyboard {
 | 
			
		||||
    var mKeys: MutableList<Key?>? = null
 | 
			
		||||
 | 
			
		||||
    /** List of modifier keys such as Shift & Alt, if any  */
 | 
			
		||||
    private var mModifierKeys: MutableList<Key?>? = null
 | 
			
		||||
    private var mModifierKeys = ArrayList<Key?>()
 | 
			
		||||
 | 
			
		||||
    /** Width of the screen available to fit the keyboard  */
 | 
			
		||||
    private var mDisplayWidth = 0
 | 
			
		||||
@@ -160,6 +160,7 @@ class MyKeyboard {
 | 
			
		||||
 | 
			
		||||
        /** Vertical gap following this row.  */
 | 
			
		||||
        var verticalGap = 0
 | 
			
		||||
 | 
			
		||||
        var mKeys = ArrayList<Key>()
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
@@ -255,8 +256,7 @@ class MyKeyboard {
 | 
			
		||||
        /**
 | 
			
		||||
         * Flags that specify the anchoring to edges of the keyboard for detecting touch events
 | 
			
		||||
         * that are just out of the boundary of the key. This is a bit mask of
 | 
			
		||||
         * [MyKeyboard.EDGE_LEFT], [MyKeyboard.EDGE_RIGHT], [MyKeyboard.EDGE_TOP] and
 | 
			
		||||
         * [MyKeyboard.EDGE_BOTTOM].
 | 
			
		||||
         * [MyKeyboard.EDGE_LEFT], [MyKeyboard.EDGE_RIGHT], [MyKeyboard.EDGE_TOP] and [MyKeyboard.EDGE_BOTTOM].
 | 
			
		||||
         */
 | 
			
		||||
        var edgeFlags: Int
 | 
			
		||||
 | 
			
		||||
@@ -275,8 +275,7 @@ class MyKeyboard {
 | 
			
		||||
        /** Create a key with the given top-left coordinate and extract its attributes from
 | 
			
		||||
         * the XML parser.
 | 
			
		||||
         * @param res resources associated with the caller's context
 | 
			
		||||
         * @param parent the row that this key belongs to. The row must already be attached to
 | 
			
		||||
         * a [Keyboard].
 | 
			
		||||
         * @param parent the row that this key belongs to. The row must already be attached to a [MyKeyboard].
 | 
			
		||||
         * @param x the x coordinate of the top-left
 | 
			
		||||
         * @param y the y coordinate of the top-left
 | 
			
		||||
         * @param parser the XML parser containing the attributes for this key
 | 
			
		||||
@@ -315,8 +314,9 @@ class MyKeyboard {
 | 
			
		||||
 | 
			
		||||
            icon?.setBounds(0, 0, icon!!.intrinsicWidth, icon!!.intrinsicHeight)
 | 
			
		||||
 | 
			
		||||
            label = a.getText(R.styleable.Keyboard_Key_keyLabel)
 | 
			
		||||
            label = a.getText(R.styleable.Keyboard_Key_keyLabel) ?: ""
 | 
			
		||||
            text = a.getText(R.styleable.Keyboard_Key_keyOutputText)
 | 
			
		||||
 | 
			
		||||
            if (!TextUtils.isEmpty(label)) {
 | 
			
		||||
                codes = arrayListOf(label[0].toInt())
 | 
			
		||||
            }
 | 
			
		||||
@@ -378,6 +378,7 @@ class MyKeyboard {
 | 
			
		||||
                try {
 | 
			
		||||
                    values[count++] = st.nextToken().toInt()
 | 
			
		||||
                } catch (nfe: NumberFormatException) {
 | 
			
		||||
                    mydebug("NumberFormatException $nfe")
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return values
 | 
			
		||||
@@ -454,26 +455,6 @@ class MyKeyboard {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a keyboard from the given xml key layout file. Weeds out rows
 | 
			
		||||
     * that have a keyboard mode defined but don't match the specified mode.
 | 
			
		||||
     * @param context the application or service context
 | 
			
		||||
     * @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
 | 
			
		||||
     * @param modeId keyboard mode identifier
 | 
			
		||||
     * @param width sets width of keyboard
 | 
			
		||||
     * @param height sets height of keyboard
 | 
			
		||||
     */
 | 
			
		||||
    constructor(context: Context, @XmlRes xmlLayoutResId: Int, modeId: Int, width: Int, height: Int) {
 | 
			
		||||
        mDisplayWidth = width
 | 
			
		||||
        mDisplayHeight = height
 | 
			
		||||
        mDefaultHorizontalGap = 0
 | 
			
		||||
        mDefaultWidth = mDisplayWidth / 10
 | 
			
		||||
        mDefaultVerticalGap = 0
 | 
			
		||||
        mDefaultHeight = mDefaultWidth
 | 
			
		||||
        mKeys = ArrayList()
 | 
			
		||||
        mKeyboardMode = modeId
 | 
			
		||||
        loadKeyboard(context, context.resources.getXml(xmlLayoutResId))
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a keyboard from the given xml key layout file. Weeds out rows
 | 
			
		||||
     * that have a keyboard mode defined but don't match the specified mode.
 | 
			
		||||
@@ -640,12 +621,12 @@ class MyKeyboard {
 | 
			
		||||
     * point is out of range, then an array of size zero is returned.
 | 
			
		||||
     */
 | 
			
		||||
    fun getNearestKeys(x: Int, y: Int): IntArray {
 | 
			
		||||
        if (x in 0 until minWidth && y >= 0 && y < height) {
 | 
			
		||||
        /*if (x in 0 until minWidth && y >= 0 && y < height) {
 | 
			
		||||
            val index: Int = y / mCellHeight * GRID_WIDTH + x / mCellWidth
 | 
			
		||||
            if (index < GRID_SIZE) {
 | 
			
		||||
                return mGridNeighbors[index]!!
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        }*/
 | 
			
		||||
        return IntArray(0)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -660,25 +641,24 @@ class MyKeyboard {
 | 
			
		||||
    private fun loadKeyboard(context: Context, parser: XmlResourceParser) {
 | 
			
		||||
        var inKey = false
 | 
			
		||||
        var inRow = false
 | 
			
		||||
        val leftMostKey = false
 | 
			
		||||
        var row = 0
 | 
			
		||||
        var x = 0
 | 
			
		||||
        var y = 0
 | 
			
		||||
        var key: Key? = null
 | 
			
		||||
        var currentRow: Row? = null
 | 
			
		||||
        val res = context.resources
 | 
			
		||||
        var skipRow = false
 | 
			
		||||
        try {
 | 
			
		||||
            var event: Int
 | 
			
		||||
            while (parser.next().also { event = it } != XmlResourceParser.END_DOCUMENT) {
 | 
			
		||||
                if (event == XmlResourceParser.START_TAG) {
 | 
			
		||||
                    val tag = parser.name
 | 
			
		||||
                    if (TAG_ROW == tag) {
 | 
			
		||||
                        //mydebug("row $currentRow")
 | 
			
		||||
                        inRow = true
 | 
			
		||||
                        x = 0
 | 
			
		||||
                        currentRow = createRowFromXml(res, parser)
 | 
			
		||||
                        rows.add(currentRow)
 | 
			
		||||
                        skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode
 | 
			
		||||
                        val skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode
 | 
			
		||||
                        if (skipRow) {
 | 
			
		||||
                            skipToEndOfRow(parser)
 | 
			
		||||
                            inRow = false
 | 
			
		||||
@@ -696,9 +676,9 @@ class MyKeyboard {
 | 
			
		||||
                                    break
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            mModifierKeys!!.add(key)
 | 
			
		||||
                            mModifierKeys.add(key)
 | 
			
		||||
                        } else if (key.codes[0] == KEYCODE_ALT) {
 | 
			
		||||
                            mModifierKeys!!.add(key)
 | 
			
		||||
                            mModifierKeys.add(key)
 | 
			
		||||
                        }
 | 
			
		||||
                        currentRow.mKeys.add(key)
 | 
			
		||||
                    } else if (TAG_KEYBOARD == tag) {
 | 
			
		||||
@@ -719,12 +699,12 @@ class MyKeyboard {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (e: Exception) {
 | 
			
		||||
        } catch (e: FileNotFoundException) {
 | 
			
		||||
            mydebug("Exception $e")
 | 
			
		||||
        }
 | 
			
		||||
        height = y - mDefaultVerticalGap
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Throws(XmlPullParserException::class, IOException::class)
 | 
			
		||||
    private fun skipToEndOfRow(parser: XmlResourceParser) {
 | 
			
		||||
        var event: Int
 | 
			
		||||
        while (parser.next().also { event = it } != XmlResourceParser.END_DOCUMENT) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
    android:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="wrap_content"
 | 
			
		||||
@@ -9,11 +10,10 @@
 | 
			
		||||
        android:id="@+id/keyboardView"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_alignParentBottom="true"
 | 
			
		||||
        android:background="@android:color/transparent"
 | 
			
		||||
        android:keyPreviewLayout="@layout/keyboard_key_preview"
 | 
			
		||||
        android:keyTextSize="22sp"
 | 
			
		||||
        android:popupLayout="@layout/keyboard_popup_keyboard"
 | 
			
		||||
        app:keyPreviewLayout="@layout/keyboard_key_preview"
 | 
			
		||||
        app:keyTextSize="22sp"
 | 
			
		||||
        app:popupLayout="@layout/keyboard_popup_keyboard"
 | 
			
		||||
        tools:ignore="ResourceCycle" />
 | 
			
		||||
 | 
			
		||||
    <ImageButton
 | 
			
		||||
@@ -23,7 +23,6 @@
 | 
			
		||||
        android:layout_gravity="center"
 | 
			
		||||
        android:layout_marginStart="8dp"
 | 
			
		||||
        android:background="@android:color/transparent"
 | 
			
		||||
        android:clickable="true"
 | 
			
		||||
        android:src="@drawable/ic_cross_vector" />
 | 
			
		||||
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,4 +3,89 @@
 | 
			
		||||
    <declare-styleable name="KeyboardViewPreviewState">
 | 
			
		||||
        <attr name="state_long_pressable" format="boolean" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="MyKeyboardView">
 | 
			
		||||
        <attr name="keyboardViewStyle" format="reference" />
 | 
			
		||||
        <!-- Image for the key. This image needs to be a StateListDrawable, with the following possible states:
 | 
			
		||||
             normal, pressed, checkable, checkable+pressed, checkable+checked, checkable+checked+pressed. -->
 | 
			
		||||
        <attr name="keyBackground" format="reference" />
 | 
			
		||||
        <!-- Size of the text for character keys. -->
 | 
			
		||||
        <attr name="keyTextSize" format="dimension" />
 | 
			
		||||
        <!-- Size of the text for custom keys with some text and no icon. -->
 | 
			
		||||
        <attr name="labelTextSize" format="dimension" />
 | 
			
		||||
        <!-- Color to use for the label in a key. -->
 | 
			
		||||
        <attr name="keyTextColor" format="color" />
 | 
			
		||||
        <!-- Layout resource for key press feedback. -->
 | 
			
		||||
        <attr name="keyPreviewLayout" format="reference" />
 | 
			
		||||
        <!-- Vertical offset of the key press feedback from the key. -->
 | 
			
		||||
        <attr name="keyPreviewOffset" format="dimension" />
 | 
			
		||||
        <!-- Height of the key press feedback popup. -->
 | 
			
		||||
        <attr name="keyPreviewHeight" format="dimension" />
 | 
			
		||||
        <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
 | 
			
		||||
        <attr name="verticalCorrection" format="dimension" />
 | 
			
		||||
        <!-- Layout resource for popup keyboards. -->
 | 
			
		||||
        <attr name="popupLayout" format="reference" />
 | 
			
		||||
        <attr name="shadowColor" format="color" />
 | 
			
		||||
        <!-- Horizontal offset of the text shadow. -->
 | 
			
		||||
        <attr name="shadowDx" format="dimension" />
 | 
			
		||||
        <!-- Vertical offset of the text shadow. -->
 | 
			
		||||
        <attr name="shadowDy" format="dimension" />
 | 
			
		||||
        <!-- Blur radius of the text shadow. -->
 | 
			
		||||
        <attr name="shadowRadius" format="float" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard">
 | 
			
		||||
        <!-- Default width of a key, in pixels or percentage of display width. -->
 | 
			
		||||
        <attr name="keyWidth" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default height of a key, in pixels or percentage of display width. -->
 | 
			
		||||
        <attr name="keyHeight" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default horizontal gap between keys. -->
 | 
			
		||||
        <attr name="horizontalGap" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default vertical gap between rows of keys. -->
 | 
			
		||||
        <attr name="verticalGap" format="dimension|fraction" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard_Row">
 | 
			
		||||
        <!-- Row edge flags. -->
 | 
			
		||||
        <attr name="rowEdgeFlags">
 | 
			
		||||
            <!-- Row is anchored to the top of the keyboard. -->
 | 
			
		||||
            <flag name="top" value="4" />
 | 
			
		||||
            <!-- Row is anchored to the bottom of the keyboard. -->
 | 
			
		||||
            <flag name="bottom" value="8" />
 | 
			
		||||
        </attr>
 | 
			
		||||
        <!-- Mode of the keyboard. If the mode doesn't match the requested keyboard mode, the row will be skipped. -->
 | 
			
		||||
        <attr name="keyboardMode" format="reference" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard_Key">
 | 
			
		||||
        <!-- The unicode value or comma-separated values that this key outputs. -->
 | 
			
		||||
        <attr name="codes" format="integer|string" />
 | 
			
		||||
        <!-- The XML keyboard layout of any popup keyboard. -->
 | 
			
		||||
        <attr name="popupKeyboard" format="reference" />
 | 
			
		||||
        <!-- The characters to display in the popup keyboard. -->
 | 
			
		||||
        <attr name="popupCharacters" format="string" />
 | 
			
		||||
        <!-- Key edge flags. -->
 | 
			
		||||
        <attr name="keyEdgeFlags">
 | 
			
		||||
            <!-- Key is anchored to the left of the keyboard. -->
 | 
			
		||||
            <flag name="left" value="1" />
 | 
			
		||||
            <!-- Key is anchored to the right of the keyboard. -->
 | 
			
		||||
            <flag name="right" value="2" />
 | 
			
		||||
        </attr>
 | 
			
		||||
        <!-- Whether this is a modifier key such as Alt or Shift. -->
 | 
			
		||||
        <attr name="isModifier" format="boolean" />
 | 
			
		||||
        <!-- Whether this is a toggle key. -->
 | 
			
		||||
        <attr name="isSticky" format="boolean" />
 | 
			
		||||
        <!-- Whether long-pressing on this key will make it repeat. -->
 | 
			
		||||
        <attr name="isRepeatable" format="boolean" />
 | 
			
		||||
        <!-- The icon to show in the popup preview. -->
 | 
			
		||||
        <attr name="iconPreview" format="reference" />
 | 
			
		||||
        <!-- The string of characters to output when this key is pressed. -->
 | 
			
		||||
        <attr name="keyOutputText" format="string" />
 | 
			
		||||
        <!-- The label to display on the key. -->
 | 
			
		||||
        <attr name="keyLabel" format="string" />
 | 
			
		||||
        <!-- The icon to display on the key instead of the label. -->
 | 
			
		||||
        <attr name="keyIcon" format="reference" />
 | 
			
		||||
        <!-- Mode of the keyboard. If the mode doesn't match the requested keyboard mode, the key will be skipped. -->
 | 
			
		||||
        <attr name="keyboardMode" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
@@ -20,89 +20,4 @@
 | 
			
		||||
        <item name="shadowColor">#BB000000</item>
 | 
			
		||||
        <item name="shadowRadius">2.75</item>
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="MyKeyboardView">
 | 
			
		||||
        <attr name="keyboardViewStyle" format="reference" />
 | 
			
		||||
        <!-- Image for the key. This image needs to be a StateListDrawable, with the following possible states:
 | 
			
		||||
             normal, pressed, checkable, checkable+pressed, checkable+checked, checkable+checked+pressed. -->
 | 
			
		||||
        <attr name="keyBackground" format="reference" />
 | 
			
		||||
        <!-- Size of the text for character keys. -->
 | 
			
		||||
        <attr name="keyTextSize" format="dimension" />
 | 
			
		||||
        <!-- Size of the text for custom keys with some text and no icon. -->
 | 
			
		||||
        <attr name="labelTextSize" format="dimension" />
 | 
			
		||||
        <!-- Color to use for the label in a key. -->
 | 
			
		||||
        <attr name="keyTextColor" format="color" />
 | 
			
		||||
        <!-- Layout resource for key press feedback. -->
 | 
			
		||||
        <attr name="keyPreviewLayout" format="reference" />
 | 
			
		||||
        <!-- Vertical offset of the key press feedback from the key. -->
 | 
			
		||||
        <attr name="keyPreviewOffset" format="dimension" />
 | 
			
		||||
        <!-- Height of the key press feedback popup. -->
 | 
			
		||||
        <attr name="keyPreviewHeight" format="dimension" />
 | 
			
		||||
        <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
 | 
			
		||||
        <attr name="verticalCorrection" format="dimension" />
 | 
			
		||||
        <!-- Layout resource for popup keyboards. -->
 | 
			
		||||
        <attr name="popupLayout" format="reference" />
 | 
			
		||||
        <attr name="shadowColor" format="color" />
 | 
			
		||||
        <!-- Horizontal offset of the text shadow. -->
 | 
			
		||||
        <attr name="shadowDx" format="dimension" />
 | 
			
		||||
        <!-- Vertical offset of the text shadow. -->
 | 
			
		||||
        <attr name="shadowDy" format="dimension" />
 | 
			
		||||
        <!-- Blur radius of the text shadow. -->
 | 
			
		||||
        <attr name="shadowRadius" format="float" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard">
 | 
			
		||||
        <!-- Default width of a key, in pixels or percentage of display width. -->
 | 
			
		||||
        <attr name="keyWidth" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default height of a key, in pixels or percentage of display width. -->
 | 
			
		||||
        <attr name="keyHeight" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default horizontal gap between keys. -->
 | 
			
		||||
        <attr name="horizontalGap" format="dimension|fraction" />
 | 
			
		||||
        <!-- Default vertical gap between rows of keys. -->
 | 
			
		||||
        <attr name="verticalGap" format="dimension|fraction" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard_Row">
 | 
			
		||||
        <!-- Row edge flags. -->
 | 
			
		||||
        <attr name="rowEdgeFlags">
 | 
			
		||||
            <!-- Row is anchored to the top of the keyboard. -->
 | 
			
		||||
            <flag name="top" value="4" />
 | 
			
		||||
            <!-- Row is anchored to the bottom of the keyboard. -->
 | 
			
		||||
            <flag name="bottom" value="8" />
 | 
			
		||||
        </attr>
 | 
			
		||||
        <!-- Mode of the keyboard. If the mode doesn't match the requested keyboard mode, the row will be skipped. -->
 | 
			
		||||
        <attr name="keyboardMode" format="reference" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
 | 
			
		||||
    <declare-styleable name="Keyboard_Key">
 | 
			
		||||
        <!-- The unicode value or comma-separated values that this key outputs. -->
 | 
			
		||||
        <attr name="codes" format="integer|string" />
 | 
			
		||||
        <!-- The XML keyboard layout of any popup keyboard. -->
 | 
			
		||||
        <attr name="popupKeyboard" format="reference" />
 | 
			
		||||
        <!-- The characters to display in the popup keyboard. -->
 | 
			
		||||
        <attr name="popupCharacters" format="string" />
 | 
			
		||||
        <!-- Key edge flags. -->
 | 
			
		||||
        <attr name="keyEdgeFlags">
 | 
			
		||||
            <!-- Key is anchored to the left of the keyboard. -->
 | 
			
		||||
            <flag name="left" value="1" />
 | 
			
		||||
            <!-- Key is anchored to the right of the keyboard. -->
 | 
			
		||||
            <flag name="right" value="2" />
 | 
			
		||||
        </attr>
 | 
			
		||||
        <!-- Whether this is a modifier key such as Alt or Shift. -->
 | 
			
		||||
        <attr name="isModifier" format="boolean" />
 | 
			
		||||
        <!-- Whether this is a toggle key. -->
 | 
			
		||||
        <attr name="isSticky" format="boolean" />
 | 
			
		||||
        <!-- Whether long-pressing on this key will make it repeat. -->
 | 
			
		||||
        <attr name="isRepeatable" format="boolean" />
 | 
			
		||||
        <!-- The icon to show in the popup preview. -->
 | 
			
		||||
        <attr name="iconPreview" format="reference" />
 | 
			
		||||
        <!-- The string of characters to output when this key is pressed. -->
 | 
			
		||||
        <attr name="keyOutputText" format="string" />
 | 
			
		||||
        <!-- The label to display on the key. -->
 | 
			
		||||
        <attr name="keyLabel" format="string" />
 | 
			
		||||
        <!-- The icon to display on the key instead of the label. -->
 | 
			
		||||
        <attr name="keyIcon" format="reference" />
 | 
			
		||||
        <!-- Mode of the keyboard. If the mode doesn't match the requested keyboard mode, the key will be skipped. -->
 | 
			
		||||
        <attr name="keyboardMode" />
 | 
			
		||||
    </declare-styleable>
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,129 +1,129 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<MyKeyboard xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:keyWidth="10%"
 | 
			
		||||
    android:keyHeight="60dp"
 | 
			
		||||
    android:keyBackground="@color/color_primary_dark"
 | 
			
		||||
    android:keyTextColor="@color/color_accent"
 | 
			
		||||
    android:verticalGap="3px">
 | 
			
		||||
<MyKeyboard xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
    app:keyBackground="@color/color_primary_dark"
 | 
			
		||||
    app:keyHeight="60dp"
 | 
			
		||||
    app:keyTextColor="@color/color_accent"
 | 
			
		||||
    app:keyWidth="10%"
 | 
			
		||||
    app:verticalGap="3px">
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="113"
 | 
			
		||||
            android:keyEdgeFlags="left"
 | 
			
		||||
            android:keyLabel="q" />
 | 
			
		||||
            app:codes="113"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyLabel="q" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="119"
 | 
			
		||||
            android:keyLabel="w" />
 | 
			
		||||
            app:codes="119"
 | 
			
		||||
            app:keyLabel="w" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="101"
 | 
			
		||||
            android:keyLabel="e" />
 | 
			
		||||
            app:codes="101"
 | 
			
		||||
            app:keyLabel="e" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="114"
 | 
			
		||||
            android:keyLabel="r" />
 | 
			
		||||
            app:codes="114"
 | 
			
		||||
            app:keyLabel="r" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="116"
 | 
			
		||||
            android:keyLabel="t" />
 | 
			
		||||
            app:codes="116"
 | 
			
		||||
            app:keyLabel="t" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="121"
 | 
			
		||||
            android:keyLabel="y" />
 | 
			
		||||
            app:codes="121"
 | 
			
		||||
            app:keyLabel="y" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="117"
 | 
			
		||||
            android:keyLabel="u" />
 | 
			
		||||
            app:codes="117"
 | 
			
		||||
            app:keyLabel="u" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="105"
 | 
			
		||||
            android:keyLabel="i" />
 | 
			
		||||
            app:codes="105"
 | 
			
		||||
            app:keyLabel="i" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="111"
 | 
			
		||||
            android:keyLabel="o" />
 | 
			
		||||
            app:codes="111"
 | 
			
		||||
            app:keyLabel="o" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="112"
 | 
			
		||||
            android:keyEdgeFlags="right"
 | 
			
		||||
            android:keyLabel="p" />
 | 
			
		||||
            app:codes="112"
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyLabel="p" />
 | 
			
		||||
    </Row>
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="97"
 | 
			
		||||
            android:horizontalGap="5%"
 | 
			
		||||
            android:keyEdgeFlags="left"
 | 
			
		||||
            android:keyLabel="a" />
 | 
			
		||||
            app:codes="97"
 | 
			
		||||
            app:horizontalGap="5%"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyLabel="a" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="115"
 | 
			
		||||
            android:keyLabel="s" />
 | 
			
		||||
            app:codes="115"
 | 
			
		||||
            app:keyLabel="s" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="100"
 | 
			
		||||
            android:keyLabel="d" />
 | 
			
		||||
            app:codes="100"
 | 
			
		||||
            app:keyLabel="d" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="102"
 | 
			
		||||
            android:keyLabel="f" />
 | 
			
		||||
            app:codes="102"
 | 
			
		||||
            app:keyLabel="f" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="103"
 | 
			
		||||
            android:keyLabel="g" />
 | 
			
		||||
            app:codes="103"
 | 
			
		||||
            app:keyLabel="g" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="104"
 | 
			
		||||
            android:keyLabel="h" />
 | 
			
		||||
            app:codes="104"
 | 
			
		||||
            app:keyLabel="h" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="106"
 | 
			
		||||
            android:keyLabel="j" />
 | 
			
		||||
            app:codes="106"
 | 
			
		||||
            app:keyLabel="j" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="107"
 | 
			
		||||
            android:keyLabel="k" />
 | 
			
		||||
            app:codes="107"
 | 
			
		||||
            app:keyLabel="k" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="108"
 | 
			
		||||
            android:keyLabel="l" />
 | 
			
		||||
            app:codes="108"
 | 
			
		||||
            app:keyLabel="l" />
 | 
			
		||||
    </Row>
 | 
			
		||||
    <Row>
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="-1"
 | 
			
		||||
            android:keyWidth="15%p"
 | 
			
		||||
            android:keyEdgeFlags="left"
 | 
			
		||||
            android:keyIcon="@drawable/ic_caps_outline_vector" />
 | 
			
		||||
            app:codes="-1"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyIcon="@drawable/ic_caps_outline_vector"
 | 
			
		||||
            app:keyWidth="15%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="122"
 | 
			
		||||
            android:keyLabel="z" />
 | 
			
		||||
            app:codes="122"
 | 
			
		||||
            app:keyLabel="z" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="120"
 | 
			
		||||
            android:keyLabel="x" />
 | 
			
		||||
            app:codes="120"
 | 
			
		||||
            app:keyLabel="x" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="99"
 | 
			
		||||
            android:keyLabel="c" />
 | 
			
		||||
            app:codes="99"
 | 
			
		||||
            app:keyLabel="c" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="118"
 | 
			
		||||
            android:keyLabel="v" />
 | 
			
		||||
            app:codes="118"
 | 
			
		||||
            app:keyLabel="v" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="98"
 | 
			
		||||
            android:keyLabel="b" />
 | 
			
		||||
            app:codes="98"
 | 
			
		||||
            app:keyLabel="b" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="110"
 | 
			
		||||
            android:keyLabel="n" />
 | 
			
		||||
            app:codes="110"
 | 
			
		||||
            app:keyLabel="n" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="109"
 | 
			
		||||
            android:keyLabel="m" />
 | 
			
		||||
            app:codes="109"
 | 
			
		||||
            app:keyLabel="m" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="-5"
 | 
			
		||||
            android:iconPreview="@null"
 | 
			
		||||
            android:isRepeatable="true"
 | 
			
		||||
            android:keyWidth="15%p"
 | 
			
		||||
            android:keyEdgeFlags="right"
 | 
			
		||||
            android:keyIcon="@drawable/ic_clear_vector" />
 | 
			
		||||
            app:codes="-5"
 | 
			
		||||
            app:iconPreview="@null"
 | 
			
		||||
            app:isRepeatable="true"
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyIcon="@drawable/ic_clear_vector"
 | 
			
		||||
            app:keyWidth="15%p" />
 | 
			
		||||
    </Row>
 | 
			
		||||
    <Row android:rowEdgeFlags="bottom">
 | 
			
		||||
    <Row app:rowEdgeFlags="bottom">
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="44"
 | 
			
		||||
            android:keyWidth="10%p"
 | 
			
		||||
            android:keyEdgeFlags="left"
 | 
			
		||||
            android:keyLabel="," />
 | 
			
		||||
            app:codes="44"
 | 
			
		||||
            app:keyEdgeFlags="left"
 | 
			
		||||
            app:keyLabel=","
 | 
			
		||||
            app:keyWidth="10%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="32"
 | 
			
		||||
            android:iconPreview="@null"
 | 
			
		||||
            android:isRepeatable="true"
 | 
			
		||||
            android:keyWidth="60%p"
 | 
			
		||||
            android:keyLabel="" />
 | 
			
		||||
            app:codes="32"
 | 
			
		||||
            app:iconPreview="@null"
 | 
			
		||||
            app:isRepeatable="true"
 | 
			
		||||
            app:keyLabel=""
 | 
			
		||||
            app:keyWidth="60%p" />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="46"
 | 
			
		||||
            android:keyLabel="." />
 | 
			
		||||
            app:codes="46"
 | 
			
		||||
            app:keyLabel="." />
 | 
			
		||||
        <Key
 | 
			
		||||
            android:codes="-4"
 | 
			
		||||
            android:keyWidth="20%p"
 | 
			
		||||
            android:keyEdgeFlags="right"
 | 
			
		||||
            android:keyIcon="@drawable/ic_enter_vector" />
 | 
			
		||||
            app:codes="-4"
 | 
			
		||||
            app:keyEdgeFlags="right"
 | 
			
		||||
            app:keyIcon="@drawable/ic_enter_vector"
 | 
			
		||||
            app:keyWidth="20%p" />
 | 
			
		||||
    </Row>
 | 
			
		||||
</MyKeyboard>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user