diff options
author | 2011-06-28 00:54:14 +0900 | |
---|---|---|
committer | 2011-06-28 01:50:26 +0900 | |
commit | 3040c8bcdd7d4979e48e77b5c779dd2bf14ee9ad (patch) | |
tree | 5aa016afa0b5f5807a63261d7d3d3e4cbb4dc8b9 /java/src | |
parent | 55303bc63440c6a9547e94b4f3486a00696da9b0 (diff) | |
download | latinime-3040c8bcdd7d4979e48e77b5c779dd2bf14ee9ad.tar.gz latinime-3040c8bcdd7d4979e48e77b5c779dd2bf14ee9ad.tar.xz latinime-3040c8bcdd7d4979e48e77b5c779dd2bf14ee9ad.zip |
Draw popup hint "..." by text rendering
Bug: 4959808
Change-Id: I30456b91852904c6801cbdd6476406fd60e84551
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardView.java | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 840e52894..157c2b4e0 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -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); |