Skip to content
Snippets Groups Projects
Commit 69a649d0 authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Avoid adding shift or delete if any row already has them, not just final row

parent acf17827
No related branches found
No related tags found
No related merge requests found
......@@ -283,20 +283,26 @@ data class Keyboard(
if(find { it.isBottomRow } == null) {
// If action row is not explicitly defined, shift and delete are implicitly added to last row
// (unless they're already there)
val ultimateRow = removeAt(size - 1)
assert(ultimateRow.isLetterRow)
val updatedRow = ultimateRow.copy(
letters = ultimateRow.letters!!.toMutableList().apply {
if(!contains(TemplateShiftKey) && !contains(TemplateDeleteKey)) {
// (unless a row has explicitly defined shift or delete key)
if(!any {
it.isLetterRow && it.letters != null && (
it.letters.contains(TemplateShiftKey)
|| it.letters.contains(TemplateDeleteKey))
}) {
val ultimateRow = removeAt(size - 1)
assert(ultimateRow.isLetterRow)
val updatedRow = ultimateRow.copy(
letters = ultimateRow.letters!!.toMutableList().apply {
add(0, TemplateShiftKey)
add(TemplateDeleteKey)
}
}
)
)
add(updatedRow)
}
add(updatedRow)
// Add default bottom row
add(DefaultBottomRow)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment