forked from extern/Unexpected-Keyboard
Add option for brightness of labels
The brightness value is used as the alpha value when drawing the labels.
This commit is contained in:
parent
4d99bd4f4b
commit
815e30a505
@ -4,6 +4,7 @@
|
||||
<string name="app_name" product="default">Unexpected Keyboard</string>
|
||||
<string name="settings_activity_label">Unexpected Keyboard Settings</string>
|
||||
<string name="pref_category_layout">Layout</string>
|
||||
<string name="pref_label_brightness">Adjust label brightness</string>
|
||||
<string name="pref_layout_title">Change keyboard layout</string>
|
||||
<string name="pref_layout_e_system">System settings</string>
|
||||
<string name="pref_accents_title">Accents</string>
|
||||
|
@ -41,6 +41,7 @@
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_category_style">
|
||||
<ListPreference android:key="theme" android:title="@string/pref_theme" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_theme_entries" android:entryValues="@array/pref_theme_values"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="label_brightness" android:title="@string/pref_label_brightness" android:summary="%s%%" android:defaultValue="100" min="50" max="100"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="keyboard_height" android:title="@string/pref_keyboard_height_title" android:summary="%s%%" android:defaultValue="35" min="25" max="50"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="keyboard_height_landscape" android:title="@string/pref_keyboard_height_landscape_title" android:summary="%s%%" android:defaultValue="50" min="35" max="65"/>
|
||||
|
@ -36,6 +36,7 @@ final class Config
|
||||
public float horizontalMargin;
|
||||
public float keyVerticalInterval;
|
||||
public float keyHorizontalInterval;
|
||||
public int labelBrightness; // 0 - 255
|
||||
public boolean preciseRepeat;
|
||||
public boolean double_tap_lock_shift;
|
||||
public float characterSize; // Ratio
|
||||
@ -131,6 +132,8 @@ final class Config
|
||||
keyHorizontalInterval =
|
||||
getDipPref(dm, _prefs, "key_horizontal_space", keyHorizontalInterval)
|
||||
* horizontalIntervalScale;
|
||||
// Label brightness is used as the alpha channel
|
||||
labelBrightness = _prefs.getInt("label_brightness", 100) * 255 / 100;
|
||||
// Do not substract keyVerticalInterval from keyHeight because this is done
|
||||
// during rendered.
|
||||
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
|
||||
|
@ -327,6 +327,7 @@ public class Keyboard2View extends View
|
||||
float textSize = scaleTextSize(kv, _config.labelTextSize, keyH);
|
||||
Paint p = _theme.labelPaint(kv.hasFlags(KeyValue.FLAG_KEY_FONT));
|
||||
p.setColor(labelColor(kv, isKeyDown, false));
|
||||
p.setAlpha(_config.labelBrightness);
|
||||
p.setTextSize(textSize);
|
||||
canvas.drawText(kv.getString(), x, (keyH - p.ascent() - p.descent()) / 2f + y, p);
|
||||
}
|
||||
@ -343,6 +344,7 @@ public class Keyboard2View extends View
|
||||
float textSize = scaleTextSize(kv, _config.sublabelTextSize, keyH);
|
||||
Paint p = _theme.subLabelPaint(kv.hasFlags(KeyValue.FLAG_KEY_FONT), a);
|
||||
p.setColor(labelColor(kv, isKeyDown, true));
|
||||
p.setAlpha(_config.labelBrightness);
|
||||
p.setTextSize(textSize);
|
||||
float subPadding = _config.keyPadding;
|
||||
if (v == Vertical.CENTER)
|
||||
|
Loading…
Reference in New Issue
Block a user