abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Theme.java
diff options
context:
space:
mode:
authorJules Aguillon2021-12-28 17:53:58 +0100
committerJules Aguillon2021-12-28 17:53:58 +0100
commit93704cca0ace3bff31dea5d3841ba185ad89398a (patch)
treed2e69c5191f347cd8de9d7b2cbdd4493e2c13a4c /srcs/juloo.keyboard2/Theme.java
parent15ce200ce3f9d19f1a1f1fb43f176bf511f14271 (diff)
downloadunexpected-keyboard-93704cca0ace3bff31dea5d3841ba185ad89398a.tar.gz
unexpected-keyboard-93704cca0ace3bff31dea5d3841ba185ad89398a.zip
Reference the "special key font" in the Theme object
Remove the last cast of the context.
Diffstat (limited to 'srcs/juloo.keyboard2/Theme.java')
-rw-r--r--srcs/juloo.keyboard2/Theme.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java
index 60c9b88..af2f3d7 100644
--- a/srcs/juloo.keyboard2/Theme.java
+++ b/srcs/juloo.keyboard2/Theme.java
@@ -35,9 +35,9 @@ public class Theme
keyDownBgPaint.setColor(res.getColor(R.color.key_down_bg));
_keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null);
_keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null);
- Typeface specialKeysFont = ((Keyboard2)context).getSpecialKeyFont();
- _specialKeyLabelPaint = initLabelPaint(Paint.Align.CENTER, specialKeysFont);
- _specialKeySubLabelPaint = initLabelPaint(Paint.Align.LEFT, specialKeysFont);
+ Typeface specialKeyFont = getSpecialKeyFont(context);
+ _specialKeyLabelPaint = initLabelPaint(Paint.Align.CENTER, specialKeyFont);
+ _specialKeySubLabelPaint = initLabelPaint(Paint.Align.LEFT, specialKeyFont);
}
public Paint labelPaint(boolean special_font)
@@ -61,4 +61,15 @@ public class Theme
paint.setTypeface(font);
return (paint);
}
+
+ private static Typeface _specialKeyFont = null;
+
+ static public Typeface getSpecialKeyFont(Context context)
+ {
+ if (_specialKeyFont == null)
+ {
+ _specialKeyFont = Typeface.createFromAsset(context.getAssets(), "fonts/keys.ttf");
+ }
+ return _specialKeyFont;
+ }
}