Add emoji key
This commit is contained in:
parent
2b052f4c7c
commit
71e6b63158
|
@ -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" />
|
||||
|
|
|
@ -119,10 +119,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" />
|
||||
|
|
Loading…
Reference in New Issue