diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt index fd0a42536..7a3417260 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/common/Colors.kt @@ -244,7 +244,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override override fun get(color: ColorType): Int = when (color) { TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND, CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent - EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground + CHIP, EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_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, CLEAR_CLIPBOARD_HISTORY_KEY, @@ -442,7 +442,7 @@ class DefaultColors ( override fun get(color: ColorType): Int = when (color) { TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND, CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent - EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground + CHIP, EMOJI_CATEGORY_BACKGROUND, GESTURE_PREVIEW, MORE_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground TOOL_BAR_EXPAND_KEY_BACKGROUND -> doubleAdjustedBackground GESTURE_TRAIL -> gesture KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON, CLEAR_CLIPBOARD_HISTORY_KEY, FUNCTIONAL_KEY_TEXT, @@ -551,6 +551,7 @@ enum class ColorType { ACTION_KEY_BACKGROUND, ACTION_KEY_MORE_KEYS_BACKGROUND, BACKGROUND, + CHIP, CLEAR_CLIPBOARD_HISTORY_KEY, CLIPBOARD_PIN, CLIPBOARD_BACKGROUND, diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java index 4155e595c..34dbea478 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/utils/InlineAutofillUtils.java @@ -10,11 +10,9 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP; import android.annotation.SuppressLint; import android.content.Context; -import android.graphics.Color; import android.graphics.drawable.Icon; import android.os.Build; import android.os.Bundle; -import android.util.Log; import android.util.Size; import android.util.TypedValue; import android.view.ViewGroup; @@ -32,6 +30,9 @@ import androidx.autofill.inline.common.ViewStyle; import androidx.autofill.inline.v1.InlineSuggestionUi; import org.dslul.openboard.inputmethod.latin.R; +import org.dslul.openboard.inputmethod.latin.common.ColorType; +import org.dslul.openboard.inputmethod.latin.common.Colors; +import org.dslul.openboard.inputmethod.latin.settings.Settings; import java.util.ArrayList; import java.util.List; @@ -51,32 +52,36 @@ public class InlineAutofillUtils { public static InlineSuggestionsRequest createInlineSuggestionRequest(Context context) { + final Colors colors = Settings.getInstance().getCurrent().mColors; + UiVersions.StylesBuilder stylesBuilder = UiVersions.newStylesBuilder(); @SuppressLint("RestrictedApi") InlineSuggestionUi.Style style = InlineSuggestionUi.newStyleBuilder() .setSingleIconChipStyle( new ViewStyle.Builder() .setBackground( Icon.createWithResource(context, - androidx.autofill.R.drawable.autofill_inline_suggestion_chip_background)) + androidx.autofill.R.drawable.autofill_inline_suggestion_chip_background) + .setTint(colors.get(ColorType.CHIP))) .setPadding(0, 0, 0, 0) .build()) .setChipStyle( new ViewStyle.Builder() .setBackground( Icon.createWithResource(context, - androidx.autofill.R.drawable.autofill_inline_suggestion_chip_background)) + androidx.autofill.R.drawable.autofill_inline_suggestion_chip_background) + .setTint(colors.get(ColorType.CHIP))) .build()) .setStartIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build()) .setTitleStyle( new TextViewStyle.Builder() .setLayoutMargin(toPixel(4, context), 0, toPixel(4, context), 0) - .setTextColor(Color.parseColor("#FF202124")) + .setTextColor(colors.get(ColorType.KEY_TEXT)) .setTextSize(12) .build()) .setSubtitleStyle( new TextViewStyle.Builder() .setLayoutMargin(0, 0, toPixel(4, context), 0) - .setTextColor(Color.parseColor("#99202124")) + .setTextColor(colors.get(ColorType.KEY_HINT_TEXT)) .setTextSize(10) .build()) .setEndIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build())