add all_colors color for key text in emoji keyboard, fixes #1058

This commit is contained in:
Helium314 2025-03-29 10:18:27 +01:00
parent a1f991088d
commit fbfff03541
2 changed files with 8 additions and 4 deletions

View file

@ -27,6 +27,7 @@ import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import helium314.keyboard.keyboard.emoji.EmojiPageKeyboardView;
import helium314.keyboard.keyboard.internal.KeyDrawParams; import helium314.keyboard.keyboard.internal.KeyDrawParams;
import helium314.keyboard.keyboard.internal.KeyVisualAttributes; import helium314.keyboard.keyboard.internal.KeyVisualAttributes;
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode; 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.ColorType;
import helium314.keyboard.latin.common.Colors; import helium314.keyboard.latin.common.Colors;
import helium314.keyboard.latin.common.Constants; 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.settings.Settings;
import helium314.keyboard.latin.suggestions.MoreSuggestions; import helium314.keyboard.latin.suggestions.MoreSuggestions;
import helium314.keyboard.latin.suggestions.PopupSuggestionsView; import helium314.keyboard.latin.suggestions.PopupSuggestionsView;
@ -423,10 +424,12 @@ public class KeyboardView extends View {
} }
if (key.isEnabled()) { 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) 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()) else if (key.hasActionKeyBackground())
paint.setColor(mColors.get(ColorType.ACTION_KEY_ICON)); paint.setColor(mColors.get(ColorType.ACTION_KEY_ICON));
else if (this instanceof EmojiPageKeyboardView)
paint.setColor(mColors.get(ColorType.EMOJI_KEY_TEXT));
else else
paint.setColor(key.selectTextColor(params)); paint.setColor(key.selectTextColor(params));
// Set a drop shadow for the text if the shadow radius is positive value. // Set a drop shadow for the text if the shadow radius is positive value.

View file

@ -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 AUTOFILL_BACKGROUND_CHIP, GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground
GESTURE_TRAIL -> gesture 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_ICON, ONE_HANDED_MODE_BUTTON, EMOJI_CATEGORY, TOOL_BAR_KEY, FUNCTIONAL_KEY_TEXT -> keyText
KEY_HINT_TEXT -> keyHintText KEY_HINT_TEXT -> keyHintText
SPACE_BAR_TEXT -> spaceBarText SPACE_BAR_TEXT -> spaceBarText
@ -475,7 +475,7 @@ class DefaultColors (
GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
TOOL_BAR_EXPAND_KEY_BACKGROUND, CLIPBOARD_SUGGESTION_BACKGROUND -> doubleAdjustedBackground TOOL_BAR_EXPAND_KEY_BACKGROUND, CLIPBOARD_SUGGESTION_BACKGROUND -> doubleAdjustedBackground
GESTURE_TRAIL -> gesture 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 KEY_HINT_TEXT -> keyHintText
SPACE_BAR_TEXT -> spaceBarText SPACE_BAR_TEXT -> spaceBarText
FUNCTIONAL_KEY_BACKGROUND -> functionalKey FUNCTIONAL_KEY_BACKGROUND -> functionalKey
@ -620,6 +620,7 @@ enum class ColorType {
CLIPBOARD_PIN, CLIPBOARD_PIN,
EMOJI_CATEGORY, EMOJI_CATEGORY,
EMOJI_CATEGORY_SELECTED, EMOJI_CATEGORY_SELECTED,
EMOJI_KEY_TEXT,
FUNCTIONAL_KEY_TEXT, FUNCTIONAL_KEY_TEXT,
FUNCTIONAL_KEY_BACKGROUND, FUNCTIONAL_KEY_BACKGROUND,
GESTURE_TRAIL, GESTURE_TRAIL,