Don't elide label of non-string keys

Several non-string keys can have a large label that shouldn't be elided,
for example ctrl, meta, send.

Also, change the cutoff to 3 characters as labels are easily colliding.
This commit is contained in:
Jules Aguillon 2023-08-07 13:11:21 +02:00
parent eeae964ae6
commit 21316b77d7

View File

@ -408,7 +408,11 @@ public class Keyboard2View extends View
else
x += (a == Paint.Align.LEFT) ? subPadding : keyW - subPadding;
String label = kv.getString();
canvas.drawText(label, 0, Math.min(4, label.length()), x, y, p);
int label_len = label.length();
// Limit the label of string keys to 3 characters
if (label_len > 3 && kv.getKind() == KeyValue.Kind.String)
label_len = 3;
canvas.drawText(label, 0, label_len, x, y, p);
}
private void drawIndication(Canvas canvas, String indication, float x,