From 2596891d4ce3d02d07d6a6ddb886b070eb3b35ed Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 13 Jan 2022 12:28:29 +0100 Subject: [PATCH] show extra buttons on long pressing a top letter --- .../keyboard/helpers/MyKeyboard.kt | 7 +++- .../res/layout/keyboard_popup_keyboard.xml | 1 + app/src/main/res/values/styles.xml | 4 ++ .../main/res/xml/keyboard_popup_template.xml | 6 +++ app/src/main/res/xml/keys_layout.xml | 40 ++++++++++++++----- 5 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/xml/keyboard_popup_template.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/MyKeyboard.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/MyKeyboard.kt index 22aaa6f..f41e800 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/MyKeyboard.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/MyKeyboard.kt @@ -435,7 +435,12 @@ class MyKeyboard { row.defaultHorizontalGap = mDefaultHorizontalGap row.verticalGap = mDefaultVerticalGap row.rowEdgeFlags = EDGE_TOP or EDGE_BOTTOM - val maxColumns = if (columns == -1) Int.MAX_VALUE else columns + val maxColumns = if (columns == -1) { + Int.MAX_VALUE + } else { + columns + } + for (element in characters) { val c = element if (column >= maxColumns || x + mDefaultWidth + horizontalPadding > mDisplayWidth) { diff --git a/app/src/main/res/layout/keyboard_popup_keyboard.xml b/app/src/main/res/layout/keyboard_popup_keyboard.xml index 85d0e20..520738b 100644 --- a/app/src/main/res/layout/keyboard_popup_keyboard.xml +++ b/app/src/main/res/layout/keyboard_popup_keyboard.xml @@ -6,6 +6,7 @@ diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8c22458..5f818a9 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -19,4 +19,8 @@ #BB000000 2.75 + + diff --git a/app/src/main/res/xml/keyboard_popup_template.xml b/app/src/main/res/xml/keyboard_popup_template.xml new file mode 100644 index 0000000..fa28d10 --- /dev/null +++ b/app/src/main/res/xml/keyboard_popup_template.xml @@ -0,0 +1,6 @@ + + diff --git a/app/src/main/res/xml/keys_layout.xml b/app/src/main/res/xml/keys_layout.xml index 873236a..0ec4abe 100644 --- a/app/src/main/res/xml/keys_layout.xml +++ b/app/src/main/res/xml/keys_layout.xml @@ -9,35 +9,55 @@ + app:keyLabel="q" + app:popupCharacters="1" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="w" + app:popupCharacters="2" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="e" + app:popupCharacters="3" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="r" + app:popupCharacters="4" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="t" + app:popupCharacters="5" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="y" + app:popupCharacters="6" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="u" + app:popupCharacters="7" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="i" + app:popupCharacters="8" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="o" + app:popupCharacters="9" + app:popupKeyboard="@xml/keyboard_popup_template" /> + app:keyLabel="p" + app:popupCharacters="0" + app:popupKeyboard="@xml/keyboard_popup_template" />