aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-06-15 12:36:53 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-06-16 21:24:19 +0900
commit9d9522abdcee70408c9e99ac20c8e1c224eef19d (patch)
treedb71639a4f827e606390ab8a77e9edfbcac83d68 /java/src
parenta61967330e6086a99373e21ad03323af81aa17ed (diff)
downloadlatinime-9d9522abdcee70408c9e99ac20c8e1c224eef19d.tar.gz
latinime-9d9522abdcee70408c9e99ac20c8e1c224eef19d.tar.xz
latinime-9d9522abdcee70408c9e99ac20c8e1c224eef19d.zip
Add Key.keyHintLabel and remove Key.keyHintIcon
This change also removes manualTemporaryUpperCaseCode and manualTemporaryUpperCaseHintIcon. Instead of these keyLabelOption now has hasUppercaseLetter flag value. Bug: 4436327 Change-Id: I88fdac1e888a7123735296f5ef45f5fdd565cd2e
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java37
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyStyles.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java3
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java140
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java10
5 files changed, 119 insertions, 73 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index cb529461a..e5ee272a2 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -37,25 +37,24 @@ public class Key {
* The key code (unicode or custom code) that this key generates.
*/
public final int mCode;
- /** The unicode that this key generates in manual temporary upper case mode. */
- public final int mManualTemporaryUpperCaseCode;
/** Label to display */
public final CharSequence mLabel;
+ /** Hint letter to display on the key in conjunction with the label */
+ public final CharSequence mHintLetter;
/** Option of the label */
public final int mLabelOption;
+ public static final int LABEL_OPTION_ALIGN_LEFT = 0x01;
+ public static final int LABEL_OPTION_ALIGN_RIGHT = 0x02;
+ public static final int LABEL_OPTION_ALIGN_BOTTOM = 0x08;
+ public static final int LABEL_OPTION_FONT_NORMAL = 0x10;
+ private static final int LABEL_OPTION_POPUP_HINT = 0x20;
+ private static final int LABEL_OPTION_HAS_UPPERCASE_LETTER = 0x40;
/** Icon to display instead of a label. Icon takes precedence over a label */
private Drawable mIcon;
/** Preview version of the icon, for the preview popup */
private Drawable mPreviewIcon;
- /** Hint icon to display on the key in conjunction with the label */
- public final Drawable mHintIcon;
- /**
- * The hint icon to display on the key when keyboard is in manual temporary upper case
- * mode.
- */
- public final Drawable mManualTemporaryUpperCaseHintIcon;
/** Width of the key, not including the gap */
public final int mWidth;
@@ -154,9 +153,7 @@ public class Key {
mVisualInsetsLeft = mVisualInsetsRight = 0;
mWidth = width - mGap;
mEdgeFlags = edgeFlags;
- mHintIcon = null;
- mManualTemporaryUpperCaseHintIcon = null;
- mManualTemporaryUpperCaseCode = Keyboard.CODE_DUMMY;
+ mHintLetter = null;
mLabelOption = 0;
mFunctional = false;
mSticky = false;
@@ -273,16 +270,10 @@ public class Key {
Keyboard.setDefaultBounds(mPreviewIcon);
mIcon = style.getDrawable(keyAttr, R.styleable.Keyboard_Key_keyIcon);
Keyboard.setDefaultBounds(mIcon);
- mHintIcon = style.getDrawable(keyAttr, R.styleable.Keyboard_Key_keyHintIcon);
- Keyboard.setDefaultBounds(mHintIcon);
- mManualTemporaryUpperCaseHintIcon = style.getDrawable(keyAttr,
- R.styleable.Keyboard_Key_manualTemporaryUpperCaseHintIcon);
- Keyboard.setDefaultBounds(mManualTemporaryUpperCaseHintIcon);
+ mHintLetter = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter);
mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel);
mLabelOption = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption, 0);
- mManualTemporaryUpperCaseCode = style.getInt(keyAttr,
- R.styleable.Keyboard_Key_manualTemporaryUpperCaseCode, Keyboard.CODE_DUMMY);
mOutputText = style.getText(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
// Choose the first letter of the label as primary code if not
// specified.
@@ -305,6 +296,14 @@ public class Key {
}
}
+ public boolean hasPopupHint() {
+ return (mLabelOption & LABEL_OPTION_POPUP_HINT) != 0;
+ }
+
+ public boolean hasUppercaseLetter() {
+ return (mLabelOption & LABEL_OPTION_HAS_UPPERCASE_LETTER) != 0;
+ }
+
private static boolean isDigitPopupCharacter(CharSequence label) {
return label != null && label.length() == 1 && Character.isDigit(label.charAt(0));
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/KeyStyles.java
index d53df788f..ce5ee5495 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyStyles.java
@@ -183,7 +183,7 @@ public class KeyStyles {
readText(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
readDrawable(keyAttr, R.styleable.Keyboard_Key_keyIcon);
readDrawable(keyAttr, R.styleable.Keyboard_Key_iconPreview);
- readDrawable(keyAttr, R.styleable.Keyboard_Key_keyHintIcon);
+ readText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter);
readDrawable(keyAttr, R.styleable.Keyboard_Key_shiftedIcon);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky);
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 77a4cde55..3db214ec9 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -147,8 +147,6 @@ public class Keyboard {
private final ProximityInfo mProximityInfo;
- public final Drawable mPopupHintIcon;
-
/**
* Creates a keyboard from the given xml key layout file.
* @param context the application or service context
@@ -178,7 +176,6 @@ public class Keyboard {
final TypedArray attrs = context.obtainStyledAttributes(
null, R.styleable.Keyboard, R.attr.keyboardStyle, R.style.Keyboard);
- mPopupHintIcon = attrs.getDrawable(R.styleable.Keyboard_popupHintIcon);
attrs.recycle();
loadKeyboard(context, xmlLayoutResId);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 71826346b..44f2ff3ff 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -63,13 +63,18 @@ import java.util.WeakHashMap;
* @attr ref R.styleable#KeyboardView_keyBackground
* @attr ref R.styleable#KeyboardView_keyHysteresisDistance
* @attr ref R.styleable#KeyboardView_keyLetterRatio
- * @attr ref R.styleable#KeyboardView_keyLetterStyle
+ * @attr ref R.styleable#KeyboardView_keyLabelRatio
+ * @attr ref R.styleable#KeyboardView_keyHintLetterRatio
+ * @attr ref R.styleable#KeyboardView_keyUppercaseLetterRatio
+ * @attr ref R.styleable#KeyboardView_keyTextStyle
* @attr ref R.styleable#KeyboardView_keyPreviewLayout
* @attr ref R.styleable#KeyboardView_keyPreviewOffset
* @attr ref R.styleable#KeyboardView_keyPreviewHeight
* @attr ref R.styleable#KeyboardView_keyTextColor
* @attr ref R.styleable#KeyboardView_keyTextColorDisabled
- * @attr ref R.styleable#KeyboardView_labelTextRatio
+ * @attr ref R.styleable#KeyboardView_keyHintLetterColor
+ * @attr ref R.styleable#KeyboardView_keyUppercaseLetterInactivatedColor
+ * @attr ref R.styleable#KeyboardView_keyUppercaseLetterActivatedColor
* @attr ref R.styleable#KeyboardView_verticalCorrection
* @attr ref R.styleable#KeyboardView_popupLayout
* @attr ref R.styleable#KeyboardView_shadowColor
@@ -96,9 +101,11 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// XML attribute
private final float mKeyLetterRatio;
private final int mKeyTextColor;
- private final int mKeyTextColorDisabled;
- private final Typeface mKeyLetterStyle;
- private final float mLabelTextRatio;
+ private final int mKeyTextInactivatedColor;
+ private final Typeface mKeyTextStyle;
+ private final float mKeyLabelRatio;
+ private final float mKeyHintLetterRatio;
+ private final float mKeyUppercaseLetterRatio;
private final int mColorScheme;
private final int mShadowColor;
private final float mShadowRadius;
@@ -109,11 +116,17 @@ 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 mKeyUppercaseLetterInactivatedColor;
+ private final int mKeyUppercaseLetterActivatedColor;
// Main keyboard
private Keyboard mKeyboard;
private int mKeyLetterSize;
- private int mLabelTextSize;
+ private int mKeyLabelSize;
+ private int mKeyHintLetterSize;
+ private int mKeyUppercaseLetterSize;
// Key preview
private boolean mInForeground;
@@ -168,19 +181,17 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
private Bitmap mBuffer;
/** The canvas for the above mutable keyboard bitmap */
private Canvas mCanvas;
- private final Paint mPaint;
- private final Rect mPadding;
+ private final Paint mPaint = new Paint();
+ private final Rect mPadding = new Rect();
+ private final Rect mTextBounds = new Rect();
// This map caches key label text height in pixel as value and key label text size as map key.
private final HashMap<Integer, Integer> mTextHeightCache = new HashMap<Integer, Integer>();
+ // This map caches key label text width in pixel as value and key label text size as map key.
+ private final HashMap<Integer, Integer> mTextWidthCache = new HashMap<Integer, Integer>();
// Distance from horizontal center of the key, proportional to key label text height and width.
- private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f;
- private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
- private final String KEY_LABEL_REFERENCE_CHAR = "H";
- private final int KEY_LABEL_OPTION_ALIGN_LEFT = 0x01;
- private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 0x02;
- private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 0x08;
- private final int KEY_LABEL_OPTION_FONT_NORMAL = 0x10;
- private final int KEY_LABEL_OPTION_POPUP_HINT = 0x20;
+ private static final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f;
+ private static final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
+ private static final String KEY_LABEL_REFERENCE_CHAR = "M";
private final int mKeyLabelHorizontalPadding;
private final UIHandler mHandler = new UIHandler();
@@ -322,17 +333,26 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mPreviewOffset = a.getDimensionPixelOffset(R.styleable.KeyboardView_keyPreviewOffset, 0);
mPreviewHeight = a.getDimensionPixelSize(R.styleable.KeyboardView_keyPreviewHeight, 80);
mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio);
+ mKeyLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLabelRatio);
+ mKeyHintLetterRatio = getRatio(a, R.styleable.KeyboardView_keyHintLetterRatio);
+ mKeyUppercaseLetterRatio = getRatio(a,
+ R.styleable.KeyboardView_keyUppercaseLetterRatio);
mKeyTextColor = a.getColor(R.styleable.KeyboardView_keyTextColor, 0xFF000000);
- mKeyTextColorDisabled = a.getColor(
- R.styleable.KeyboardView_keyTextColorDisabled, 0xFF000000);
- mLabelTextRatio = getRatio(a, R.styleable.KeyboardView_labelTextRatio);
+ mKeyTextInactivatedColor = a.getColor(
+ R.styleable.KeyboardView_keyTextInactivatedColor, 0xFF000000);
+ mKeyPopupHintIcon = a.getDrawable(R.styleable.KeyboardView_keyPopupHintIcon);
+ mKeyHintLetterColor = a.getColor(R.styleable.KeyboardView_keyHintLetterColor, 0);
+ mKeyUppercaseLetterInactivatedColor = a.getColor(
+ R.styleable.KeyboardView_keyUppercaseLetterInactivatedColor, 0);
+ mKeyUppercaseLetterActivatedColor = a.getColor(
+ R.styleable.KeyboardView_keyUppercaseLetterActivatedColor, 0);
+ mKeyTextStyle = Typeface.defaultFromStyle(
+ a.getInt(R.styleable.KeyboardView_keyTextStyle, Typeface.NORMAL));
mPopupLayout = a.getResourceId(R.styleable.KeyboardView_popupLayout, 0);
mShadowColor = a.getColor(R.styleable.KeyboardView_shadowColor, 0);
mShadowRadius = a.getFloat(R.styleable.KeyboardView_shadowRadius, 0f);
// TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount)
mBackgroundDimAmount = a.getFloat(R.styleable.KeyboardView_backgroundDimAmount, 0.5f);
- mKeyLetterStyle = Typeface.defaultFromStyle(
- a.getInt(R.styleable.KeyboardView_keyLetterStyle, Typeface.NORMAL));
mColorScheme = a.getInt(R.styleable.KeyboardView_colorScheme, COLOR_SCHEME_WHITE);
a.recycle();
@@ -349,12 +369,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mKeyLabelHorizontalPadding = (int)res.getDimension(
R.dimen.key_label_horizontal_alignment_padding);
- mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setTextAlign(Align.CENTER);
mPaint.setAlpha(255);
- mPadding = new Rect(0, 0, 0, 0);
mKeyBackground.getPadding(mPadding);
mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density);
@@ -498,7 +516,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mPopupPanelCache.clear();
final int keyHeight = keyboard.getRowHeight() - keyboard.getVerticalGap();
mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio);
- mLabelTextSize = (int)(keyHeight * mLabelTextRatio);
+ mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio);
+ mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio);
+ mKeyUppercaseLetterSize = (int)(
+ keyHeight * mKeyUppercaseLetterRatio);
mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio);
}
@@ -685,7 +706,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// Vertical label text alignment.
final float baseline;
- if ((key.mLabelOption & KEY_LABEL_OPTION_ALIGN_BOTTOM) != 0) {
+ if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_BOTTOM) != 0) {
baseline = key.mHeight - labelCharHeight * KEY_LABEL_VERTICAL_PADDING_FACTOR;
if (DEBUG_SHOW_ALIGN)
drawHorizontalLine(canvas, (int)baseline, keyDrawWidth, 0xc0008000,
@@ -699,12 +720,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
}
// Horizontal label text alignment
final int positionX;
- if ((key.mLabelOption & KEY_LABEL_OPTION_ALIGN_LEFT) != 0) {
+ if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_LEFT) != 0) {
positionX = mKeyLabelHorizontalPadding + padding.left;
paint.setTextAlign(Align.LEFT);
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, positionX, rowHeight, 0xc0800080, new Paint());
- } else if ((key.mLabelOption & KEY_LABEL_OPTION_ALIGN_RIGHT) != 0) {
+ } else if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_RIGHT) != 0) {
positionX = keyDrawWidth - mKeyLabelHorizontalPadding - padding.right;
paint.setTextAlign(Align.RIGHT);
if (DEBUG_SHOW_ALIGN)
@@ -717,8 +738,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
drawVerticalLine(canvas, positionX, rowHeight, 0xc0008080, new Paint());
}
}
- if (key.mManualTemporaryUpperCaseHintIcon != null && isManualTemporaryUpperCase) {
- paint.setColor(mKeyTextColorDisabled);
+ if (key.hasUppercaseLetter() && isManualTemporaryUpperCase) {
+ paint.setColor(mKeyTextInactivatedColor);
} else {
paint.setColor(mKeyTextColor);
}
@@ -734,6 +755,27 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
paint.setShadowLayer(0, 0, 0, 0);
}
+ // Draw hint letter.
+ if (key.mHintLetter != null) {
+ final String label = key.mHintLetter.toString();
+ final int textColor;
+ final int textSize;
+ if (key.hasUppercaseLetter()) {
+ textColor = isManualTemporaryUpperCase ? mKeyUppercaseLetterActivatedColor
+ : mKeyUppercaseLetterInactivatedColor;
+ textSize = mKeyUppercaseLetterSize;
+ } else {
+ textColor = mKeyHintLetterColor;
+ textSize = mKeyHintLetterSize;
+ }
+ paint.setColor(textColor);
+ paint.setTextSize(textSize);
+ // Note: padding.right for drawX?
+ final float drawX = keyDrawWidth - getLabelCharWidth(textSize, paint);
+ final float drawY = -paint.ascent() + padding.top;
+ canvas.drawText(label, drawX, drawY, paint);
+ }
+
// Draw key icon.
final Drawable icon = key.getIcon();
if (key.mLabel == null && icon != null) {
@@ -741,11 +783,11 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
final int drawableHeight = icon.getIntrinsicHeight();
final int drawableX;
final int drawableY = (key.mHeight + padding.top - padding.bottom - drawableHeight) / 2;
- if ((key.mLabelOption & KEY_LABEL_OPTION_ALIGN_LEFT) != 0) {
+ if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_LEFT) != 0) {
drawableX = padding.left + mKeyLabelHorizontalPadding;
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, drawableX, rowHeight, 0xc0800080, new Paint());
- } else if ((key.mLabelOption & KEY_LABEL_OPTION_ALIGN_RIGHT) != 0) {
+ } else if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_RIGHT) != 0) {
drawableX = keyDrawWidth - padding.right - mKeyLabelHorizontalPadding
- drawableWidth;
if (DEBUG_SHOW_ALIGN)
@@ -763,16 +805,14 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
0x80c00000, new Paint());
}
- // Draw hint icon.
- if (key.mHintIcon != null || (key.mLabelOption & KEY_LABEL_OPTION_POPUP_HINT) != 0) {
+ // Draw popup hint icon "...".
+ // TODO: Draw "..." by text.
+ if (key.hasPopupHint()) {
final int drawableWidth = keyDrawWidth;
final int drawableHeight = key.mHeight;
final int drawableX = 0;
final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
- Drawable hintIcon = (isManualTemporaryUpperCase
- && key.mManualTemporaryUpperCaseHintIcon != null)
- ? key.mManualTemporaryUpperCaseHintIcon
- : (key.mHintIcon != null ? key.mHintIcon : mKeyboard.mPopupHintIcon);
+ final Drawable hintIcon = mKeyPopupHintIcon;
drawIcon(canvas, hintIcon, drawableX, drawableY, drawableWidth, drawableHeight);
if (DEBUG_SHOW_ALIGN)
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
@@ -787,15 +827,15 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
final int labelSize;
final Typeface labelStyle;
if (label.length() > 1) {
- labelSize = mLabelTextSize;
- if ((keyLabelOption & KEY_LABEL_OPTION_FONT_NORMAL) != 0) {
+ labelSize = mKeyLabelSize;
+ if ((keyLabelOption & Key.LABEL_OPTION_FONT_NORMAL) != 0) {
labelStyle = Typeface.DEFAULT;
} else {
labelStyle = Typeface.DEFAULT_BOLD;
}
} else {
labelSize = mKeyLetterSize;
- labelStyle = mKeyLetterStyle;
+ labelStyle = mKeyTextStyle;
}
paint.setTextSize(labelSize);
paint.setTypeface(labelStyle);
@@ -808,14 +848,26 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
if (labelHeightValue != null) {
labelCharHeight = labelHeightValue;
} else {
- Rect textBounds = new Rect();
- paint.getTextBounds(KEY_LABEL_REFERENCE_CHAR, 0, 1, textBounds);
- labelCharHeight = textBounds.height();
+ paint.getTextBounds(KEY_LABEL_REFERENCE_CHAR, 0, 1, mTextBounds);
+ labelCharHeight = mTextBounds.height();
mTextHeightCache.put(labelSize, labelCharHeight);
}
return labelCharHeight;
}
+ private int getLabelCharWidth(int labelSize, Paint paint) {
+ Integer labelWidthValue = mTextWidthCache.get(labelSize);
+ final int labelCharWidth;
+ if (labelWidthValue != null) {
+ labelCharWidth = labelWidthValue;
+ } else {
+ paint.getTextBounds(KEY_LABEL_REFERENCE_CHAR, 0, 1, mTextBounds);
+ labelCharWidth = mTextBounds.width();
+ mTextWidthCache.put(labelSize, labelCharWidth);
+ }
+ return labelCharWidth;
+ }
+
private static void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width,
int height) {
canvas.translate(x, y);
@@ -938,7 +990,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
previewText.setTypeface(Typeface.DEFAULT_BOLD);
} else {
previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSize);
- previewText.setTypeface(mKeyLetterStyle);
+ previewText.setTypeface(mKeyTextStyle);
}
} else {
final Drawable previewIcon = key.getPreviewIcon();
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index cf8458978..397ac7eec 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -639,8 +639,7 @@ public class PointerTracker {
Key key = getKey(keyIndex);
if (key.mCode == Keyboard.CODE_SHIFT) {
mHandler.startLongPressShiftTimer(mLongPressShiftKeyTimeout, keyIndex, this);
- } else if (key.mManualTemporaryUpperCaseCode != Keyboard.CODE_DUMMY
- && mKeyboard.isManualTemporaryUpperCase()) {
+ } else if (key.hasUppercaseLetter() && mKeyboard.isManualTemporaryUpperCase()) {
// We need not start long press timer on the key which has manual temporary upper case
// code defined and the keyboard is in manual temporary upper case mode.
return;
@@ -667,10 +666,9 @@ public class PointerTracker {
mKeyDetector.getKeyIndexAndNearbyCodes(x, y, codes);
// If keyboard is in manual temporary upper case state and key has manual temporary
- // shift code, alternate character code should be sent.
- if (mKeyboard.isManualTemporaryUpperCase()
- && key.mManualTemporaryUpperCaseCode != Keyboard.CODE_DUMMY) {
- code = key.mManualTemporaryUpperCaseCode;
+ // uppercase letter as key hint letter, alternate character code should be sent.
+ if (mKeyboard.isManualTemporaryUpperCase() && key.hasUppercaseLetter()) {
+ code = key.mHintLetter.charAt(0);
codes[0] = code;
}