diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2013-01-30 04:08:16 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-01-30 04:08:16 +0000 |
| commit | 48409b9ac60fb64eb80d1d8da3452f9ab40f5002 (patch) | |
| tree | aa64e9efcb075706d2a1d60cb2624948f170cc99 /java/src/com/android/inputmethod/keyboard/Key.java | |
| parent | cffb3126acc5c4cb1fc1742ecd0cdf9d6a18f8a3 (diff) | |
| parent | 5ee2d79e41872610946b5a5c1caf14f3e5696c26 (diff) | |
Merge "Remove "dimension|fraction" format from Key and Keyboard attributes"
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/Key.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 9b971755e..e137b922a 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -41,7 +41,6 @@ import com.android.inputmethod.keyboard.internal.KeyboardRow; import com.android.inputmethod.keyboard.internal.MoreKeySpec; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; -import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.StringUtils; import org.xmlpull.v1.XmlPullParser; @@ -225,8 +224,8 @@ public class Key implements Comparable<Key> { public Key(final Resources res, final KeyboardParams params, final KeyboardRow row, final XmlPullParser parser) throws XmlPullParserException { final float horizontalGap = isSpacer() ? 0 : params.mHorizontalGap; - final int keyHeight = row.mRowHeight; - mHeight = keyHeight - params.mVerticalGap; + final int rowHeight = row.mRowHeight; + mHeight = rowHeight - params.mVerticalGap; final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key); @@ -241,17 +240,18 @@ public class Key implements Comparable<Key> { mY = keyYPos; mWidth = Math.round(keyWidth - horizontalGap); mHitBox.set(Math.round(keyXPos), keyYPos, Math.round(keyXPos + keyWidth) + 1, - keyYPos + keyHeight); + keyYPos + rowHeight); // Update row to have current x coordinate. row.setXPos(keyXPos + keyWidth); mBackgroundType = style.getInt(keyAttr, R.styleable.Keyboard_Key_backgroundType, row.getDefaultBackgroundType()); - final int visualInsetsLeft = Math.round(ResourceUtils.getDimensionOrFraction(keyAttr, - R.styleable.Keyboard_Key_visualInsetsLeft, params.mBaseWidth, 0)); - final int visualInsetsRight = Math.round(ResourceUtils.getDimensionOrFraction(keyAttr, - R.styleable.Keyboard_Key_visualInsetsRight, params.mBaseWidth, 0)); + final int baseWidth = params.mBaseWidth; + final int visualInsetsLeft = Math.round(keyAttr.getFraction( + R.styleable.Keyboard_Key_visualInsetsLeft, baseWidth, baseWidth, 0)); + final int visualInsetsRight = Math.round(keyAttr.getFraction( + R.styleable.Keyboard_Key_visualInsetsRight, baseWidth, baseWidth, 0)); mIconId = KeySpecParser.getIconId(style.getString(keyAttr, R.styleable.Keyboard_Key_keyIcon)); final int disabledIconId = KeySpecParser.getIconId(style.getString(keyAttr, |
