diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2014-08-07 14:31:47 +0000 |
|---|---|---|
| committer | Tadashi G. Takaoka <takaoka@google.com> | 2014-08-07 14:31:47 +0000 |
| commit | 0b5d12c6b4df6ddea2514a6646feb7db68e37ff4 (patch) | |
| tree | 44a7e75005099931d2ae286b9ab79968ddd24003 /java/src/com/android/inputmethod/keyboard/KeyboardView.java | |
| parent | 787e9a37b41c67e8683e854538b2743a2bc8fdcd (diff) | |
Revert "Revert "Add Key label off center attribute""
This reverts commit 787e9a37b41c67e8683e854538b2743a2bc8fdcd.
Change-Id: I177b8f5d08eb487c19180c09101cc073222c4efe
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()) { |
