mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-20 17:00:30 +00:00
allow setting functional and space key colors separately
not exposed to user also fixes minor inconsistencies
This commit is contained in:
parent
f61c76195d
commit
c6411777ab
7 changed files with 25 additions and 21 deletions
|
@ -1108,7 +1108,7 @@ public class Key implements Comparable<Key> {
|
|||
@Nonnull final Drawable functionalKeyBackground,
|
||||
@Nonnull final Drawable spacebarBackground) {
|
||||
final Drawable background;
|
||||
if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL) {
|
||||
if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL || mBackgroundType == BACKGROUND_TYPE_STICKY_OFF || mBackgroundType == BACKGROUND_TYPE_STICKY_ON) {
|
||||
background = functionalKeyBackground;
|
||||
} else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) {
|
||||
background = spacebarBackground;
|
||||
|
|
|
@ -188,6 +188,8 @@ public class KeyboardView extends View {
|
|||
keyHintTextColorFilter = settingsValues.mCustomHintTextColorFilter;
|
||||
keyTextColorFilter = settingsValues.mCustomKeyTextColorFilter;
|
||||
accentColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(settingsValues.mCustomThemeColorAccent, BlendModeCompat.SRC_ATOP);
|
||||
mSpacebarBackground.setColorFilter(settingsValues.mCustomSpaceBarBackgroundColorFilter);
|
||||
mFunctionalKeyBackground.setColorFilter(settingsValues.mCustomFunctionalKeyBackgroundColorFilter);
|
||||
} else {
|
||||
keyHintTextColorFilter = null;
|
||||
keyTextColorFilter = null;
|
||||
|
@ -400,13 +402,10 @@ public class KeyboardView extends View {
|
|||
}
|
||||
if (mCustomTheme) {
|
||||
// color filter is applied to background, which is re-used
|
||||
// but we don't want it applied to "blue" keys
|
||||
// so we always need to select the color filter dependent on the current key
|
||||
// action key and normal key share the same background drawable, so we need to select the correct color filter
|
||||
if (key.isActionKey())
|
||||
background.setColorFilter(accentColorFilter);
|
||||
else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL && key.getCode() < 0 && key.getCode() != Constants.CODE_SWITCH_ALPHA_SYMBOL && key.getCode() != Constants.CODE_OUTPUT_TEXT)
|
||||
background.clearColorFilter();
|
||||
else
|
||||
else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL)
|
||||
background.setColorFilter(keyBgFilter);
|
||||
}
|
||||
background.setBounds(0, 0, bgWidth, bgHeight);
|
||||
|
|
|
@ -63,9 +63,9 @@ class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
|||
init {
|
||||
paint.color = dividerColor
|
||||
paint.strokeWidth = dividerHeight.toFloat()
|
||||
val sv = Settings.getInstance().current
|
||||
if (sv.mCustomTheme)
|
||||
paint.colorFilter = sv.mBackgroundColorFilter
|
||||
val settingsValues = Settings.getInstance().current
|
||||
if (settingsValues.mCustomTheme)
|
||||
paint.colorFilter = settingsValues.mBackgroundColorFilter
|
||||
}
|
||||
|
||||
override fun onDrawOver(canvas: Canvas, parent: RecyclerView, state: State) {
|
||||
|
|
|
@ -102,7 +102,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
setOnClickListener(this@ClipboardHistoryView)
|
||||
}
|
||||
if (settingsValues.mCustomTheme) {
|
||||
alphabetKey.background.colorFilter = settingsValues.mCustomKeyBackgroundColorFilter
|
||||
alphabetKey.background.colorFilter = settingsValues.mCustomFunctionalKeyBackgroundColorFilter
|
||||
alphabetKey.setTextColor(settingsValues.mCustomKeyTextColor)
|
||||
clearKey.colorFilter = settingsValues.mCustomKeyTextColorFilter
|
||||
background.colorFilter = settingsValues.mBackgroundColorFilter
|
||||
|
@ -126,10 +126,10 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
clipboardAdapter.apply {
|
||||
itemBackgroundId = keyBackgroundId
|
||||
itemTypeFace = params.mTypeface
|
||||
val sv = Settings.getInstance().current
|
||||
if (sv.mCustomTheme) {
|
||||
itemTextColor = sv.mCustomKeyTextColor
|
||||
itemBackgroundColorFilter = sv.mCustomKeyBackgroundColorFilter
|
||||
val settingsValues = Settings.getInstance().current
|
||||
if (settingsValues.mCustomTheme) {
|
||||
itemTextColor = settingsValues.mCustomKeyTextColor
|
||||
itemBackgroundColorFilter = settingsValues.mCustomKeyBackgroundColorFilter
|
||||
} else
|
||||
itemTextColor = params.mTextColor
|
||||
itemTextSize = params.mLabelSize.toFloat()
|
||||
|
|
|
@ -272,13 +272,12 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
mSpacebar.setOnClickListener(this);
|
||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mCustomTheme) {
|
||||
final ColorFilter cf = settingsValues.mCustomKeyBackgroundColorFilter;
|
||||
mAlphabetKeyLeft.getBackground().setColorFilter(cf);
|
||||
mSpacebar.getBackground().setColorFilter(cf);
|
||||
mDeleteKey.getBackground().setColorFilter(cf);
|
||||
getBackground().setColorFilter(cf);
|
||||
mAlphabetKeyLeft.getBackground().setColorFilter(settingsValues.mCustomFunctionalKeyBackgroundColorFilter);
|
||||
mSpacebar.getBackground().setColorFilter(settingsValues.mCustomSpaceBarBackgroundColorFilter);
|
||||
mDeleteKey.getBackground().setColorFilter(settingsValues.mCustomFunctionalKeyBackgroundColorFilter);
|
||||
getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||
mEmojiCategoryPageIndicatorView.setColors(settingsValues.mCustomThemeColorAccent, settingsValues.mBackgroundColor);
|
||||
findViewById(R.id.emoji_tab_strip).getBackground().setColorFilter(cf);
|
||||
findViewById(R.id.emoji_tab_strip).getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||
}
|
||||
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||
mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
|
||||
|
|
|
@ -131,6 +131,8 @@ public class SettingsValues {
|
|||
// User-defined colors
|
||||
public final boolean mCustomTheme;
|
||||
public final ColorFilter mCustomKeyBackgroundColorFilter;
|
||||
public final ColorFilter mCustomFunctionalKeyBackgroundColorFilter;
|
||||
public final ColorFilter mCustomSpaceBarBackgroundColorFilter;
|
||||
public final int mBackgroundColor;
|
||||
public final ColorFilter mBackgroundColorFilter;
|
||||
public final ColorFilter mCustomKeyTextColorFilter;
|
||||
|
@ -280,6 +282,8 @@ public class SettingsValues {
|
|||
keyBgColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
||||
mCustomKeyBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(keyBgColor, BlendModeCompat.MODULATE);
|
||||
mCustomHintTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(prefs.getInt(Settings.PREF_THEME_USER_COLOR_HINT_TEXT, Color.WHITE), BlendModeCompat.SRC_ATOP);
|
||||
mCustomFunctionalKeyBackgroundColorFilter = mCustomKeyBackgroundColorFilter;
|
||||
mCustomSpaceBarBackgroundColorFilter = mCustomKeyBackgroundColorFilter;
|
||||
mCustomKeyTextColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_TEXT, Color.WHITE);
|
||||
mCustomKeyTextColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mCustomKeyTextColor, BlendModeCompat.SRC_ATOP);
|
||||
if (mCustomTheme) {
|
||||
|
|
|
@ -182,8 +182,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
mOtherKey.setImageDrawable(iconIncognito);
|
||||
|
||||
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
|
||||
if (settingsValues.mCustomTheme)
|
||||
if (settingsValues.mCustomTheme) {
|
||||
mStripVisibilityGroup.mSuggestionStripView.getBackground().setColorFilter(settingsValues.mBackgroundColorFilter);
|
||||
mClipboardKey.setColorFilter(settingsValues.mCustomKeyTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue