Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dakuten and handakuten not composing #782

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ val KB_JA_THUMBKEY_HIRAGANA_MAIN =
center =
KeyC(
display = KeyDisplay.TextDisplay("゛"),
action = KeyAction.CommitText("\u3099"),
action = KeyAction.ComposeLastKey("゛"),
size = FontSizeVariant.LARGE,
color = ColorVariant.PRIMARY,
),
Expand All @@ -365,7 +365,7 @@ val KB_JA_THUMBKEY_HIRAGANA_MAIN =
SwipeDirection.TOP to
KeyC(
display = KeyDisplay.TextDisplay("゜"),
action = KeyAction.CommitText("\u309a"),
action = KeyAction.ComposeLastKey("゜"),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ val KB_JA_THUMBKEY_KATAKANA_MAIN =
center =
KeyC(
display = KeyDisplay.TextDisplay("゛"),
action = KeyAction.CommitText("\u3099"),
action = KeyAction.ComposeLastKey("゛"),
size = FontSizeVariant.LARGE,
color = ColorVariant.PRIMARY,
),
Expand All @@ -365,7 +365,7 @@ val KB_JA_THUMBKEY_KATAKANA_MAIN =
SwipeDirection.TOP to
KeyC(
display = KeyDisplay.TextDisplay("゜"),
action = KeyAction.CommitText("\u309a"),
action = KeyAction.ComposeLastKey("゜"),
),
),
),
Expand Down
58 changes: 58 additions & 0 deletions app/src/main/java/com/dessalines/thumbkey/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,64 @@ fun performKeyAction(
" " -> "\$"
else -> textBefore
}
"゛" ->
when (textBefore) {
"か" -> "が"
"き" -> "ぎ"
"く" -> "ぐ"
"け" -> "げ"
"こ" -> "ご"
"さ" -> "ざ"
"し" -> "じ"
"す" -> "ず"
"せ" -> "ぜ"
"そ" -> "ぞ"
"た" -> "だ"
"ち" -> "ぢ"
"つ" -> "づ"
"て" -> "で"
"と" -> "ど"
"は" -> "ば"
"ひ" -> "び"
"ふ" -> "ぶ"
"へ" -> "べ"
"ほ" -> "ぼ"
"カ" -> "ガ"
"キ" -> "ギ"
"ク" -> "グ"
"ケ" -> "ゲ"
"コ" -> "ゴ"
"サ" -> "ザ"
"シ" -> "ジ"
"ス" -> "ズ"
"セ" -> "ゼ"
"ソ" -> "ゾ"
"タ" -> "ダ"
"チ" -> "ヂ"
"ツ" -> "ヅ"
"テ" -> "デ"
"ト" -> "ド"
"ハ" -> "バ"
"ヒ" -> "ビ"
"フ" -> "ブ"
"ヘ" -> "ベ"
"ホ" -> "ボ"
else -> textBefore
}
"゜" ->
when (textBefore) {
"は" -> "ぱ"
"ひ" -> "ぴ"
"ふ" -> "ぷ"
"へ" -> "ぺ"
"ほ" -> "ぽ"
"ハ" -> "パ"
"ヒ" -> "ピ"
"フ" -> "プ"
"ヘ" -> "ペ"
"ホ" -> "ポ"
else -> textBefore
}
else -> throw IllegalStateException("Invalid key modifier")
}

Expand Down