fix a bunch of minor issues with custom themes

This commit is contained in:
Helium314 2023-07-26 13:26:19 +02:00
parent 3c060ddfa5
commit 6fafac914b
6 changed files with 141 additions and 57 deletions

View file

@ -1108,7 +1108,7 @@ public class Key implements Comparable<Key> {
@Nonnull final Drawable functionalKeyBackground, @Nonnull final Drawable functionalKeyBackground,
@Nonnull final Drawable spacebarBackground) { @Nonnull final Drawable spacebarBackground) {
final Drawable background; final Drawable background;
if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL || mBackgroundType == BACKGROUND_TYPE_STICKY_OFF || mBackgroundType == BACKGROUND_TYPE_STICKY_ON) { if (isFunctional()) {
background = functionalKeyBackground; background = functionalKeyBackground;
} else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) { } else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) {
background = spacebarBackground; background = spacebarBackground;
@ -1140,4 +1140,10 @@ public class Key implements Comparable<Key> {
public boolean isPressed() { public boolean isPressed() {
return mPressed; return mPressed;
} }
public boolean isFunctional() {
return mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL
|| mBackgroundType == BACKGROUND_TYPE_STICKY_OFF
|| mBackgroundType == BACKGROUND_TYPE_STICKY_ON;
}
} }

View file

