Add emoji key
This commit is contained in:
parent
2b052f4c7c
commit
71e6b63158
10 changed files with 90 additions and 45 deletions
|
@ -12,7 +12,6 @@ import android.view.inputmethod.EditorInfo
|
|||
import android.view.inputmethod.EditorInfo.IME_ACTION_NONE
|
||||
import androidx.annotation.XmlRes
|
||||
import com.simplemobiletools.keyboard.R
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard consists of rows of keys.
|
||||
|
@ -61,6 +60,7 @@ class MyKeyboard {
|
|||
const val KEYCODE_ENTER = -4
|
||||
const val KEYCODE_DELETE = -5
|
||||
const val KEYCODE_SPACE = 32
|
||||
const val KEYCODE_EMOJI = -6
|
||||
|
||||
fun getDimensionOrFraction(a: TypedArray, index: Int, base: Int, defValue: Int): Int {
|
||||
val value = a.peekValue(index) ?: return defValue
|
||||
|
@ -203,7 +203,7 @@ class MyKeyboard {
|
|||
topSmallNumber = a.getString(R.styleable.MyKeyboard_Key_topSmallNumber) ?: ""
|
||||
|
||||
if (label.isNotEmpty() && code != KEYCODE_MODE_CHANGE && code != KEYCODE_SHIFT) {
|
||||
code = label[0].toInt()
|
||||
code = label[0].code
|
||||
}
|
||||
a.recycle()
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ class MyKeyboard {
|
|||
key.x = x
|
||||
key.y = y
|
||||
key.label = character.toString()
|
||||
key.code = character.toInt()
|
||||
key.code = character.code
|
||||
column++
|
||||
x += key.width + key.gap
|
||||
mKeys!!.add(key)
|
||||
|
|
|
@ -122,10 +122,15 @@
|
|||
<Key
|
||||
app:keyLabel="q"
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="z"
|
||||
app:keyWidth="10%p"
|
||||
|
|
|
@ -121,10 +121,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -121,10 +121,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -102,10 +102,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -121,10 +121,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -105,10 +105,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -155,10 +155,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -108,10 +108,15 @@
|
|||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p" />
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p" />
|
||||
|
|
|
@ -6,130 +6,135 @@
|
|||
app:keyLabel="q"
|
||||
app:popupCharacters="1"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="1"/>
|
||||
app:topSmallNumber="1" />
|
||||
<Key
|
||||
app:keyLabel="w"
|
||||
app:popupCharacters="2"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="2"/>
|
||||
app:topSmallNumber="2" />
|
||||
<Key
|
||||
app:keyLabel="e"
|
||||
app:popupCharacters="êè3éëēęė"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="3"/>
|
||||
app:topSmallNumber="3" />
|
||||
<Key
|
||||
app:keyLabel="r"
|
||||
app:popupCharacters="4ř"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="4"/>
|
||||
app:topSmallNumber="4" />
|
||||
<Key
|
||||
app:keyLabel="t"
|
||||
app:popupCharacters="5"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="5"/>
|
||||
app:topSmallNumber="5" />
|
||||
<Key
|
||||
app:keyLabel="y"
|
||||
app:popupCharacters="ÿ6ý¥"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="6"/>
|
||||
app:topSmallNumber="6" />
|
||||
<Key
|
||||
app:keyLabel="u"
|
||||
app:popupCharacters="ūûü7úùű"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="7"/>
|
||||
app:topSmallNumber="7" />
|
||||
<Key
|
||||
app:keyLabel="i"
|
||||
app:popupCharacters="ïīì8íî"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="8"/>
|
||||
app:topSmallNumber="8" />
|
||||
<Key
|
||||
app:keyLabel="o"
|
||||
app:popupCharacters="őõōöôò9ó"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="9"/>
|
||||
app:topSmallNumber="9" />
|
||||
<Key
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyLabel="p"
|
||||
app:popupCharacters="0"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"
|
||||
app:topSmallNumber="0"/>
|
||||
app:topSmallNumber="0" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyLabel="a"
|
||||
app:popupCharacters="áäàâãåāæą"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key
|
||||
app:keyLabel="s"
|
||||
app:popupCharacters="śßš"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key
|
||||
app:keyLabel="d"
|
||||
app:popupCharacters="ďđ"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
<Key app:keyLabel="f"/>
|
||||
<Key app:keyLabel="g"/>
|
||||
<Key app:keyLabel="h"/>
|
||||
<Key app:keyLabel="j"/>
|
||||
<Key app:keyLabel="k"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key app:keyLabel="f" />
|
||||
<Key app:keyLabel="g" />
|
||||
<Key app:keyLabel="h" />
|
||||
<Key app:keyLabel="j" />
|
||||
<Key app:keyLabel="k" />
|
||||
<Key
|
||||
app:keyLabel="l"
|
||||
app:popupCharacters="ĺľł"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyLabel="ñ"/>
|
||||
app:keyLabel="ñ" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:code="-1"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_caps_outline_vector"
|
||||
app:keyWidth="15%p"/>
|
||||
app:keyWidth="15%p" />
|
||||
<Key
|
||||
app:keyLabel="z"
|
||||
app:popupCharacters="źžż"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
<Key app:keyLabel="x"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key app:keyLabel="x" />
|
||||
<Key
|
||||
app:keyLabel="c"
|
||||
app:popupCharacters="čçć"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
<Key app:keyLabel="v"/>
|
||||
<Key app:keyLabel="b"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key app:keyLabel="v" />
|
||||
<Key app:keyLabel="b" />
|
||||
<Key
|
||||
app:keyLabel="n"
|
||||
app:popupCharacters="ňń"
|
||||
app:popupKeyboard="@xml/keyboard_popup_template"/>
|
||||
<Key app:keyLabel="m"/>
|
||||
app:popupKeyboard="@xml/keyboard_popup_template" />
|
||||
<Key app:keyLabel="m" />
|
||||
<Key
|
||||
app:code="-5"
|
||||
app:isRepeatable="true"
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyIcon="@drawable/ic_clear_vector"
|
||||
app:keyWidth="15%p"/>
|
||||
app:keyWidth="15%p" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key
|
||||
app:code="-2"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyLabel="123"
|
||||
app:keyWidth="15%p"/>
|
||||
app:keyWidth="15%p" />
|
||||
<Key
|
||||
app:keyLabel=","
|
||||
app:keyWidth="10%p"/>
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-6"
|
||||
app:keyEdgeFlags="left"
|
||||
app:keyIcon="@drawable/ic_emoji_emotions_outline_vector"
|
||||
app:keyWidth="8%p" />
|
||||
<Key
|
||||
app:code="32"
|
||||
app:isRepeatable="true"
|
||||
app:keyWidth="50%p"/>
|
||||
app:keyWidth="40%p" />
|
||||
<Key
|
||||
app:keyLabel="."
|
||||
app:keyWidth="10%p"/>
|
||||
app:keyWidth="10%p" />
|
||||
<Key
|
||||
app:code="-4"
|
||||
app:keyEdgeFlags="right"
|
||||
app:keyIcon="@drawable/ic_enter_vector"
|
||||
app:keyWidth="15%p"/>
|
||||
app:keyWidth="15%p" />
|
||||
</Row>
|
||||
</Keyboard>
|
||||
|
|
Loading…
Reference in a new issue