Draw popup hint "..." by text rendering

Bug: 4959808
Change-Id: I30456b91852904c6801cbdd6476406fd60e84551
main
Tadashi G. Takaoka 2011-06-28 00:54:14 +09:00
parent 55303bc634
commit 3040c8bcdd
24 changed files with 11 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

View File

@ -64,9 +64,6 @@
<attr name="keyUppercaseLetterInactivatedColor" format="color" />
<attr name="keyUppercaseLetterActivatedColor" format="color" />
<!-- Popup hint icon "..." -->
<attr name="keyPopupHintIcon" format="reference" />
<!-- Layout resource for key press feedback.-->
<attr name="keyPreviewLayout" format="reference" />
<!-- The background for key press feedback. -->

View File

@ -49,7 +49,6 @@
<item name="keyHintLabelColor">#E0E0E4E5</item>
<item name="keyUppercaseLetterInactivatedColor">#66E0E4E5</item>
<item name="keyUppercaseLetterActivatedColor">#CCE0E4E5</item>
<item name="keyPopupHintIcon">@drawable/hint_popup</item>
<item name="keyPreviewLayout">@layout/key_preview</item>
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback</item>
<item name="keyPreviewSpacebarBackground">@drawable/keyboard_key_feedback</item>

View File

@ -100,7 +100,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// Miscellaneous constants
private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1;
// XML attribute
private final int mKeyTextColor;
@ -125,12 +124,14 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
private final int mPreviewOffset;
private final int mPreviewHeight;
private final int mPopupLayout;
private final Drawable mKeyPopupHintIcon;
private final int mKeyHintLetterColor;
private final int mKeyHintLabelColor;
private final int mKeyUppercaseLetterInactivatedColor;
private final int mKeyUppercaseLetterActivatedColor;
// HORIZONTAL ELLIPSIS "...", character for popup hint.
private static final String POPUP_HINT_CHAR = "\u2026";
// Main keyboard
private Keyboard mKeyboard;
private int mKeyLetterSize;
@ -369,7 +370,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mKeyTextColor = a.getColor(R.styleable.KeyboardView_keyTextColor, 0xFF000000);
mKeyTextInactivatedColor = a.getColor(
R.styleable.KeyboardView_keyTextInactivatedColor, 0xFF000000);
mKeyPopupHintIcon = a.getDrawable(R.styleable.KeyboardView_keyPopupHintIcon);
mKeyHintLetterColor = a.getColor(R.styleable.KeyboardView_keyHintLetterColor, 0);
mKeyHintLabelColor = a.getColor(R.styleable.KeyboardView_keyHintLabelColor, 0);
mKeyUppercaseLetterInactivatedColor = a.getColor(
@ -838,19 +838,15 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
}
}
// Draw popup hint icon "...".
// TODO: Draw "..." by text.
// Draw popup hint "..." at the bottom right corner of the key.
if (key.hasPopupHint()) {
final int drawableWidth = keyDrawWidth;
final int drawableHeight = key.mHeight;
final int drawableX = 0;
final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
final Drawable hintIcon = mKeyPopupHintIcon;
drawIcon(canvas, hintIcon, drawableX, drawableY, drawableWidth, drawableHeight);
if (DEBUG_SHOW_ALIGN) {
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
0x80c0c000, new Paint());
}
paint.setTextSize(mKeyHintLetterSize);
paint.setColor(mKeyHintLabelColor);
final int hintX = keyDrawWidth - getLabelCharWidth(paint);
// Using y-coordinate "key.mHeight - paint.descent()" draws "..." just on the bottom
// edge of the key. So we use slightly higher position by multiply descent length by 2.
final int hintY = key.mHeight - (int)paint.descent() * 2;
canvas.drawText(POPUP_HINT_CHAR, hintX, hintY, paint);
}
canvas.translate(-keyDrawX - kbdPaddingLeft, -key.mY - kbdPaddingTop);