Skip to content

Commit 9b6adb0

Browse files
authored
Merge pull request #122 from suttod/main
Add cleanly numeric and phone keyboards
2 parents 6a3415d + 50c2aa3 commit 9b6adb0

File tree

3 files changed

+155
-1
lines changed

3 files changed

+155
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
2828
private val KEYBOARD_LETTERS = 0
2929
private val KEYBOARD_SYMBOLS = 1
3030
private val KEYBOARD_SYMBOLS_SHIFT = 2
31+
private val KEYBOARD_NUMBERS = 3
32+
private val KEYBOARD_PHONE = 4
3133

3234
private var keyboard: MyKeyboard? = null
3335
private var keyboardView: MyKeyboardView? = null
@@ -220,7 +222,15 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
220222

221223
private fun getKeyBoard(): MyKeyboard {
222224
val keyboardXml = when (inputTypeClass) {
223-
TYPE_CLASS_NUMBER, TYPE_CLASS_DATETIME, TYPE_CLASS_PHONE -> {
225+
TYPE_CLASS_NUMBER -> {
226+
keyboardMode = KEYBOARD_NUMBERS
227+
R.xml.keys_numbers
228+
}
229+
TYPE_CLASS_PHONE -> {
230+
keyboardMode = KEYBOARD_PHONE
231+
R.xml.keys_phone
232+
}
233+
TYPE_CLASS_DATETIME -> {
224234
keyboardMode = KEYBOARD_SYMBOLS
225235
R.xml.keys_symbols
226236
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto">
3+
<Row>
4+
<Key
5+
app:keyLabel="1"
6+
app:keyEdgeFlags="left"
7+
app:keyWidth="25%p" />
8+
<Key
9+
app:keyLabel="2"
10+
app:keyWidth="25%p" />
11+
<Key
12+
app:keyLabel="3"
13+
app:keyWidth="25%p" />
14+
<Key
15+
app:keyIcon="@drawable/ic_clear_vector"
16+
app:code="-5"
17+
app:isRepeatable="true"
18+
app:keyEdgeFlags="right"
19+
app:keyWidth="25%p" />
20+
</Row>
21+
<Row>
22+
<Key
23+
app:keyLabel="4"
24+
app:keyEdgeFlags="left"
25+
app:keyWidth="25%p" />
26+
<Key
27+
app:keyLabel="5"
28+
app:keyWidth="25%p" />
29+
<Key
30+
app:keyLabel="6"
31+
app:keyWidth="25%p" />
32+
<Key
33+
app:keyLabel="-"
34+
app:keyEdgeFlags="right"
35+
app:keyWidth="25%p" />
36+
</Row>
37+
<Row>
38+
<Key
39+
app:keyLabel="7"
40+
app:keyEdgeFlags="left"
41+
app:keyWidth="25%p" />
42+
<Key
43+
app:keyLabel="8"
44+
app:keyWidth="25%p" />
45+
<Key
46+
app:keyLabel="9"
47+
app:keyWidth="25%p" />
48+
<Key
49+
app:keyLabel=""
50+
app:code="32"
51+
app:keyEdgeFlags="right"
52+
app:keyWidth="25%p" />
53+
</Row>
54+
<Row>
55+
<Key
56+
app:keyLabel=","
57+
app:keyEdgeFlags="left"
58+
app:keyWidth="25%p" />
59+
<Key
60+
app:keyLabel="0"
61+
app:keyWidth="25%p" />
62+
<Key
63+
app:keyLabel="."
64+
app:keyWidth="25%p" />
65+
<Key
66+
app:keyIcon="@drawable/ic_enter_vector"
67+
app:code="-4"
68+
app:keyEdgeFlags="right"
69+
app:keyWidth="25%p" />
70+
</Row>
71+
</Keyboard>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Keyboard xmlns:app="http://schemas.android.com/apk/res-auto">
3+
<Row>
4+
<Key
5+
app:keyLabel="1"
6+
app:keyEdgeFlags="left"
7+
app:keyWidth="25%p" />
8+
<Key
9+
app:keyLabel="2"
10+
app:keyWidth="25%p" />
11+
<Key
12+
app:keyLabel="3"
13+
app:keyWidth="25%p" />
14+
<Key
15+
app:keyIcon="@drawable/ic_clear_vector"
16+
app:code="-5"
17+
app:isRepeatable="true"
18+
app:keyEdgeFlags="right"
19+
app:keyWidth="25%p" />
20+
</Row>
21+
<Row>
22+
<Key
23+
app:keyLabel="4"
24+
app:keyEdgeFlags="left"
25+
app:keyWidth="25%p" />
26+
<Key
27+
app:keyLabel="5"
28+
app:keyWidth="25%p" />
29+
<Key
30+
app:keyLabel="6"
31+
app:keyWidth="25%p" />
32+
<Key
33+
app:keyEdgeFlags="right"
34+
app:keyWidth="25%p" />
35+
</Row>
36+
<Row>
37+
<Key
38+
app:keyLabel="7"
39+
app:keyEdgeFlags="left"
40+
app:keyWidth="25%p" />
41+
<Key
42+
app:keyLabel="8"
43+
app:keyWidth="25%p" />
44+
<Key
45+
app:keyLabel="9"
46+
app:keyWidth="25%p" />
47+
<Key
48+
app:keyLabel="abc"
49+
app:code="-2"
50+
app:keyEdgeFlags="right"
51+
app:keyWidth="25%p" />
52+
</Row>
53+
<Row>
54+
<Key
55+
app:keyLabel="*"
56+
app:keyEdgeFlags="left"
57+
app:keyWidth="25%p" />
58+
<Key
59+
app:keyLabel="0"
60+
app:topSmallNumber="+"
61+
app:popupKeyboard="@xml/keyboard_popup_template"
62+
app:popupCharacters="+-,."
63+
app:keyWidth="25%p" />
64+
<Key
65+
app:keyLabel="#"
66+
app:keyWidth="25%p" />
67+
<Key
68+
app:keyIcon="@drawable/ic_enter_vector"
69+
app:code="-4"
70+
app:keyEdgeFlags="right"
71+
app:keyWidth="25%p" />
72+
</Row>
73+
</Keyboard>

0 commit comments

Comments
 (0)