Add emoji key

This commit is contained in:
Naveen
2022-07-30 21:28:01 +05:30
parent 2b052f4c7c
commit 71e6b63158
10 changed files with 90 additions and 45 deletions

View File

@ -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)