adding the alternative symbol keyboards

This commit is contained in:
tibbi 2022-01-15 21:02:38 +01:00
parent 8ce069ca3b
commit 9dc7abaaa7
6 changed files with 278 additions and 5 deletions

View File

@ -312,7 +312,7 @@ class MyKeyboard {
text = a.getText(R.styleable.MyKeyboard_Key_keyOutputText)
topSmallNumber = a.getString(R.styleable.MyKeyboard_Key_topSmallNumber) ?: ""
if (label.isNotEmpty()) {
if (label.isNotEmpty() && codes.firstOrNull() != KEYCODE_MODE_CHANGE) {
codes = arrayListOf(label[0].toInt())
}
a.recycle()

View File

@ -22,7 +22,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
override fun onCreateInputView(): View {
keyboardView = layoutInflater.inflate(R.layout.keyboard_view_keyboard, null) as MyKeyboardView
keyboard = MyKeyboard(this, R.xml.keys_layout)
keyboard = MyKeyboard(this, R.xml.keys_letters)
keyboardView!!.setKeyboard(keyboard!!)
keyboardView!!.onKeyboardActionListener = this
return keyboardView!!
@ -66,6 +66,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
keyboardView!!.invalidateAllKeys()
}
MyKeyboard.KEYCODE_DONE -> inputConnection.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
MyKeyboard.KEYCODE_MODE_CHANGE -> {}
else -> {
var code = primaryCode.toChar()
if (Character.isLetter(code) && keyboard!!.shiftState > SHIFT_OFF) {

View File

@ -879,7 +879,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
mPopupPreviewY += popupHeight
}
if (key.label.isNotEmpty()) {
if (key.label.isNotEmpty() && key.codes.firstOrNull() != KEYCODE_MODE_CHANGE) {
if (previewPopup.isShowing) {
previewPopup.update(mPopupPreviewX, mPopupPreviewY, popupWidth, popupHeight)
} else {

View File

@ -151,15 +151,19 @@
</Row>
<Row app:rowEdgeFlags="bottom">
<Key
app:codes="44"
app:codes="-2"
app:keyEdgeFlags="left"
app:keyLabel="123"
app:keyWidth="15%p" />
<Key
app:codes="44"
app:keyLabel=","
app:keyWidth="10%p" />
<Key
app:codes="32"
app:iconPreview="@null"
app:isRepeatable="true"
app:keyWidth="60%p" />
app:keyWidth="45%p" />
<Key
app:codes="46"
app:keyLabel="." />

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard 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
app:codes="49"
app:keyEdgeFlags="left"
app:keyLabel="1" />
<Key
app:codes="50"
app:keyLabel="2" />
<Key
app:codes="51"
app:keyLabel="3" />
<Key
app:codes="52"
app:keyLabel="4" />
<Key
app:codes="53"
app:keyLabel="5" />
<Key
app:codes="54"
app:keyLabel="6" />
<Key
app:codes="55"
app:keyLabel="7" />
<Key
app:codes="56"
app:keyLabel="8" />
<Key
app:codes="57"
app:keyLabel="9" />
<Key
app:codes="48"
app:keyEdgeFlags="right"
app:keyLabel="0" />
</Row>
<Row>
<Key
app:codes="64"
app:keyEdgeFlags="left"
app:keyLabel="\@" />
<Key
app:codes="35"
app:keyLabel="\#" />
<Key
app:codes="36"
app:keyLabel="$" />
<Key
app:codes="37"
app:keyLabel="%" />
<Key
app:codes="38"
app:keyLabel="&amp;" />
<Key
app:codes="42"
app:keyLabel="*" />
<Key
app:codes="45"
app:keyLabel="-" />
<Key
app:codes="61"
app:keyLabel="=" />
<Key
app:codes="40"
app:keyLabel="(" />
<Key
app:codes="41"
app:keyEdgeFlags="right"
app:keyLabel=")" />
</Row>
<Row>
<Key
app:codes="-1"
app:keyEdgeFlags="left"
app:keyIcon="@drawable/ic_caps_outline_vector"
app:keyWidth="15%p" />
<Key
app:codes="33"
app:keyLabel="!" />
<Key
app:codes="34"
app:keyLabel="&quot;" />
<Key
app:codes="39"
app:keyLabel="\'" />
<Key
app:codes="58"
app:keyLabel=":" />
<Key
app:codes="59"
app:keyLabel=";" />
<Key
app:codes="47"
app:keyLabel="/" />
<Key
app:codes="63"
app:keyLabel="\?" />
<Key
app:codes="-5"
app:isRepeatable="true"
app:keyEdgeFlags="right"
app:keyIcon="@drawable/ic_clear_vector"
app:keyWidth="15%p" />
</Row>
<Row app:rowEdgeFlags="bottom">
<Key
app:codes="-2"
app:keyEdgeFlags="left"
app:keyLabel="abc"
app:keyWidth="15%p" />
<Key
app:codes="44"
app:keyLabel=","
app:keyWidth="10%p" />
<Key
app:codes="32"
app:iconPreview="@null"
app:isRepeatable="true"
app:keyWidth="45%p" />
<Key
app:codes="46"
app:keyLabel="." />
<Key
app:codes="-4"
app:keyEdgeFlags="right"
app:keyIcon="@drawable/ic_enter_vector"
app:keyWidth="20%p" />
</Row>
</Keyboard>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard 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
app:codes="126"
app:keyEdgeFlags="left"
app:keyLabel="~" />
<Key
app:codes="177"
app:keyLabel="±" />
<Key
app:codes="215"
app:keyLabel="×" />
<Key
app:codes="247"
app:keyLabel="÷" />
<Key
app:codes="8226"
app:keyLabel="•" />
<Key
app:codes="176"
app:keyLabel="°" />
<Key
app:codes="96"
app:keyLabel="`" />
<Key
app:codes="180"
app:keyLabel="´" />
<Key
app:codes="123"
app:keyLabel="{" />
<Key
app:codes="125"
app:keyEdgeFlags="right"
app:keyLabel="}" />
</Row>
<Row>
<Key
app:codes="169"
app:keyEdgeFlags="left"
app:keyLabel="©" />
<Key
app:codes="163"
app:keyLabel="£" />
<Key
app:codes="8364"
app:keyLabel="€" />
<Key
app:codes="94"
app:keyLabel="^" />
<Key
app:codes="174"
app:keyLabel="®" />
<Key
app:codes="165"
app:keyLabel="¥" />
<Key
app:codes="95"
app:keyLabel="_" />
<Key
app:codes="43"
app:keyLabel="+" />
<Key
app:codes="91"
app:keyLabel="[" />
<Key
app:codes="93"
app:keyEdgeFlags="right"
app:keyLabel="]" />
</Row>
<Row>
<Key
app:codes="-1"
app:keyEdgeFlags="left"
app:keyIcon="@drawable/ic_caps_outline_vector"
app:keyWidth="15%p" />
<Key
app:codes="161"
app:keyLabel="¡" />
<Key
app:codes="60"
app:keyLabel="&lt;" />
<Key
app:codes="62"
app:keyLabel="&gt;" />
<Key
app:codes="162"
app:keyLabel="¢" />
<Key
app:codes="124"
app:keyLabel="|" />
<Key
app:codes="92"
app:keyLabel="\\" />
<Key
app:codes="191"
app:keyLabel="¿" />
<Key
app:codes="-5"
app:isRepeatable="true"
app:keyEdgeFlags="right"
app:keyIcon="@drawable/ic_clear_vector"
app:keyWidth="15%p" />
</Row>
<Row app:rowEdgeFlags="bottom">
<Key
app:codes="-2"
app:keyEdgeFlags="left"
app:keyLabel="abc"
app:keyWidth="15%p" />
<Key
app:codes="44"
app:keyLabel=","
app:keyWidth="10%p" />
<Key
app:codes="32"
app:iconPreview="@null"
app:isRepeatable="true"
app:keyWidth="45%p" />
<Key
app:codes="46"
app:keyLabel="." />
<Key
app:codes="-4"
app:keyEdgeFlags="right"
app:keyIcon="@drawable/ic_enter_vector"
app:keyWidth="20%p" />
</Row>
</Keyboard>