From 8bb38c7ae33114d439bb316b8d729e6d8f50af4d Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Thu, 2 Nov 2023 17:56:56 +0200 Subject: [PATCH] Show visual feedback when will autocorrect --- java/src/org/futo/inputmethod/latin/uix/ActionBar.kt | 8 +++++--- .../src/org/futo/inputmethod/latin/xlm/LanguageModel.java | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt index 05a172f5f..7d576797e 100644 --- a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt +++ b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt @@ -176,6 +176,8 @@ fun RowScope.SuggestionItem(words: SuggestedWords, idx: Int, isPrimary: Boolean, null } + val actualIsPrimary = isPrimary && (words.mWillAutoCorrect || ((wordInfo?.isExactMatch) == true)) + val iconColor = MaterialTheme.colorScheme.onBackground val topSuggestionIcon = painterResource(id = R.drawable.transformer_suggestion) val textButtonModifier = when (wordInfo?.mOriginatesFromTransformerLM) { @@ -188,7 +190,7 @@ fun RowScope.SuggestionItem(words: SuggestedWords, idx: Int, isPrimary: Boolean, ) { draw( topSuggestionIcon.intrinsicSize, - alpha = if(isPrimary){ 1.0f } else { 0.66f } / 1.25f, + alpha = if(actualIsPrimary){ 1.0f } else { 0.66f } / 1.25f, colorFilter = ColorFilter.tint(color = iconColor) ) } @@ -197,12 +199,12 @@ fun RowScope.SuggestionItem(words: SuggestedWords, idx: Int, isPrimary: Boolean, else -> Modifier } - val textModifier = when (isPrimary) { + val textModifier = when (actualIsPrimary) { true -> Modifier false -> Modifier.alpha(0.75f) } - val textStyle = when (isPrimary) { + val textStyle = when (actualIsPrimary) { true -> suggestionStylePrimary false -> suggestionStyleAlternative }.copy(color = MaterialTheme.colorScheme.onBackground) diff --git a/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java b/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java index f9ecfc3c5..b4ec0bd2a 100644 --- a/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java +++ b/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java @@ -240,9 +240,13 @@ public class LanguageModel extends Dictionary { for(int i=0; i