aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-08-07 03:58:32 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-07 03:58:32 +0000
commitbfcb3323d2d7165984038f9eff3e49bc824a6d0f (patch)
treebd897833e6b20544570f433b0d9f7bdc710909bd /java/src
parentd5e4e367f21407da7a5f62a18e601957b07b6f4d (diff)
parente19c520b419faaf96180984528ae32b514a1bc77 (diff)
downloadlatinime-bfcb3323d2d7165984038f9eff3e49bc824a6d0f.tar.gz
latinime-bfcb3323d2d7165984038f9eff3e49bc824a6d0f.tar.xz
latinime-bfcb3323d2d7165984038f9eff3e49bc824a6d0f.zip
am e19c520b: Align space key icon to bottom of a key
* commit 'e19c520b419faaf96180984528ae32b514a1bc77': 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);
}