diff options
| author | Jules Aguillon | 2022-10-24 00:27:49 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2022-10-24 00:27:49 +0200 |
| commit | 2e598a4d476fde86484cb551c4be77dc5298e7b0 (patch) | |
| tree | 4248338974ad49650abf63e6845779141f4ed79b /srcs/juloo.keyboard2/Keyboard2View.java | |
| parent | e01a2733b14e6c19cad3b5048a0b43f0563d7d51 (diff) | |
| download | unexpected-keyboard-2e598a4d476fde86484cb551c4be77dc5298e7b0.tar.gz unexpected-keyboard-2e598a4d476fde86484cb551c4be77dc5298e7b0.zip | |
Draw letter indication on the pin layout
There is no way to type letters on the pin layout, the indication are
decoration only.
Use the E.161 standard.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 7955aca..d82b58a 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -267,6 +267,10 @@ public class Keyboard2View extends View drawSubLabel(canvas, k.key2, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.TOP, isKeyDown); drawSubLabel(canvas, k.key4, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.BOTTOM, isKeyDown); } + if (k.indication != null) + { + drawIndication(canvas, k.indication, keyW / 2f + x, y, keyH); + } x += _keyWidth * k.width; } y += row.height * _config.keyHeight; @@ -309,7 +313,9 @@ public class Keyboard2View extends View canvas.drawText(kv.getString(), x, (keyH - p.ascent() - p.descent()) / 2f + y, p); } - private void drawSubLabel(Canvas canvas, KeyboardData.Corner k, float x, float y, float keyW, float keyH, Paint.Align a, Vertical v, boolean isKeyDown) + private void drawSubLabel(Canvas canvas, KeyboardData.Corner k, float x, + float y, float keyW, float keyH, Paint.Align a, Vertical v, + boolean isKeyDown) { if (k == null) return; @@ -332,6 +338,17 @@ public class Keyboard2View extends View canvas.drawText(kv.getString(), x, y, p); } + private void drawIndication(Canvas canvas, String indication, float x, + float y, float keyH) + { + float textSize = keyH * _config.sublabelTextSize * _config.characterSize; + Paint p = _theme.indicationPaint(); + p.setColor(_theme.subLabelColor); + p.setTextSize(textSize); + canvas.drawText(indication, x, + (keyH - p.ascent() - p.descent()) * 4/5 + y, p); + } + private float scaleTextSize(KeyValue k, float rel_size, float keyH) { float smaller_font = k.hasFlags(KeyValue.FLAG_SMALLER_FONT) ? 0.75f : 1.f; |
