From 270243a782f2f26264eef4d4bd9c6b009bedfc91 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 1 Dec 2023 10:46:13 -0500 Subject: [PATCH] Adding KZ keyboard. Fixes #579 --- .../thumbkey/keyboards/KZThumbKey.kt | 704 ++++++++++++++++++ .../thumbkey/utils/KeyboardLayout.kt | 2 + 2 files changed, 706 insertions(+) create mode 100644 app/src/main/java/com/dessalines/thumbkey/keyboards/KZThumbKey.kt diff --git a/app/src/main/java/com/dessalines/thumbkey/keyboards/KZThumbKey.kt b/app/src/main/java/com/dessalines/thumbkey/keyboards/KZThumbKey.kt new file mode 100644 index 00000000..5c1f3f65 --- /dev/null +++ b/app/src/main/java/com/dessalines/thumbkey/keyboards/KZThumbKey.kt @@ -0,0 +1,704 @@ +package com.dessalines.thumbkey.keyboards + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.ArrowDropDown +import androidx.compose.material.icons.outlined.ArrowDropUp +import androidx.compose.material.icons.outlined.Copyright +import androidx.compose.material.icons.outlined.KeyboardCapslock +import com.dessalines.thumbkey.utils.ColorVariant +import com.dessalines.thumbkey.utils.FontSizeVariant +import com.dessalines.thumbkey.utils.KeyAction +import com.dessalines.thumbkey.utils.KeyC +import com.dessalines.thumbkey.utils.KeyDisplay +import com.dessalines.thumbkey.utils.KeyItemC +import com.dessalines.thumbkey.utils.KeyboardC +import com.dessalines.thumbkey.utils.KeyboardDefinition +import com.dessalines.thumbkey.utils.KeyboardDefinitionModes +import com.dessalines.thumbkey.utils.SwipeDirection +import com.dessalines.thumbkey.utils.SwipeNWay + +val KB_KZ_THUMBKEY_MAIN = + KeyboardC( + listOf( + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("с"), + action = KeyAction.CommitText("с"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("щ"), + action = KeyAction.CommitText("щ"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("й"), + action = KeyAction.CommitText("й"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("э"), + action = KeyAction.CommitText("э"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("р"), + action = KeyAction.CommitText("р"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipeType = SwipeNWay.TWO_WAY_VERTICAL, + swipes = + mapOf( + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("х"), + action = KeyAction.CommitText("х"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("а"), + action = KeyAction.CommitText("а"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipeType = SwipeNWay.FOUR_WAY_DIAGONAL, + swipes = + mapOf( + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("ж"), + action = KeyAction.CommitText("ж"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ә"), + action = KeyAction.CommitText("ә"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("і"), + action = KeyAction.CommitText("і"), + ), + ), + ), + EMOJI_KEY_ITEM, + ), + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("н"), + action = KeyAction.CommitText("н"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("м"), + action = KeyAction.CommitText("м"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("л"), + action = KeyAction.CommitText("л"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ғ"), + action = KeyAction.CommitText("ғ"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("қ"), + action = KeyAction.CommitText("қ"), + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("ң"), + action = KeyAction.CommitText("ң"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("в"), + action = KeyAction.CommitText("в"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("я"), + action = KeyAction.CommitText("я"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("ы"), + action = KeyAction.CommitText("ы"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ь"), + action = KeyAction.CommitText("ь"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("п"), + action = KeyAction.CommitText("п"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("у"), + action = KeyAction.CommitText("у"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("з"), + action = KeyAction.CommitText("з"), + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("г"), + action = KeyAction.CommitText("г"), + ), + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay("к"), + action = KeyAction.CommitText("к"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("е"), + action = KeyAction.CommitText("е"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay("ф"), + action = KeyAction.CommitText("ф"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.IconDisplay(Icons.Outlined.ArrowDropUp), + action = KeyAction.ToggleShiftMode(true), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.IconDisplay(Icons.Outlined.ArrowDropDown), + action = KeyAction.ToggleShiftMode(false), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ү"), + action = KeyAction.CommitText("ү"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ұ"), + action = KeyAction.CommitText("ұ"), + ), + ), + ), + NUMERIC_KEY_ITEM, + ), + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("т"), + action = KeyAction.CommitText("т"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ч"), + action = KeyAction.CommitText("ч"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("ш"), + action = KeyAction.CommitText("ш"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ъ"), + action = KeyAction.CommitText("ъ"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("и"), + action = KeyAction.CommitText("и"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("б"), + action = KeyAction.CommitText("б"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ц"), + action = KeyAction.CommitText("ц"), + ), + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("\""), + action = KeyAction.CommitText("\""), + color = ColorVariant.MUTED, + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("'"), + action = KeyAction.CommitText("'"), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("-"), + action = KeyAction.CommitText("-"), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("."), + action = KeyAction.CommitText("."), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("*"), + action = KeyAction.CommitText("*"), + color = ColorVariant.MUTED, + ), + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay(","), + action = KeyAction.CommitText(","), + color = ColorVariant.MUTED, + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("о"), + action = KeyAction.CommitText("о"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("д"), + action = KeyAction.CommitText("д"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("ю"), + action = KeyAction.CommitText("ю"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ё"), + action = KeyAction.CommitText("ё"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("ө"), + action = KeyAction.CommitText("ө"), + ), + ), + ), + BACKSPACE_KEY_ITEM, + ), + listOf( + SPACEBAR_KEY_ITEM, + RETURN_KEY_ITEM, + ), + ), + ) + +val KB_KZ_THUMBKEY_SHIFTED = + KeyboardC( + listOf( + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("С"), + action = KeyAction.CommitText("С"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Щ"), + action = KeyAction.CommitText("Щ"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Й"), + action = KeyAction.CommitText("Й"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("Э"), + action = KeyAction.CommitText("Э"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("Р"), + action = KeyAction.CommitText("Р"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipeType = SwipeNWay.TWO_WAY_VERTICAL, + swipes = + mapOf( + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("Х"), + action = KeyAction.CommitText("Х"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("А"), + action = KeyAction.CommitText("А"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipeType = SwipeNWay.FOUR_WAY_DIAGONAL, + swipes = + mapOf( + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Ж"), + action = KeyAction.CommitText("Ж"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ә"), + action = KeyAction.CommitText("Ә"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("І"), + action = KeyAction.CommitText("І"), + ), + ), + ), + EMOJI_KEY_ITEM, + ), + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("Н"), + action = KeyAction.CommitText("Н"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("М"), + action = KeyAction.CommitText("М"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("Л"), + action = KeyAction.CommitText("Л"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ғ"), + action = KeyAction.CommitText("Ғ"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Қ"), + action = KeyAction.CommitText("Қ"), + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Ң"), + action = KeyAction.CommitText("Ң"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("В"), + action = KeyAction.CommitText("В"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Я"), + action = KeyAction.CommitText("Я"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("Ы"), + action = KeyAction.CommitText("Ы"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ь"), + action = KeyAction.CommitText("Ь"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("П"), + action = KeyAction.CommitText("П"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("У"), + action = KeyAction.CommitText("У"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("З"), + action = KeyAction.CommitText("З"), + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Г"), + action = KeyAction.CommitText("Г"), + ), + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay("К"), + action = KeyAction.CommitText("К"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("Е"), + action = KeyAction.CommitText("Е"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Ф"), + action = KeyAction.CommitText("Ф"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.IconDisplay(Icons.Outlined.KeyboardCapslock), + capsModeDisplay = KeyDisplay.IconDisplay(Icons.Outlined.Copyright), + action = KeyAction.ToggleCapsLock, + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.IconDisplay(Icons.Outlined.ArrowDropDown), + action = KeyAction.ToggleShiftMode(false), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ү"), + action = KeyAction.CommitText("Ү"), + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ұ"), + action = KeyAction.CommitText("Ұ"), + ), + ), + ), + NUMERIC_KEY_ITEM, + ), + listOf( + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("Т"), + action = KeyAction.CommitText("Т"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ч"), + action = KeyAction.CommitText("Ч"), + ), + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("Ш"), + action = KeyAction.CommitText("Ш"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ъ"), + action = KeyAction.CommitText("Ъ"), + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("И"), + action = KeyAction.CommitText("И"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP to + KeyC( + display = KeyDisplay.TextDisplay("Б"), + action = KeyAction.CommitText("Б"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ц"), + action = KeyAction.CommitText("Ц"), + ), + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("\""), + action = KeyAction.CommitText("\""), + color = ColorVariant.MUTED, + ), + SwipeDirection.TOP_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("'"), + action = KeyAction.CommitText("'"), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("-"), + action = KeyAction.CommitText("-"), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("."), + action = KeyAction.CommitText("."), + color = ColorVariant.MUTED, + ), + SwipeDirection.BOTTOM_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("*"), + action = KeyAction.CommitText("*"), + color = ColorVariant.MUTED, + ), + SwipeDirection.LEFT to + KeyC( + display = KeyDisplay.TextDisplay(","), + action = KeyAction.CommitText(","), + color = ColorVariant.MUTED, + ), + ), + ), + KeyItemC( + center = + KeyC( + display = KeyDisplay.TextDisplay("О"), + action = KeyAction.CommitText("О"), + size = FontSizeVariant.LARGE, + color = ColorVariant.PRIMARY, + ), + swipes = + mapOf( + SwipeDirection.TOP_LEFT to + KeyC( + display = KeyDisplay.TextDisplay("Д"), + action = KeyAction.CommitText("Д"), + ), + SwipeDirection.BOTTOM to + KeyC( + display = KeyDisplay.TextDisplay("Ю"), + action = KeyAction.CommitText("Ю"), + ), + SwipeDirection.RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ё"), + action = KeyAction.CommitText("Ё"), + ), + SwipeDirection.BOTTOM_RIGHT to + KeyC( + display = KeyDisplay.TextDisplay("Ө"), + action = KeyAction.CommitText("Ө"), + ), + ), + ), + BACKSPACE_KEY_ITEM, + ), + listOf( + SPACEBAR_KEY_ITEM, + RETURN_KEY_ITEM, + ), + ), + ) + +val KB_KZ_THUMBKEY: KeyboardDefinition = + KeyboardDefinition( + title = "қазақша thumb-key", + modes = + KeyboardDefinitionModes( + main = KB_KZ_THUMBKEY_MAIN, + shifted = KB_KZ_THUMBKEY_SHIFTED, + numeric = NUMERIC_KEYBOARD, + ), + ) diff --git a/app/src/main/java/com/dessalines/thumbkey/utils/KeyboardLayout.kt b/app/src/main/java/com/dessalines/thumbkey/utils/KeyboardLayout.kt index d8c92bed..af8622c4 100644 --- a/app/src/main/java/com/dessalines/thumbkey/utils/KeyboardLayout.kt +++ b/app/src/main/java/com/dessalines/thumbkey/utils/KeyboardLayout.kt @@ -63,6 +63,7 @@ import com.dessalines.thumbkey.keyboards.KB_JA_THUMBKEY_KATAKANA import com.dessalines.thumbkey.keyboards.KB_JA_TYPESPLIT_HIRAGANA import com.dessalines.thumbkey.keyboards.KB_JA_TYPESPLIT_KATAKANA import com.dessalines.thumbkey.keyboards.KB_KA_THUMBKEY +import com.dessalines.thumbkey.keyboards.KB_KZ_THUMBKEY import com.dessalines.thumbkey.keyboards.KB_LT_THUMBKEY import com.dessalines.thumbkey.keyboards.KB_LV_LTG_THUMBKEY import com.dessalines.thumbkey.keyboards.KB_MATH_THUMBKEY @@ -168,4 +169,5 @@ enum class KeyboardLayout(val index: Int, val keyboardDefinition: KeyboardDefini JATypeSplitKatakana(79, KB_JA_TYPESPLIT_KATAKANA), EUESThumbKey(80, KB_EU_ES_THUMBKEY), ENQwertyFour(81, KB_EN_QWERTYFOUR), + KZThumbKey(82, KB_KZ_THUMBKEY), }