mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-22 07:13:13 +01:00
Dim secondary keys in every themes
Themes do not dim secondary keys the same way due to the "offset" mechanism. Instead, use a ratio that is the same for every themes. It's still possible to override this ratio per theme.
This commit is contained in:
parent
bb60ed9b13
commit
065d9520e5
@ -11,7 +11,7 @@
|
||||
<attr name="colorLabel" format="color"/>
|
||||
<attr name="colorLabelActivated" format="color"/>
|
||||
<attr name="colorLabelLocked" format="color"/>
|
||||
<attr name="secondaryLightOffset" format="float"/>
|
||||
<attr name="secondaryDimming" format="float"/>
|
||||
<!-- Corner labels -->
|
||||
<attr name="colorSubLabel" format="color"/>
|
||||
<!-- Borders -->
|
||||
@ -38,6 +38,7 @@
|
||||
<item name="keyBorderRadius">5dp</item>
|
||||
<item name="keyBorderWidth">0dp</item>
|
||||
<item name="keyBorderWidthActivated">0dp</item>
|
||||
<item name="secondaryDimming">0.25</item>
|
||||
<item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item>
|
||||
<item name="emoji_key_text" type="color">?attr/colorLabel</item>
|
||||
</style>
|
||||
@ -53,7 +54,6 @@
|
||||
<item name="colorLabelActivated">#3399ff</item>
|
||||
<item name="colorLabelLocked">#33cc33</item>
|
||||
<item name="colorSubLabel">#cccccc</item>
|
||||
<item name="secondaryLightOffset">-0.2</item>
|
||||
<item name="emoji_button_bg" type="color">#202020</item>
|
||||
<item name="emoji_color" type="color">#ffffff</item>
|
||||
</style>
|
||||
@ -72,7 +72,6 @@
|
||||
<item name="colorLabelActivated">#0066cc</item>
|
||||
<item name="colorLabelLocked">#33cc33</item>
|
||||
<item name="colorSubLabel">#333333</item>
|
||||
<item name="secondaryLightOffset">+0.3</item>
|
||||
<item name="emoji_button_bg">#dedede</item>
|
||||
<item name="emoji_color">#000000</item>
|
||||
</style>
|
||||
@ -91,7 +90,6 @@
|
||||
<item name="colorLabelActivated">#009dff</item>
|
||||
<item name="colorLabelLocked">#00ff26</item>
|
||||
<item name="colorSubLabel">#bbbbbb</item>
|
||||
<item name="secondaryLightOffset">-0.25</item>
|
||||
<item name="keyBorderRadius">1dp</item>
|
||||
<item name="emoji_button_bg">#000000</item>
|
||||
<item name="emoji_color">#ffffff</item>
|
||||
@ -114,7 +112,6 @@
|
||||
<item name="colorLabelActivated">#0066cc</item>
|
||||
<item name="colorLabelLocked">#33cc33</item>
|
||||
<item name="colorSubLabel">#333333</item>
|
||||
<item name="secondaryLightOffset">+0.35</item>
|
||||
<item name="emoji_button_bg">#ffffff</item>
|
||||
<item name="emoji_color">#000000</item>
|
||||
</style>
|
||||
@ -133,7 +130,6 @@
|
||||
<item name="colorLabelActivated">#000000</item>
|
||||
<item name="colorLabelLocked">#33cc33</item>
|
||||
<item name="colorSubLabel">#333333</item>
|
||||
<item name="secondaryLightOffset">+0.35</item>
|
||||
<item name="emoji_button_bg">#ffffff</item>
|
||||
<item name="emoji_color">#000000</item>
|
||||
</style>
|
||||
@ -145,7 +141,6 @@
|
||||
<item name="colorLabel">#000000</item>
|
||||
<item name="colorLabelActivated">#ffffff</item>
|
||||
<item name="colorLabelLocked">#e65100</item>
|
||||
<item name="secondaryLightOffset">0.1</item>
|
||||
<item name="colorSubLabel">#333333</item>
|
||||
<item name="keyBorderWidth">0.0dip</item>
|
||||
<item name="keyBorderWidthActivated">0.0dip</item>
|
||||
@ -164,7 +159,6 @@
|
||||
<item name="colorLabel">#000000</item>
|
||||
<item name="colorLabelActivated">#ffffff</item>
|
||||
<item name="colorLabelLocked">#64ffda</item>
|
||||
<item name="secondaryLightOffset">0.0</item>
|
||||
<item name="colorSubLabel">#004d40</item>
|
||||
<item name="keyBorderWidth">0.0dip</item>
|
||||
<item name="keyBorderWidthActivated">0.0dip</item>
|
||||
|
@ -48,8 +48,8 @@ public class Theme
|
||||
activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0);
|
||||
lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0);
|
||||
subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0);
|
||||
float secondaryLightOffset = s.getFloat(R.styleable.keyboard_secondaryLightOffset, 1.f);
|
||||
secondaryLabelColor = adjustLight(labelColor, secondaryLightOffset);
|
||||
secondaryLabelColor = adjustLight(labelColor,
|
||||
s.getFloat(R.styleable.keyboard_secondaryDimming, 0.25f));
|
||||
keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0);
|
||||
keyBorderWidth = s.getDimension(R.styleable.keyboard_keyBorderWidth, 0);
|
||||
keyBorderWidthActivated = s.getDimension(R.styleable.keyboard_keyBorderWidthActivated, 0);
|
||||
@ -85,11 +85,13 @@ public class Theme
|
||||
return _indicationPaint;
|
||||
}
|
||||
|
||||
int adjustLight(int color, float offset)
|
||||
/** Interpolate the 'value' component toward its opposite by 'alpha'. */
|
||||
int adjustLight(int color, float alpha)
|
||||
{
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color, hsv);
|
||||
hsv[2] += offset;
|
||||
float v = hsv[2];
|
||||
hsv[2] = alpha - (2 * alpha - 1) * v;
|
||||
return Color.HSVToColor(hsv);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user