From e86db53415b4966354a424377d2ccdf9da8a6896 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 11 Jan 2022 11:56:24 +0100 Subject: [PATCH] always use the proper Caps lock icon --- .../simplemobiletools/keyboard/views/MyKeyboardView.kt | 9 +++++++++ 1 file changed, 9 insertions(+) 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 47ee467..537c1db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -599,6 +599,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut // Turn off drop shadow paint.setShadowLayer(0f, 0f, 0f, 0) } else if (key.icon != null) { + if (key.codes.size == 1 && key.codes.contains(-1)) { + val drawableId = if (isShifted()) { + R.drawable.ic_caps_vector + } else { + R.drawable.ic_caps_outline_vector + } + key.icon = resources.getDrawable(drawableId) + } + val drawableX = (key.width - padding.left - padding.right - key.icon!!.intrinsicWidth) / 2 + padding.left val drawableY = (key.height - key.icon!!.intrinsicHeight) / 2 canvas.translate(drawableX.toFloat(), drawableY.toFloat())