Elide custom keys labels

Make the font smaller for custom keys with a length above 1.
Draw up to 4 characters on keys.
This commit is contained in:
Jules Aguillon 2023-08-06 18:17:59 +02:00
parent 4d10556d49
commit eb56c80ffb
2 changed files with 3 additions and 2 deletions

View File

@ -296,7 +296,7 @@ final class KeyValue
if (str.length() == 1)
return new KeyValue(str, Kind.Char, str.charAt(0), 0);
else
return new KeyValue(str, Kind.String, 0, 0);
return new KeyValue(str, Kind.String, 0, FLAG_SMALLER_FONT);
}
public static KeyValue getKeyByName(String name)

View File

@ -407,7 +407,8 @@ public class Keyboard2View extends View
x += keyW / 2f;
else
x += (a == Paint.Align.LEFT) ? subPadding : keyW - subPadding;
canvas.drawText(kv.getString(), x, y, p);
String label = kv.getString();
canvas.drawText(label, 0, Math.min(4, label.length()), x, y, p);
}
private void drawIndication(Canvas canvas, String indication, float x,