mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
Inline autofill theming support (#360)
This commit is contained in:
parent
a323baca5f
commit
98fb94de8d
2 changed files with 14 additions and 8 deletions
|
@ -244,7 +244,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
|
||||||
override fun get(color: ColorType): Int = when (color) {
|
override fun get(color: ColorType): Int = when (color) {
|
||||||
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
||||||
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
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
|
TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground
|
||||||
GESTURE_TRAIL -> gesture
|
GESTURE_TRAIL -> gesture
|
||||||
KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON, CLEAR_CLIPBOARD_HISTORY_KEY,
|
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) {
|
override fun get(color: ColorType): Int = when (color) {
|
||||||
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
|
||||||
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
|
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
|
TOOL_BAR_EXPAND_KEY_BACKGROUND -> doubleAdjustedBackground
|
||||||
GESTURE_TRAIL -> gesture
|
GESTURE_TRAIL -> gesture
|
||||||
KEY_TEXT, SUGGESTION_AUTO_CORRECT, REMOVE_SUGGESTION_ICON, CLEAR_CLIPBOARD_HISTORY_KEY, FUNCTIONAL_KEY_TEXT,
|
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_BACKGROUND,
|
||||||
ACTION_KEY_MORE_KEYS_BACKGROUND,
|
ACTION_KEY_MORE_KEYS_BACKGROUND,
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
|
CHIP,
|
||||||
CLEAR_CLIPBOARD_HISTORY_KEY,
|
CLEAR_CLIPBOARD_HISTORY_KEY,
|
||||||
CLIPBOARD_PIN,
|
CLIPBOARD_PIN,
|
||||||
CLIPBOARD_BACKGROUND,
|
CLIPBOARD_BACKGROUND,
|
||||||
|
|
|
@ -10,11 +10,9 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -32,6 +30,9 @@ import androidx.autofill.inline.common.ViewStyle;
|
||||||
import androidx.autofill.inline.v1.InlineSuggestionUi;
|
import androidx.autofill.inline.v1.InlineSuggestionUi;
|
||||||
|
|
||||||
import org.dslul.openboard.inputmethod.latin.R;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -51,32 +52,36 @@ public class InlineAutofillUtils {
|
||||||
|
|
||||||
public static InlineSuggestionsRequest createInlineSuggestionRequest(Context context) {
|
public static InlineSuggestionsRequest createInlineSuggestionRequest(Context context) {
|
||||||
|
|
||||||
|
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||||
|
|
||||||
UiVersions.StylesBuilder stylesBuilder = UiVersions.newStylesBuilder();
|
UiVersions.StylesBuilder stylesBuilder = UiVersions.newStylesBuilder();
|
||||||
@SuppressLint("RestrictedApi") InlineSuggestionUi.Style style = InlineSuggestionUi.newStyleBuilder()
|
@SuppressLint("RestrictedApi") InlineSuggestionUi.Style style = InlineSuggestionUi.newStyleBuilder()
|
||||||
.setSingleIconChipStyle(
|
.setSingleIconChipStyle(
|
||||||
new ViewStyle.Builder()
|
new ViewStyle.Builder()
|
||||||
.setBackground(
|
.setBackground(
|
||||||
Icon.createWithResource(context,
|
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)
|
.setPadding(0, 0, 0, 0)
|
||||||
.build())
|
.build())
|
||||||
.setChipStyle(
|
.setChipStyle(
|
||||||
new ViewStyle.Builder()
|
new ViewStyle.Builder()
|
||||||
.setBackground(
|
.setBackground(
|
||||||
Icon.createWithResource(context,
|
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())
|
.build())
|
||||||
.setStartIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build())
|
.setStartIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build())
|
||||||
.setTitleStyle(
|
.setTitleStyle(
|
||||||
new TextViewStyle.Builder()
|
new TextViewStyle.Builder()
|
||||||
.setLayoutMargin(toPixel(4, context), 0, toPixel(4, context), 0)
|
.setLayoutMargin(toPixel(4, context), 0, toPixel(4, context), 0)
|
||||||
.setTextColor(Color.parseColor("#FF202124"))
|
.setTextColor(colors.get(ColorType.KEY_TEXT))
|
||||||
.setTextSize(12)
|
.setTextSize(12)
|
||||||
.build())
|
.build())
|
||||||
.setSubtitleStyle(
|
.setSubtitleStyle(
|
||||||
new TextViewStyle.Builder()
|
new TextViewStyle.Builder()
|
||||||
.setLayoutMargin(0, 0, toPixel(4, context), 0)
|
.setLayoutMargin(0, 0, toPixel(4, context), 0)
|
||||||
.setTextColor(Color.parseColor("#99202124"))
|
.setTextColor(colors.get(ColorType.KEY_HINT_TEXT))
|
||||||
.setTextSize(10)
|
.setTextSize(10)
|
||||||
.build())
|
.build())
|
||||||
.setEndIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build())
|
.setEndIconStyle(new ImageViewStyle.Builder().setLayoutMargin(0, 0, 0, 0).build())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue