Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions app/src/main/java/be/scri/views/KeyboardView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1050,14 +1050,13 @@ class KeyboardView
paint.typeface = Typeface.DEFAULT
}

paint.color =
if (key.focused) {
Color.WHITE
} else if (key.focused) {
mPrimaryColor.getContrastColor()
} else {
mTextColor
}
// Set key text color based on state: focused keys are white, pressed keys use a contrasting color, otherwise default text color
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can you change this so the comment isn't referring only to light mode, but rather is independent of color mode?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And ideally end a comment that is its own line with a period so it's a complete sentence :)

// Using 'when' makes the logic clearer and avoids evaluating duplicate conditions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this comment, but agree that this is nicer :)

paint.color = when {
key.focused -> Color.WHITE
key.pressed -> mPrimaryColor.getContrastColor()
else -> mTextColor
}

canvas.drawText(
label,
Expand Down
Loading