Fix key top letter color in shifted layout

There is a chance to have an empty hint label even though
keyLabelFlags has hasShiftedLetterHint flag.

Change-Id: I63b9fcc42a40391d5902814cae4c75abb61e4b94
main
Tadashi G. Takaoka 2013-12-13 18:33:11 +09:00
parent a5b196e939
commit 815a339201
1 changed files with 6 additions and 5 deletions

View File

@ -348,8 +348,7 @@ public class Key implements Comparable<Key> {
if (StringUtils.codePointCount(mLabel) == 1) { if (StringUtils.codePointCount(mLabel) == 1) {
// Use the first letter of the hint label if shiftedLetterActivated flag is // Use the first letter of the hint label if shiftedLetterActivated flag is
// specified. // specified.
if (hasShiftedLetterHint() && isShiftedLetterActivated() if (hasShiftedLetterHint() && isShiftedLetterActivated()) {
&& !TextUtils.isEmpty(mHintLabel)) {
mCode = mHintLabel.codePointAt(0); mCode = mHintLabel.codePointAt(0);
} else { } else {
mCode = mLabel.codePointAt(0); mCode = mLabel.codePointAt(0);
@ -687,7 +686,8 @@ public class Key implements Comparable<Key> {
} }
public final boolean hasShiftedLetterHint() { public final boolean hasShiftedLetterHint() {
return (mLabelFlags & LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT) != 0; return (mLabelFlags & LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT) != 0
&& !TextUtils.isEmpty(mHintLabel);
} }
public final boolean hasHintLabel() { public final boolean hasHintLabel() {
@ -710,8 +710,9 @@ public class Key implements Comparable<Key> {
return (mLabelFlags & LABEL_FLAGS_AUTO_SCALE) == LABEL_FLAGS_AUTO_SCALE; return (mLabelFlags & LABEL_FLAGS_AUTO_SCALE) == LABEL_FLAGS_AUTO_SCALE;
} }
public final boolean isShiftedLetterActivated() { private final boolean isShiftedLetterActivated() {
return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0; return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0
&& !TextUtils.isEmpty(mHintLabel);
} }
public final int getMoreKeysColumn() { public final int getMoreKeysColumn() {