mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-20 00:40:29 +00:00
slightly adjust colors, adjust some todos
This commit is contained in:
parent
d517709391
commit
099095e3a3
3 changed files with 14 additions and 8 deletions
|
@ -361,6 +361,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
|||
public static final String THEME_BLACK = "black";
|
||||
public static final String THEME_USER = "user";
|
||||
|
||||
// todo: copies of original themes might need adjustments, though maybe it's only Colors that needs to be adjusted
|
||||
public static Colors getCustomTheme(String theme, Context context, SharedPreferences prefs) {
|
||||
switch (theme) {
|
||||
case THEME_USER:
|
||||
|
@ -369,10 +370,11 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
|||
final int keyTextColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_TEXT, Color.WHITE);
|
||||
final int hintTextColor = prefs.getInt(Settings.PREF_THEME_USER_COLOR_HINT_TEXT, Color.WHITE);
|
||||
final int background = prefs.getInt(Settings.PREF_THEME_USER_COLOR_BACKGROUND, Color.DKGRAY);
|
||||
return new Colors(accent, background, keyBgColor, Colors.darken(keyBgColor), keyBgColor, keyTextColor, hintTextColor);
|
||||
return new Colors(accent, background, keyBgColor, Colors.brightenOrDarken(keyBgColor, true), keyBgColor, keyTextColor, hintTextColor);
|
||||
case THEME_DARK:
|
||||
return new Colors(
|
||||
ContextCompat.getColor(context, R.color.gesture_trail_color_lxx_dark),
|
||||
// colors taken from the drawable
|
||||
Color.parseColor("#263238"),
|
||||
Color.parseColor("#364248"),
|
||||
Color.parseColor("#2d393f"),
|
||||
|
|
|
@ -176,7 +176,10 @@ public class KeyboardView extends View {
|
|||
DrawableCompat.setTintMode(mKeyBackground, PorterDuff.Mode.MULTIPLY);
|
||||
DrawableCompat.setTintMode(mSpacebarBackground, PorterDuff.Mode.MULTIPLY);
|
||||
DrawableCompat.setTintMode(mFunctionalKeyBackground, PorterDuff.Mode.MULTIPLY);
|
||||
getBackground().setColorFilter(mColors.backgroundFilter);
|
||||
if (this.getClass() == MoreKeysKeyboardView.class)
|
||||
getBackground().setColorFilter(mColors.adjustedBackgroundFilter);
|
||||
else
|
||||
getBackground().setColorFilter(mColors.backgroundFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,12 +616,14 @@ public class KeyboardView extends View {
|
|||
if (isAccentColoredKey(key)) {
|
||||
icon.setColorFilter(mColors.actionKeyIconColorFilter);
|
||||
} else if (key.isShift() && keyboard != null) {
|
||||
// todo (idea): replace shift icon with white one and use the normal multiply filters
|
||||
// this could allow different shift icon with nicer coloring
|
||||
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
|
||||
icon.setColorFilter(mColors.accent, PorterDuff.Mode.SRC_ATOP); // accent if shifted, needs SRC_ATOP because of underlying drawable
|
||||
else
|
||||
icon.setColorFilter(mColors.keyTextFilter); // key text if not shifted
|
||||
} else if (key.getBackgroundType() != Key.BACKGROUND_TYPE_NORMAL) {
|
||||
|
@ -640,7 +645,7 @@ public class KeyboardView extends View {
|
|||
} else if (key.isFunctional()) { // shift, 123, delete,...
|
||||
DrawableCompat.setTintList(background, mColors.functionalKeyStateList);
|
||||
} else if (this.getClass() == MoreKeysKeyboardView.class) { // more keys popup (except on action key, which is handled above)
|
||||
DrawableCompat.setTintList(background, mColors.backgroundStateList);
|
||||
DrawableCompat.setTintList(background, mColors.adjustedBackgroundStateList);
|
||||
} else if (key.getBackgroundType() == Key.BACKGROUND_TYPE_NORMAL) { // normal keys
|
||||
DrawableCompat.setTintList(background, mColors.keyStateList);
|
||||
} else if (keyboard.mId.mElementId >= 10 && keyboard.mId.mElementId <= 26) { // emoji keyboard keys
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Colors {
|
|||
public final int spaceBar;
|
||||
public final int keyText;
|
||||
public final int keyHintText;
|
||||
// todo: evaluate which colors, colorFilters and colorStateLists area actually necessary
|
||||
// todo (later): evaluate which colors, colorFilters and colorStateLists area actually necessary
|
||||
public ColorFilter backgroundFilter;
|
||||
public ColorFilter adjustedBackgroundFilter;
|
||||
public ColorFilter keyBackgroundFilter;
|
||||
|
@ -81,15 +81,14 @@ public class Colors {
|
|||
|
||||
public void createColorFilters(final boolean hasKeyBorders) {
|
||||
final int[][] states = new int[][] {
|
||||
// new int[] { android.R.attr.state_checked}, // checked -> todo: when is this happening? there are more states, but when are they used?
|
||||
// new int[] { android.R.attr.state_checked}, // checked -> todo (later): when is this happening? there are more states, but when are they used?
|
||||
new int[] { android.R.attr.state_pressed}, // pressed
|
||||
new int[] { -android.R.attr.state_pressed}, // not pressed
|
||||
};
|
||||
|
||||
backgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(background, BlendModeCompat.MODULATE);
|
||||
|
||||
// todo: use adjusted? or is this just for space bar in no border theme?
|
||||
// maybe for morekeys popup, but then need to set background color there too
|
||||
// color to be used if exact background color would be bad contrast, e.g. more keys popup or no border space bar
|
||||
final int adjustedBackground = brightenOrDarken(background, true);
|
||||
adjustedBackgroundStateList = new ColorStateList(states, new int[] { brightenOrDarken(adjustedBackground, true), adjustedBackground });
|
||||
adjustedBackgroundFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(adjustedBackground, BlendModeCompat.MODULATE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue