File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
app/src/main/java/be/scri/views Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1050,14 +1050,13 @@ class KeyboardView
10501050 paint.typeface = Typeface .DEFAULT
10511051 }
10521052
1053- paint.color =
1054- if (key.focused) {
1055- Color .WHITE
1056- } else if (key.focused) {
1057- mPrimaryColor.getContrastColor()
1058- } else {
1059- mTextColor
1060- }
1053+ // Set key text color based on state: focused keys are white, pressed keys use a contrasting color, otherwise default text color
1054+ // Using 'when' makes the logic clearer and avoids evaluating duplicate conditions
1055+ paint.color = when {
1056+ key.focused -> Color .WHITE
1057+ key.pressed -> mPrimaryColor.getContrastColor()
1058+ else -> mTextColor
1059+ }
10611060
10621061 canvas.drawText(
10631062 label,
You can’t perform that action at this time.
0 commit comments