diff options
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardView.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardView.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 4a791f325..72b254756 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -369,9 +369,9 @@ public class KeyboardView extends View { final float baseline = centerY + labelCharHeight / 2.0f; // Horizontal label text alignment - if (key.isAlignLeftOfCenter()) { - // TODO: Parameterise this? - positionX = centerX - labelCharWidth * 7.0f / 4.0f; + if (key.isAlignLabelOffCenter()) { + // The label is placed off center of the key. Used mainly on "phone number" layout. + positionX = centerX + params.mLabelOffCenterRatio * labelCharWidth; paint.setTextAlign(Align.LEFT); } else { positionX = centerX; @@ -418,15 +418,12 @@ public class KeyboardView extends View { blendAlpha(paint, params.mAnimAlpha); final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); - final KeyVisualAttributes visualAttr = key.getVisualAttributes(); - final float adjustmentY = (visualAttr == null) ? 0.0f - : visualAttr.mHintLabelVerticalAdjustment * labelCharHeight; + final float adjustmentY = params.mHintLabelVerticalAdjustment * labelCharHeight; final float hintX, hintY; if (key.hasHintLabel()) { // The hint label is placed just right of the key label. Used mainly on // "phone number" layout. - // TODO: Generalize the following calculations. - hintX = positionX + labelCharWidth * 2.0f; + hintX = positionX + params.mHintLabelOffCenterRatio * labelCharWidth; hintY = centerY + labelCharHeight / 2.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasShiftedLetterHint()) { |