@ -34,12 +34,11 @@ import android.view.View;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams; import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes; import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes;
import org.dslul.openboard.inputmethod.keyboard.internal.KeyboardIconsSet;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.common.Colors; import org.dslul.openboard.inputmethod.latin.common.Colors;
import org.dslul.openboard.inputmethod.latin.common.Constants; import org.dslul.openboard.inputmethod.latin.common.Constants;
import org.dslul.openboard.inputmethod.latin.common.StringUtils;
import org.dslul.openboard.inputmethod.latin.settings.Settings; import org.dslul.openboard.inputmethod.latin.settings.Settings;
import org.dslul.openboard.inputmethod.latin.suggestions.MoreSuggestionsView;
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils; import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
import java.util.HashSet; import java.util.HashSet;
@ -172,11 +171,8 @@ public class KeyboardView extends View {
mPaint.setAntiAlias(true); mPaint.setAntiAlias(true);
mColors = Settings.getInstance().getCurrent().mColors; mColors = Settings.getInstance().getCurrent().mColors;
if (mColors.isCustom) { if (mColors.isCustom)
getBackground().setColorFilter(mColors.backgroundFilter); getBackground().setColorFilter(mColors.backgroundFilter);
mSpacebarBackground.setColorFilter(mColors.spaceBarFilter); // todo: consider pressed state
mFunctionalKeyBackground.setColorFilter(mColors.functionalKeyBackgroundFilter); // todo: consider pressed state
}
} }
@Nullable @Nullable
@ -381,14 +377,8 @@ public class KeyboardView extends View {
bgX = -padding.left; bgX = -padding.left;
bgY = -padding.top; bgY = -padding.top;
} }
if (mColors.isCustom) { if (mColors.isCustom)
// color filter is applied to background, which is re-used setCustomKeyBackgroundColor(key, getKeyboard(), background);
// action key and normal key share the same background drawable, so we need to select the correct color filter
if (key.isActionKey())
background.setColorFilter(mColors.accentColorFilter);
else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL)
background.setColorFilter(mColors.keyBackgroundFilter);
}
background.setBounds(0, 0, bgWidth, bgHeight); background.setBounds(0, 0, bgWidth, bgHeight);
canvas.translate(bgX, bgY); canvas.translate(bgX, bgY);
background.draw(canvas); background.draw(canvas);
@ -440,18 +430,10 @@ public class KeyboardView extends View {
} }
if (key.isEnabled()) { if (key.isEnabled()) {
paint.setColor(key.selectTextColor(params)); if (mColors.isCustom)
if (mColors.isCustom) { paint.setColor(mColors.keyText);
// set key color only if not in emoji keyboard range else
if (keyboard != null paint.setColor(key.selectTextColor(params));
&& (this.getClass() == MoreSuggestionsView.class
? !StringUtils.probablyContainsEmoji(key.getLabel()) // doesn't contain emoji (MoreSuggestionsView can have letters and emojis)
: (keyboard.mId.mElementId < 10 || keyboard.mId.mElementId > 26) // not showing emoji keyboard (no emojis visible on main keyboard otherwise)
))
paint.setColorFilter(mColors.keyTextFilter);
else
paint.setColorFilter(null);
}
// 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.
if (mKeyTextShadowRadius > 0.0f) { if (mKeyTextShadowRadius > 0.0f) {
paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor); paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor);
@ -474,9 +456,10 @@ public class KeyboardView extends View {
final String hintLabel = key.getHintLabel(); final String hintLabel = key.getHintLabel();
if (hintLabel != null && mShowsHints) { if (hintLabel != null && mShowsHints) {
paint.setTextSize(key.selectHintTextSize(params)); paint.setTextSize(key.selectHintTextSize(params));
paint.setColor(key.selectHintTextColor(params));
if (mColors.isCustom) if (mColors.isCustom)
paint.setColorFilter(mColors.keyHintTextFilter); paint.setColor(mColors.keyHintText);
else
paint.setColor(key.selectHintTextColor(params));
// TODO: Should add a way to specify type face for hint letters // TODO: Should add a way to specify type face for hint letters
paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setTypeface(Typeface.DEFAULT_BOLD);
blendAlpha(paint, params.mAnimAlpha); blendAlpha(paint, params.mAnimAlpha);
@ -529,23 +512,10 @@ public class KeyboardView extends View {
iconY = (keyHeight - iconHeight) / 2; // Align vertically center. iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
} }
final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center. final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
if (mColors.isCustom) { if (mColors.isCustom)
if (key.isActionKey()) { setCustomKeyIconColor(key, icon, keyboard);
// the white icon may not have enough contrast, and can't be adjusted by the user else
icon.setColorFilter(mColors.actionKeyIconColorFilter); icon.clearColorFilter();
} else if (key.isShift()) {
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED
)
icon.setColorFilter(mColors.accentColorFilter);
else
icon.setColorFilter(mColors.keyTextFilter);
} else if (key.getBackgroundType() != Key.BACKGROUND_TYPE_NORMAL) {
icon.setColorFilter(mColors.keyTextFilter);
}
}
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight); drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
} }
@ -633,4 +603,70 @@ public class KeyboardView extends View {
public void deallocateMemory() { public void deallocateMemory() {
freeOffscreenBuffer(); freeOffscreenBuffer();
} }
private void setCustomKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
if (isAccentColoredKey(key)) {
icon.setColorFilter(mColors.actionKeyIconColorFilter);
} else if (key.isShift() && keyboard != null) {
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED
)
icon.setColorFilter(mColors.accentColorFilter); // accent if shifted
else
icon.setColorFilter(mColors.keyTextFilter); // key text if not shifted
} else if (key.getBackgroundType() != Key.BACKGROUND_TYPE_NORMAL) {
icon.setColorFilter(mColors.keyTextFilter);
} else if (this.getClass() == MoreKeysKeyboardView.class) {
// set color filter for long press comma key, should not trigger anywhere else
icon.setColorFilter(mColors.keyTextFilter);
}
}
private void setCustomKeyBackgroundColor(Key key, Keyboard keyboard, Drawable background) {
// color filter is applied to background, which is re-used
// action key and normal key share the same background drawable, so we need to select the correct color filter
if (isAccentColoredKey(key)) { // action key and its popup keys
if (key.isPressed())
background.setColorFilter(mColors.accentPressedColorFilter);
else
background.setColorFilter(mColors.accentColorFilter);
} else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_SPACEBAR) { // space
if (key.isPressed())
background.setColorFilter(mColors.spaceBarPressedFilter);
else
background.setColorFilter(mColors.spaceBarFilter);
} else if (key.isFunctional()) { // shift, 123, delete,...
if (key.isPressed())
background.setColorFilter(mColors.functionalKeyPressedBackgroundFilter);
else
background.setColorFilter(mColors.functionalKeyBackgroundFilter);
} else if (this.getClass() == MoreKeysKeyboardView.class) { // more keys popup (except on action key, which is handled above)
if (key.isPressed())
background.setColorFilter(mColors.backgroundPressedFilter);
else
background.setColorFilter(mColors.backgroundFilter);
} else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL) { // normal keys
if (key.isPressed())
background.setColorFilter(mColors.keyPressedBackgroundFilter);
else
background.setColorFilter(mColors.keyBackgroundFilter);
} else if (keyboard.mId.mElementId >= 10 && keyboard.mId.mElementId <= 26) { // emoji keyboard keys
if (key.isPressed())
background.setColorFilter(mColors.backgroundPressedFilter);
else
background.setColorFilter(mColors.backgroundFilter);
}
}
private boolean isAccentColoredKey(Key key) {
if (key.isActionKey()) return true;
if (this.getClass() != MoreKeysKeyboardView.class) return false;
final String iconName = KeyboardIconsSet.getIconName(key.getIconId());
return iconName.equals(KeyboardIconsSet.NAME_NEXT_KEY)
|| iconName.equals(KeyboardIconsSet.NAME_CLIPBOARD_ACTION_KEY)
|| iconName.equals(KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
}
} }

