diff options
| author | Jules Aguillon | 2021-12-28 19:12:50 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2021-12-28 19:12:50 +0100 |
| commit | 40b1ec63a932606fb432ee81801acf147e9ee70e (patch) | |
| tree | 8215f0203f449be7b1d2f06199f4ae726e3edd6c /srcs/juloo.keyboard2/Theme.java | |
| parent | 93704cca0ace3bff31dea5d3841ba185ad89398a (diff) | |
| download | unexpected-keyboard-40b1ec63a932606fb432ee81801acf147e9ee70e.tar.gz unexpected-keyboard-40b1ec63a932606fb432ee81801acf147e9ee70e.zip | |
Use the themes abstraction
Themes replace 'colors.xml' and soon will replace 'dimens.xml'.
Diffstat (limited to 'srcs/juloo.keyboard2/Theme.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Theme.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java index af2f3d7..e90074b 100644 --- a/srcs/juloo.keyboard2/Theme.java +++ b/srcs/juloo.keyboard2/Theme.java @@ -2,6 +2,7 @@ package juloo.keyboard2; import android.content.Context; import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.Paint; import android.graphics.Typeface; import android.util.AttributeSet; @@ -24,15 +25,18 @@ public class Theme public Theme(Context context, AttributeSet attrs) { + TypedArray s = context.getTheme().obtainStyledAttributes(attrs, R.styleable.keyboard, 0, R.style.Dark); + keyBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKey, 0)); + keyDownBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKeyActivated, 0)); + // colorKeyboard = s.getColor(R.styleable.keyboard_colorKeyboard, 0); + labelColor = s.getColor(R.styleable.keyboard_colorLabel, 0); + activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0); + lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0); + subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0); + s.recycle(); Resources res = context.getResources(); - lockedColor = res.getColor(R.color.key_label_locked); - activatedColor = res.getColor(R.color.key_label_activated); - labelColor = res.getColor(R.color.key_label); - subLabelColor = res.getColor(R.color.key_sub_label); labelTextSize = res.getDimension(R.dimen.label_text_size); sublabelTextSize = res.getDimension(R.dimen.sublabel_text_size); - keyBgPaint.setColor(res.getColor(R.color.key_bg)); - keyDownBgPaint.setColor(res.getColor(R.color.key_down_bg)); _keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null); _keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null); Typeface specialKeyFont = getSpecialKeyFont(context); |
