aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-07-18 18:48:17 -0700
committerTadashi G. Takaoka <takaoka@google.com>2014-07-19 12:31:50 -0700
commit639c93f43bc51a8328d7dc11a09a3bd77974aeae (patch)
tree6fc4f6af267677349374bca0305843d7d1d635bd /java/src/com/android/inputmethod
parent5bb0bff0e4ae0553c3732378d1e328b9fea0b88d (diff)
downloadlatinime-639c93f43bc51a8328d7dc11a09a3bd77974aeae.tar.gz
latinime-639c93f43bc51a8328d7dc11a09a3bd77974aeae.tar.xz
latinime-639c93f43bc51a8328d7dc11a09a3bd77974aeae.zip
Remove unused Key.keyLabelFlags' values
Change-Id: Iae3cd6674448f258ee0a4bf2966bf3c347876b4f
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java25
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java54
2 files changed, 4 insertions, 75 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 665d9f7a1..af54fb674 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -58,9 +58,6 @@ 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_LEFT = 0x01;
- private static final int LABEL_FLAGS_ALIGN_RIGHT = 0x02;
- private static final int LABEL_FLAGS_ALIGN_BUTTOM = 0x04;
private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08;
// Font typeface specification.
private static final int LABEL_FLAGS_FONT_MASK = 0x30;
@@ -78,8 +75,6 @@ public class Key implements Comparable<Key> {
private static final int LABEL_FLAGS_HAS_POPUP_HINT = 0x200;
private static final int LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT = 0x400;
private static final int LABEL_FLAGS_HAS_HINT_LABEL = 0x800;
- private static final int LABEL_FLAGS_WITH_ICON_LEFT = 0x1000;
- private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000;
// The bit to calculate the ratio of key label width against key width. If autoXScale bit is on
// and autoYScale bit is off, the key label may be shrunk only for X-direction.
// If both autoXScale and autoYScale bits are on, the key label text size may be auto scaled.
@@ -646,18 +641,6 @@ public class Key implements Comparable<Key> {
return Typeface.DEFAULT_BOLD;
}
- public final boolean isAlignLeft() {
- return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT) != 0;
- }
-
- public final boolean isAlignRight() {
- return (mLabelFlags & LABEL_FLAGS_ALIGN_RIGHT) != 0;
- }
-
- public final boolean isAlignButtom() {
- return (mLabelFlags & LABEL_FLAGS_ALIGN_BUTTOM) != 0;
- }
-
public final boolean isAlignLeftOfCenter() {
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0;
}
@@ -675,14 +658,6 @@ public class Key implements Comparable<Key> {
return (mLabelFlags & LABEL_FLAGS_HAS_HINT_LABEL) != 0;
}
- public final boolean hasLabelWithIconLeft() {
- return (mLabelFlags & LABEL_FLAGS_WITH_ICON_LEFT) != 0;
- }
-
- public final boolean hasLabelWithIconRight() {
- return (mLabelFlags & LABEL_FLAGS_WITH_ICON_RIGHT) != 0;
- }
-
public final boolean needsAutoXScale() {
return (mLabelFlags & LABEL_FLAGS_AUTO_X_SCALE) != 0;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index c4ca1c495..f967f620a 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -47,7 +47,6 @@ import java.util.HashSet;
* @attr ref R.styleable#KeyboardView_functionalKeyBackground
* @attr ref R.styleable#KeyboardView_spacebarBackground
* @attr ref R.styleable#KeyboardView_spacebarIconWidthRatio
- * @attr ref R.styleable#KeyboardView_keyLabelHorizontalPadding
* @attr ref R.styleable#KeyboardView_keyHintLetterPadding
* @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding
* @attr ref R.styleable#KeyboardView_keyShiftedLetterHintPadding
@@ -74,7 +73,6 @@ import java.util.HashSet;
public class KeyboardView extends View {
// XML attributes
private final KeyVisualAttributes mKeyVisualAttributes;
- private final int mKeyLabelHorizontalPadding;
private final float mKeyHintLetterPadding;
private final float mKeyPopupHintLetterPadding;
private final float mKeyShiftedLetterHintPadding;
@@ -90,11 +88,6 @@ public class KeyboardView extends View {
// HORIZONTAL ELLIPSIS "...", character for popup hint.
private static final String POPUP_HINT_CHAR = "\u2026";
- // Margin between the label and the icon on a key that has both of them.
- // Specified by the fraction of the key width.
- // TODO: Use resource parameter for this value.
- private static final float LABEL_ICON_MARGIN = 0.05f;
-
// The maximum key label width in the proportion to the key width.
private static final float MAX_LABEL_RATIO = 0.90f;
@@ -137,8 +130,6 @@ public class KeyboardView extends View {
mSpacebarBackground = (spacebarBackground != null) ? spacebarBackground : mKeyBackground;
mSpacebarIconWidthRatio = keyboardViewAttr.getFloat(
R.styleable.KeyboardView_spacebarIconWidthRatio, 1.0f);
- mKeyLabelHorizontalPadding = keyboardViewAttr.getDimensionPixelOffset(
- R.styleable.KeyboardView_keyLabelHorizontalPadding, 0);
mKeyHintLetterPadding = keyboardViewAttr.getDimension(
R.styleable.KeyboardView_keyHintLetterPadding, 0.0f);
mKeyPopupHintLetterPadding = keyboardViewAttr.getDimension(
@@ -376,27 +367,10 @@ public class KeyboardView extends View {
final float baseline = centerY + labelCharHeight / 2.0f;
// Horizontal label text alignment
- float labelWidth = 0.0f;
- if (key.isAlignLeft()) {
- positionX = mKeyLabelHorizontalPadding;
- paint.setTextAlign(Align.LEFT);
- } else if (key.isAlignRight()) {
- positionX = keyWidth - mKeyLabelHorizontalPadding;
- paint.setTextAlign(Align.RIGHT);
- } else if (key.isAlignLeftOfCenter()) {
+ if (key.isAlignLeftOfCenter()) {
// TODO: Parameterise this?
positionX = centerX - labelCharWidth * 7.0f / 4.0f;
paint.setTextAlign(Align.LEFT);
- } else if (key.hasLabelWithIconLeft() && icon != null) {
- labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth()
- + LABEL_ICON_MARGIN * keyWidth;
- positionX = centerX + labelWidth / 2.0f;
- paint.setTextAlign(Align.RIGHT);
- } else if (key.hasLabelWithIconRight() && icon != null) {
- labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth()
- + LABEL_ICON_MARGIN * keyWidth;
- positionX = centerX - labelWidth / 2.0f;
- paint.setTextAlign(Align.LEFT);
} else {
positionX = centerX;
paint.setTextAlign(Align.CENTER);
@@ -430,19 +404,6 @@ public class KeyboardView extends View {
// Turn off drop shadow and reset x-scale.
paint.clearShadowLayer();
paint.setTextScaleX(1.0f);
-
- if (icon != null) {
- final int iconWidth = icon.getIntrinsicWidth();
- final int iconHeight = icon.getIntrinsicHeight();
- final int iconY = (keyHeight - iconHeight) / 2;
- if (key.hasLabelWithIconLeft()) {
- final int iconX = (int)(centerX - labelWidth / 2.0f);
- drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
- } else if (key.hasLabelWithIconRight()) {
- final int iconX = (int)(centerX + labelWidth / 2.0f - iconWidth);
- drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
- }
- }
}
// Draw hint label.
@@ -493,16 +454,9 @@ public class KeyboardView extends View {
iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
}
final int iconHeight = icon.getIntrinsicHeight();
- final int iconY = key.isAlignButtom() ? keyHeight - iconHeight
- : (keyHeight - iconHeight) / 2;
- final int iconX;
- if (key.isAlignLeft()) {
- iconX = mKeyLabelHorizontalPadding;
- } else if (key.isAlignRight()) {
- iconX = keyWidth - mKeyLabelHorizontalPadding - iconWidth;
- } else { // Align center
- iconX = (keyWidth - iconWidth) / 2;
- }
+ // Align center.
+ final int iconY = (keyHeight - iconHeight) / 2;
+ final int iconX = (keyWidth - iconWidth) / 2;
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
}