Update AltPages to List<Row> instead of Keyboard

This commit is contained in:
Aleksandras Kostarevas 2024-08-24 15:02:37 +03:00
parent 2e883781d5
commit 942fe63d96
3 changed files with 5 additions and 13 deletions

View File

@ -85,11 +85,7 @@ rows:
- "$delete" - "$delete"
altPages: altPages:
- name: International Phonetic Alphabet - - letters:
minimumFunctionalKeyWidth: 0.0
attributes: *attrs
rows:
- letters:
- "i" - "i"
- "y" - "y"
- "$gap" - "$gap"
@ -158,11 +154,7 @@ altPages:
- "ɑ" - "ɑ"
- "ɒ" - "ɒ"
- "$delete" - "$delete"
- name: International Phonetic Alphabet - - letters:
minimumFunctionalKeyWidth: 0.0
attributes: *attrs
rows:
- letters:
- "ɓ̥" - "ɓ̥"
- "ɓ" - "ɓ"
- "ɗ̥" - "ɗ̥"

View File

@ -149,9 +149,7 @@ data class Keyboard(
val minimumFunctionalKeyWidth: Float = 0.125f, val minimumFunctionalKeyWidth: Float = 0.125f,
val minimumBottomRowFunctionalKeyWidth: Float = 0.15f, val minimumBottomRowFunctionalKeyWidth: Float = 0.15f,
// TODO: These should probably be lists of List<Row> or similar, val altPages: List<List<Row>> = listOf()
// it doesn't make sense to declare name and description repeatedly
val altPages: List<Keyboard> = listOf()
) { ) {
var id: String = "" var id: String = ""

View File

@ -169,6 +169,8 @@ class KeyboardLayoutSetV2 internal constructor(
val baseElement = element.copy(page = KeyboardLayoutPage.Base) val baseElement = element.copy(page = KeyboardLayoutPage.Base)
val baseLayout = elements[baseElement] val baseLayout = elements[baseElement]
baseLayout?.altPages?.get(altIdx) baseLayout?.altPages?.get(altIdx)
}?.let {
mainLayout.copy(definedRows = it)
} }
} ?: run { } ?: run {
// If all else fails, show the error layout // If all else fails, show the error layout