Added contentDescriptions for the keys and a new string resource

This commit is contained in:
merkost
2023-06-07 14:04:05 +10:00
parent 9901cfbc10
commit 52836b8e5f
4 changed files with 39 additions and 2 deletions

View File

@ -222,6 +222,41 @@ class MyKeyboard {
a.recycle()
}
/**
* Content description for talkback functional
*/
fun getContentDescription(context: Context): CharSequence {
return when (code) {
KEYCODE_SHIFT -> {
context.getString(R.string.keycode_shift)
}
KEYCODE_MODE_CHANGE -> {
context.getString(R.string.keycode_mode_change)
}
KEYCODE_ENTER -> {
context.getString(R.string.keycode_enter)
}
KEYCODE_DELETE -> {
context.getString(R.string.keycode_delete)
}
KEYCODE_SPACE -> {
context.getString(R.string.keycode_space)
}
KEYCODE_EMOJI -> {
context.getString(R.string.emojis)
}
else -> {
label
}
}
}
/** Create an empty key with no attributes. */
init {
height = parent.defaultHeight