Add a margin between "123" and the mic icon.

Bug: 5161711
Change-Id: I04c777c24b9aac4d82eb3adff8e077640a866f61
This commit is contained in:
Yusuke Nojima 2011-08-15 20:43:00 +09:00
parent d4c08d9be3
commit 35775197aa

View file

@ -83,6 +83,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// HORIZONTAL ELLIPSIS "...", character for popup hint. // HORIZONTAL ELLIPSIS "...", character for popup hint.
private static final String POPUP_HINT_CHAR = "\u2026"; private static final String POPUP_HINT_CHAR = "\u2026";
// Margin between the label and the icon on a key that has both of them.
// Specified by the fraction of the key width.
// TODO: Use resource parameter for this value.
private static final float LABEL_ICON_MARGIN = 0.05f;
// Main keyboard // Main keyboard
private Keyboard mKeyboard; private Keyboard mKeyboard;
private final KeyDrawParams mKeyDrawParams; private final KeyDrawParams mKeyDrawParams;
@ -538,11 +543,13 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
positionX = centerX - labelCharWidth * 7 / 4; positionX = centerX - labelCharWidth * 7 / 4;
paint.setTextAlign(Align.LEFT); paint.setTextAlign(Align.LEFT);
} else if (key.hasLabelWithIconLeft() && icon != null) { } else if (key.hasLabelWithIconLeft() && icon != null) {
labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth(); labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth()
+ (int)(LABEL_ICON_MARGIN * keyWidth);
positionX = centerX + labelWidth / 2; positionX = centerX + labelWidth / 2;
paint.setTextAlign(Align.RIGHT); paint.setTextAlign(Align.RIGHT);
} else if (key.hasLabelWithIconRight() && icon != null) { } else if (key.hasLabelWithIconRight() && icon != null) {
labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth(); labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth()
+ (int)(LABEL_ICON_MARGIN * keyWidth);
positionX = centerX - labelWidth / 2; positionX = centerX - labelWidth / 2;
paint.setTextAlign(Align.LEFT); paint.setTextAlign(Align.LEFT);
} else { } else {