diff options
| author | Ken Wakasa <kwakasa@google.com> | 2014-08-07 11:38:01 +0000 |
|---|---|---|
| committer | Ken Wakasa <kwakasa@google.com> | 2014-08-07 11:38:36 +0000 |
| commit | 787e9a37b41c67e8683e854538b2743a2bc8fdcd (patch) | |
| tree | 9746a1f868d59435985e3539790938b4368c0944 /java/src/com/android/inputmethod/keyboard/KeyboardView.java | |
| parent | 5f57fe4ad035f3deb53a58616efea843546266b4 (diff) | |
Revert "Add Key label off center attribute"
This reverts commit ba49920e8046ca592d6c914b2e3f7394bf9c281c.
Due to unit test breakage.
Bug: 14419121
Change-Id: I6f4fc30b86227e59c883d202551b162dc91b4166
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, 8 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 72b254756..4a791f325 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.isAlignLabelOffCenter()) { - // The label is placed off center of the key. Used mainly on "phone number" layout. - positionX = centerX + params.mLabelOffCenterRatio * labelCharWidth; + if (key.isAlignLeftOfCenter()) { + // TODO: Parameterise this? + positionX = centerX - labelCharWidth * 7.0f / 4.0f; paint.setTextAlign(Align.LEFT); } else { positionX = centerX; @@ -418,12 +418,15 @@ public class KeyboardView extends View { blendAlpha(paint, params.mAnimAlpha); final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); - final float adjustmentY = params.mHintLabelVerticalAdjustment * labelCharHeight; + final KeyVisualAttributes visualAttr = key.getVisualAttributes(); + final float adjustmentY = (visualAttr == null) ? 0.0f + : visualAttr.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. - hintX = positionX + params.mHintLabelOffCenterRatio * labelCharWidth; + // TODO: Generalize the following calculations. + hintX = positionX + labelCharWidth * 2.0f; hintY = centerY + labelCharHeight / 2.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasShiftedLetterHint()) { |