View file

@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryEntry import org.dslul.openboard.inputmethod.latin.ClipboardHistoryEntry
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager
import org.dslul.openboard.inputmethod.latin.R import org.dslul.openboard.inputmethod.latin.R
import org.dslul.openboard.inputmethod.latin.settings.Settings
class ClipboardAdapter( class ClipboardAdapter(
val clipboardLayoutParams: ClipboardLayoutParams, val clipboardLayoutParams: ClipboardLayoutParams,
@ -77,8 +78,11 @@ class ClipboardAdapter(
override fun onTouch(view: View, event: MotionEvent): Boolean { override fun onTouch(view: View, event: MotionEvent): Boolean {
if (event.actionMasked != MotionEvent.ACTION_DOWN) { if (event.actionMasked != MotionEvent.ACTION_DOWN) {
if (event.actionMasked == MotionEvent.ACTION_UP)
view.background.colorFilter = Settings.getInstance().current.mColors.keyBackgroundFilter
return false return false
} }
view.background.colorFilter = Settings.getInstance().current.mColors.keyPressedBackgroundFilter
keyEventListener.onKeyDown(view.tag as Long) keyEventListener.onKeyDown(view.tag as Long)
return false return false
} }

View file

@ -183,12 +183,18 @@ class ClipboardHistoryView @JvmOverloads constructor(
override fun onTouch(view: View, event: MotionEvent): Boolean { override fun onTouch(view: View, event: MotionEvent): Boolean {
if (event.actionMasked != MotionEvent.ACTION_DOWN) { if (event.actionMasked != MotionEvent.ACTION_DOWN) {
if (view == alphabetKey && event.actionMasked != MotionEvent.ACTION_UP)
alphabetKey.background.colorFilter = Settings.getInstance().current.mColors.functionalKeyBackgroundFilter
return false return false
} }
when (view) { when (view) {
alphabetKey -> keyboardActionListener?.onPressKey( alphabetKey -> {
alphabetKey.background.colorFilter = Settings.getInstance().current.mColors.functionalKeyPressedBackgroundFilter
keyboardActionListener?.onPressKey(
Constants.CODE_ALPHA_FROM_CLIPBOARD, 0 /* repeatCount */, Constants.CODE_ALPHA_FROM_CLIPBOARD, 0 /* repeatCount */,
true /* isSinglePointer */) true /* isSinglePointer */)
}
clearKey -> keyboardActionListener?.onPressKey( clearKey -> keyboardActionListener?.onPressKey(
Constants.CODE_UNSPECIFIED, 0 /* repeatCount */, Constants.CODE_UNSPECIFIED, 0 /* repeatCount */,
true /* isSinglePointer */) true /* isSinglePointer */)

View file

@ -55,6 +55,9 @@ import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static org.dslul.openboard.inputmethod.latin.common.Constants.CODE_ALPHA_FROM_EMOJI;
import static org.dslul.openboard.inputmethod.latin.common.Constants.CODE_DELETE;
import static org.dslul.openboard.inputmethod.latin.common.Constants.CODE_SPACE;
import static org.dslul.openboard.inputmethod.latin.common.Constants.NOT_A_COORDINATE; import static org.dslul.openboard.inputmethod.latin.common.Constants.NOT_A_COORDINATE;
/** /**
@ -317,7 +320,20 @@ public final class EmojiPalettesView extends LinearLayout
*/ */
@Override @Override
public boolean onTouch(final View v, final MotionEvent event) { public boolean onTouch(final View v, final MotionEvent event) {
if (event.getActionMasked() != MotionEvent.ACTION_DOWN) { final int eventCode = event.getActionMasked();
if (eventCode != MotionEvent.ACTION_DOWN) {
if (eventCode == MotionEvent.ACTION_UP) {
final Object tag = v.getTag();
if (!(tag instanceof Integer))
return false;
final int code = (Integer) tag;
if (code == CODE_SPACE)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.spaceBarFilter);
else if (code == CODE_DELETE)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.functionalKeyBackgroundFilter);
else if (code == CODE_ALPHA_FROM_EMOJI)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.functionalKeyBackgroundFilter);
}
return false; return false;
} }
final Object tag = v.getTag(); final Object tag = v.getTag();
@ -325,6 +341,12 @@ public final class EmojiPalettesView extends LinearLayout
return false; return false;
} }
final int code = (Integer) tag; final int code = (Integer) tag;
if (code == CODE_SPACE)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.spaceBarPressedFilter);
else if (code == CODE_DELETE)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.functionalKeyPressedBackgroundFilter);
else if (code == CODE_ALPHA_FROM_EMOJI)
v.getBackground().setColorFilter(Settings.getInstance().getCurrent().mColors.functionalKeyPressedBackgroundFilter);
mKeyboardActionListener.onPressKey( mKeyboardActionListener.onPressKey(
code, 0 /* repeatCount */, true /* isSinglePointer */); code, 0 /* repeatCount */, true /* isSinglePointer */);
// It's important to return false here. Otherwise, {@link #onClick} and touch-down visual // It's important to return false here. Otherwise, {@link #onClick} and touch-down visual

View file

@ -6,9 +6,9 @@ import android.graphics.ColorFilter;
import androidx.core.graphics.BlendModeColorFilterCompat; import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat; import androidx.core.graphics.BlendModeCompat;
import androidx.core.graphics.ColorUtils;
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme; import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme;
import org.dslul.openboard.inputmethod.latin.settings.Settings;
public class Colors { public class Colors {
@ -22,6 +22,7 @@ public class Colors {
public final int keyText; public final int keyText;
public final int keyHintText; public final int keyHintText;
public ColorFilter backgroundFilter; public ColorFilter backgroundFilter;
public ColorFilter backgroundPressedFilter;
public ColorFilter keyBackgroundFilter; public ColorFilter keyBackgroundFilter;
public ColorFilter keyPressedBackgroundFilter; public ColorFilter keyPressedBackgroundFilter;
public ColorFilter functionalKeyBackgroundFilter; public ColorFilter functionalKeyBackgroundFilter;
@ -31,6 +32,7 @@ public class Colors {
public ColorFilter keyTextFilter; // todo: really necessary? public ColorFilter keyTextFilter; // todo: really necessary?
public ColorFilter keyHintTextFilter; // todo: really? color alone should be sufficient i think... test! public ColorFilter keyHintTextFilter; // todo: really? color alone should be sufficient i think... test!
public ColorFilter accentColorFilter; // todo: really necessary? public ColorFilter accentColorFilter; // todo: really necessary?
public ColorFilter accentPressedColorFilter;
public ColorFilter actionKeyIconColorFilter; public ColorFilter actionKeyIconColorFilter;
public Colors(int acc, int bg, int k, int fun, int space, int kt, int kht) { public Colors(int acc, int bg, int k, int fun, int space, int kt, int kht) {
@ -73,33 +75,41 @@ public class Colors {
public void createColorFilters(final boolean hasKeyBorders) { public void createColorFilters(final boolean hasKeyBorders) {
backgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(background, BlendModeCompat.MODULATE); backgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(background, BlendModeCompat.MODULATE);
backgroundPressedFilter = isDarkColor(background)
// todo: below is not working, but why?
// ? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(background, Color.WHITE, 0.1f), BlendModeCompat.MODULATE)
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(background, BlendModeCompat.SCREEN)
: backgroundFilter;
if (hasKeyBorders) { if (hasKeyBorders) {
keyBackgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBackground, BlendModeCompat.MODULATE); keyBackgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBackground, BlendModeCompat.MODULATE);
functionalKeyBackgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(functionalKey, BlendModeCompat.MODULATE); functionalKeyBackgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(functionalKey, BlendModeCompat.MODULATE);
spaceBarFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(spaceBar, BlendModeCompat.MODULATE); spaceBarFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(spaceBar, BlendModeCompat.MODULATE);
keyPressedBackgroundFilter = isDarkColor(keyBackground) keyPressedBackgroundFilter = isDarkColor(keyBackground)
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBackground, BlendModeCompat.SCREEN) ? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(keyBackground, Color.WHITE, 0.1f), BlendModeCompat.MODULATE)
: keyBackgroundFilter; : keyBackgroundFilter;
functionalKeyPressedBackgroundFilter = isDarkColor(functionalKey) functionalKeyPressedBackgroundFilter = isDarkColor(functionalKey)
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(functionalKey, BlendModeCompat.SCREEN) ? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(functionalKey, Color.WHITE, 0.1f), BlendModeCompat.MODULATE)
: functionalKeyBackgroundFilter; : functionalKeyBackgroundFilter;
spaceBarPressedFilter = isDarkColor(spaceBar) spaceBarPressedFilter = isDarkColor(spaceBar)
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(spaceBar, BlendModeCompat.SCREEN) ? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(spaceBar, Color.WHITE, 0.1f), BlendModeCompat.MODULATE)
: spaceBarFilter; : spaceBarFilter;
} else { } else {
// need to set color to background if key borders are disabled, or there will be ugly keys // need to set color to background if key borders are disabled, or there will be ugly keys
keyBackgroundFilter = backgroundFilter; keyBackgroundFilter = backgroundFilter;
functionalKeyBackgroundFilter = backgroundFilter; functionalKeyBackgroundFilter = keyBackgroundFilter;
spaceBarFilter = backgroundFilter; spaceBarFilter = keyBackgroundFilter;
keyPressedBackgroundFilter = isDarkColor(background) keyPressedBackgroundFilter = backgroundPressedFilter;
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(background, BlendModeCompat.SCREEN)
: keyBackgroundFilter;
functionalKeyPressedBackgroundFilter = keyBackgroundFilter; functionalKeyPressedBackgroundFilter = keyBackgroundFilter;
spaceBarPressedFilter = keyBackgroundFilter; spaceBarPressedFilter = keyBackgroundFilter;
} }
// todo: some of these should be modulate (once the base theme is done)
// especially the accent pressed filter should use modulate/screen
keyTextFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyText, BlendModeCompat.SRC_ATOP); keyTextFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyText, BlendModeCompat.SRC_ATOP);
keyHintTextFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyHintText, BlendModeCompat.SRC_ATOP); keyHintTextFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyHintText, BlendModeCompat.SRC_ATOP);
accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(accent, BlendModeCompat.SRC_ATOP); accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(accent, BlendModeCompat.SRC_ATOP);
accentPressedColorFilter = isDarkColor(accent)
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(accent, Color.WHITE, 0.1f), BlendModeCompat.SRC_ATOP)
: BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtils.blendARGB(accent, Color.BLACK, 0.1f), BlendModeCompat.SRC_ATOP);
actionKeyIconColorFilter = isBrightColor(accent) // the white icon may not have enough contrast, and can't be adjusted by the user actionKeyIconColorFilter = isBrightColor(accent) // the white icon may not have enough contrast, and can't be adjusted by the user
? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(Color.DKGRAY, BlendModeCompat.SRC_ATOP) ? BlendModeColorFilterCompat.createBlendModeColorFilterCompat(Color.DKGRAY, BlendModeCompat.SRC_ATOP)
: null; : null;