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

Added ghost key functionality. #961

Merged
merged 3 commits into from
Jul 7, 2024

Conversation

matthew-sirman
Copy link
Contributor

One feature I missed from MessagEase when I switched to thumb-key was that you could swipe the hidden "ghost key" symbols located in the numerical view even from the alphabetical view, provided you knew where they were. I added this functionality for myself, but then added a settings option for it to make it configurable. I'm sharing in case you want to upstream this into the main version but totally up to you :)
The default is to deactivate this setting, so it's an opt-in feature
I have only added the string resource for English, since I don't know a good way to translate this concept.
I've written database migration logic to upgrade to the new version

…are not visible, but exist in the corresponding location in the numerical view.
Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, see comments below. Also run ./gradlew formatKotlin to pass lint.

): SwipeDirection? {
val xD = x.toDouble()
val yD = y.toDouble()

val swipeLength = sqrt(xD.pow(2) + yD.pow(2))

val compositeSwipeType =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit overkill. If ghost keys are enabled, its probably simple enough to just make it EIGHT_WAY

@@ -362,8 +364,19 @@ fun KeyboardScreen(
Row {
row.forEachIndexed { j, key ->
Column {
val ghostKey =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ghost keys should probably be defined in the keyboard definitions themselves, but this is much simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah, maybe. I assume by this you mean a KeyItemC should have an optional reference to another KeyItemC, rather than a KeyItemC having, for example, a ghostSwipes entry (analogous to swipes)?
I would think it's kind of strange to have a ghostSwipes entry, since then you could put any key down. It feels to me like, if you wanted to do that, you should just define them in swipes, rather than using ghost keys to override the numeric key in the same position.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, an additional layer to swipes, or another map. No changes needed for this tho, its good.

Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great, nice job.

### Ghost keys

Enabling `Ghost keys` in keyboard settings will enable swiping hidden symbol keys without switching to the numeric layout.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

name = "ghost_keys_enabled",
defaultValue = DEFAULT_GHOST_KEYS_ENABLED.toString(),
)
val ghostKeysEnabled: Int,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested locally, as is necessary for migrations, and this worked. Nice job.

@@ -362,8 +364,19 @@ fun KeyboardScreen(
Row {
row.forEachIndexed { j, key ->
Column {
val ghostKey =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, an additional layer to swipes, or another map. No changes needed for this tho, its good.

@dessalines dessalines merged commit eb252a5 into dessalines:main Jul 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants