diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt index d0910cc..e8f217c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -538,7 +538,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut val canvas = mCanvas canvas!!.clipRect(mDirtyRect) val paint = mPaint - val keyBackground = mKeyBackground val clipRegion = mClipRegion val padding = mPadding val kbdPaddingLeft: Int = paddingLeft @@ -574,6 +573,13 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut continue } + var keyBackground = mKeyBackground + if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_SPACE) { + keyBackground = resources.getDrawable(R.drawable.keyboard_space_background, context.theme) + } else if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { + keyBackground = resources.getDrawable(R.drawable.keyboard_enter_background, context.theme) + } + // Switch the character to uppercase if shift is pressed val label = adjustCase(key.label)?.toString() val bounds = keyBackground!!.bounds @@ -623,22 +629,10 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut key.icon = resources.getDrawable(drawableId) } - val iconWidthToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { - (key.icon!!.intrinsicWidth * 1.2).toInt() - } else { - key.icon!!.intrinsicWidth - } - - val iconHeightToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) { - (key.icon!!.intrinsicHeight * 1.2).toInt() - } else { - key.icon!!.intrinsicHeight - } - - val drawableX = (key.width - iconWidthToUse) / 2 - val drawableY = (key.height - iconHeightToUse) / 2 + val drawableX = (key.width - key.icon!!.intrinsicWidth) / 2 + val drawableY = (key.height - key.icon!!.intrinsicHeight) / 2 canvas.translate(drawableX.toFloat(), drawableY.toFloat()) - key.icon!!.setBounds(0, 0, iconWidthToUse, iconHeightToUse) + key.icon!!.setBounds(0, 0, key.icon!!.intrinsicWidth, key.icon!!.intrinsicHeight) key.icon!!.draw(canvas) canvas.translate(-drawableX.toFloat(), -drawableY.toFloat()) } diff --git a/app/src/main/res/drawable/btn_keyboard_key.xml b/app/src/main/res/drawable/btn_keyboard_key.xml deleted file mode 100644 index 2a74309..0000000 --- a/app/src/main/res/drawable/btn_keyboard_key.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/btn_keyboard_key_normal.9.png b/app/src/main/res/drawable/btn_keyboard_key_normal.9.png deleted file mode 100644 index 42c7c14..0000000 Binary files a/app/src/main/res/drawable/btn_keyboard_key_normal.9.png and /dev/null differ diff --git a/app/src/main/res/drawable/btn_keyboard_key_pressed.9.png b/app/src/main/res/drawable/btn_keyboard_key_pressed.9.png deleted file mode 100644 index e047eaf..0000000 Binary files a/app/src/main/res/drawable/btn_keyboard_key_pressed.9.png and /dev/null differ diff --git a/app/src/main/res/drawable/keyboard_enter_background.xml b/app/src/main/res/drawable/keyboard_enter_background.xml index 3006236..5bf8f3e 100644 --- a/app/src/main/res/drawable/keyboard_enter_background.xml +++ b/app/src/main/res/drawable/keyboard_enter_background.xml @@ -1,9 +1,14 @@ - + - - + + diff --git a/app/src/main/res/drawable/keyboard_space_background.xml b/app/src/main/res/drawable/keyboard_space_background.xml index 3006236..cfb061b 100644 --- a/app/src/main/res/drawable/keyboard_space_background.xml +++ b/app/src/main/res/drawable/keyboard_space_background.xml @@ -1,9 +1,14 @@ - + - - + + diff --git a/app/src/main/res/drawable/keyboard_key_feedback_background.xml b/app/src/main/res/drawable/minikeyboard_background.xml similarity index 82% rename from app/src/main/res/drawable/keyboard_key_feedback_background.xml rename to app/src/main/res/drawable/minikeyboard_background.xml index 3006236..67572b9 100644 --- a/app/src/main/res/drawable/keyboard_key_feedback_background.xml +++ b/app/src/main/res/drawable/minikeyboard_background.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/minikeyboard_key_selector.xml b/app/src/main/res/drawable/minikeyboard_key_selector.xml new file mode 100644 index 0000000..e081682 --- /dev/null +++ b/app/src/main/res/drawable/minikeyboard_key_selector.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/drawable/minikeyboard_selected_background.xml b/app/src/main/res/drawable/minikeyboard_selected_background.xml new file mode 100644 index 0000000..8227077 --- /dev/null +++ b/app/src/main/res/drawable/minikeyboard_selected_background.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/keyboard_key_preview.xml b/app/src/main/res/layout/keyboard_key_preview.xml index 608279c..ddcee79 100644 --- a/app/src/main/res/layout/keyboard_key_preview.xml +++ b/app/src/main/res/layout/keyboard_key_preview.xml @@ -1,7 +1,7 @@