aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-08-07 04:02:58 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-07 04:02:58 +0000
commit85c29bd2bb08ac3827bb4b87645bbe6319cfddd5 (patch)
tree05b978fbfd1586c349daed73dd39874fb22c061a /java/src
parent95d2c4fbedb0dd9139e12e8c427c957eeaa106b2 (diff)
parentbfcb3323d2d7165984038f9eff3e49bc824a6d0f (diff)
downloadlatinime-85c29bd2bb08ac3827bb4b87645bbe6319cfddd5.tar.gz
latinime-85c29bd2bb08ac3827bb4b87645bbe6319cfddd5.tar.xz
latinime-85c29bd2bb08ac3827bb4b87645bbe6319cfddd5.zip
am bfcb3323: am e19c520b: Align space key icon to bottom of a key
* commit 'bfcb3323d2d7165984038f9eff3e49bc824a6d0f': Align space key icon to bottom of a key
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java10
2 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 55ce7dd34..aaa55d79c 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -58,6 +58,7 @@ public class Key implements Comparable<Key> {
private final String mHintLabel;
/** Flags of the label */
private final int mLabelFlags;
+ private static final int LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM = 0x04;
private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08;
// Font typeface specification.
private static final int LABEL_FLAGS_FONT_MASK = 0x30;
@@ -643,6 +644,10 @@ public class Key implements Comparable<Key> {
return Typeface.DEFAULT_BOLD;
}
+ public final boolean isAlignIconToBottom() {
+ return (mLabelFlags & LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM) != 0;
+ }
+
public final boolean isAlignLeftOfCenter() {
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 5af0be649..4a791f325 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -456,9 +456,13 @@ public class KeyboardView extends View {
iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
}
final int iconHeight = icon.getIntrinsicHeight();
- // Align center.
- final int iconY = (keyHeight - iconHeight) / 2;
- final int iconX = (keyWidth - iconWidth) / 2;
+ final int iconY;
+ if (key.isAlignIconToBottom()) {
+ iconY = keyHeight - iconHeight;
+ } else {
+ iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
+ }
+ final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
}