From fbfff03541a8335013180217c9f8d1b923f44f09 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sat, 29 Mar 2025 10:18:27 +0100 Subject: [PATCH] add all_colors color for key text in emoji keyboard, fixes #1058 --- .../java/helium314/keyboard/keyboard/KeyboardView.java | 7 +++++-- .../main/java/helium314/keyboard/latin/common/Colors.kt | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/helium314/keyboard/keyboard/KeyboardView.java b/app/src/main/java/helium314/keyboard/keyboard/KeyboardView.java index 2226e360..33c7dcc8 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/KeyboardView.java +++ b/app/src/main/java/helium314/keyboard/keyboard/KeyboardView.java @@ -27,6 +27,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import helium314.keyboard.keyboard.emoji.EmojiPageKeyboardView; import helium314.keyboard.keyboard.internal.KeyDrawParams; import helium314.keyboard.keyboard.internal.KeyVisualAttributes; import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode; @@ -34,7 +35,7 @@ import helium314.keyboard.latin.R; import helium314.keyboard.latin.common.ColorType; import helium314.keyboard.latin.common.Colors; import helium314.keyboard.latin.common.Constants; -import helium314.keyboard.latin.common.StringUtils; +import helium314.keyboard.latin.common.StringUtilsKt; import helium314.keyboard.latin.settings.Settings; import helium314.keyboard.latin.suggestions.MoreSuggestions; import helium314.keyboard.latin.suggestions.PopupSuggestionsView; @@ -423,10 +424,12 @@ public class KeyboardView extends View { } if (key.isEnabled()) { - if (StringUtils.mightBeEmoji(label)) + if (StringUtilsKt.isEmoji(label)) paint.setColor(key.selectTextColor(params) | 0xFF000000); // ignore alpha for emojis (though actually color isn't applied anyway and we could just set white) else if (key.hasActionKeyBackground()) paint.setColor(mColors.get(ColorType.ACTION_KEY_ICON)); + else if (this instanceof EmojiPageKeyboardView) + paint.setColor(mColors.get(ColorType.EMOJI_KEY_TEXT)); else paint.setColor(key.selectTextColor(params)); // Set a drop shadow for the text if the shadow radius is positive value. diff --git a/app/src/main/java/helium314/keyboard/latin/common/Colors.kt b/app/src/main/java/helium314/keyboard/latin/common/Colors.kt index ffbc13d6..6bc71d46 100644 --- a/app/src/main/java/helium314/keyboard/latin/common/Colors.kt +++ b/app/src/main/java/helium314/keyboard/latin/common/Colors.kt @@ -277,7 +277,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override AUTOFILL_BACKGROUND_CHIP, GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground GESTURE_TRAIL -> gesture - KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON, + KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON, EMOJI_KEY_TEXT, KEY_ICON, ONE_HANDED_MODE_BUTTON, EMOJI_CATEGORY, TOOL_BAR_KEY, FUNCTIONAL_KEY_TEXT -> keyText KEY_HINT_TEXT -> keyHintText SPACE_BAR_TEXT -> spaceBarText @@ -475,7 +475,7 @@ class DefaultColors ( GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground TOOL_BAR_EXPAND_KEY_BACKGROUND, CLIPBOARD_SUGGESTION_BACKGROUND -> doubleAdjustedBackground GESTURE_TRAIL -> gesture - KEY_TEXT, REMOVE_SUGGESTION_ICON, FUNCTIONAL_KEY_TEXT, KEY_ICON -> keyText + KEY_TEXT, REMOVE_SUGGESTION_ICON, FUNCTIONAL_KEY_TEXT, KEY_ICON, EMOJI_KEY_TEXT -> keyText KEY_HINT_TEXT -> keyHintText SPACE_BAR_TEXT -> spaceBarText FUNCTIONAL_KEY_BACKGROUND -> functionalKey @@ -620,6 +620,7 @@ enum class ColorType { CLIPBOARD_PIN, EMOJI_CATEGORY, EMOJI_CATEGORY_SELECTED, + EMOJI_KEY_TEXT, FUNCTIONAL_KEY_TEXT, FUNCTIONAL_KEY_BACKGROUND, GESTURE_TRAIL,