Merge "Calculate x coordinate with floating point"
This commit is contained in:
commit
08e64e1874
6 changed files with 134 additions and 147 deletions
|
@ -29,8 +29,7 @@
|
|||
<Key
|
||||
latin:keyLabel="й"
|
||||
latin:keyHintLabel="1"
|
||||
latin:moreKeys="1"
|
||||
latin:keyWidth="8.75%p" />
|
||||
latin:moreKeys="1" />
|
||||
<Key
|
||||
latin:keyLabel="ц"
|
||||
latin:keyHintLabel="2"
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
<include
|
||||
latin:keyboardLayout="@xml/kbd_key_styles" />
|
||||
<Row
|
||||
latin:keyWidth="9.09%p"
|
||||
latin:keyWidth="9.091%p"
|
||||
>
|
||||
<Key
|
||||
latin:keyLabel="q"
|
||||
latin:keyHintLabel="1"
|
||||
latin:moreKeys="@string/more_keys_for_q"
|
||||
latin:keyWidth="8.75%p" />
|
||||
latin:moreKeys="@string/more_keys_for_q" />
|
||||
<Key
|
||||
latin:keyLabel="w"
|
||||
latin:keyHintLabel="2"
|
||||
|
@ -72,7 +71,7 @@
|
|||
latin:keyWidth="fillRight" />
|
||||
</Row>
|
||||
<Row
|
||||
latin:keyWidth="9.09%p"
|
||||
latin:keyWidth="9.091%p"
|
||||
>
|
||||
<Key
|
||||
latin:keyLabel="a"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<include
|
||||
latin:keyboardLayout="@xml/kbd_key_styles" />
|
||||
<Row
|
||||
latin:keyWidth="9.09%p"
|
||||
latin:keyWidth="9.091%p"
|
||||
>
|
||||
<Key
|
||||
latin:keyLabel="љ"
|
||||
|
@ -71,7 +71,7 @@
|
|||
latin:keyWidth="fillRight" />
|
||||
</Row>
|
||||
<Row
|
||||
latin:keyWidth="9.09%p"
|
||||
latin:keyWidth="9.091%p"
|
||||
>
|
||||
<Key
|
||||
latin:keyLabel="а" />
|
||||
|
@ -98,10 +98,11 @@
|
|||
latin:keyWidth="fillRight" />
|
||||
</Row>
|
||||
<Row
|
||||
latin:keyWidth="8.90%p"
|
||||
latin:keyWidth="8.5%p"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shiftKeyStyle" />
|
||||
latin:keyStyle="shiftKeyStyle"
|
||||
latin:keyWidth="11.75%p" />
|
||||
<Key
|
||||
latin:keyLabel="ѕ" />
|
||||
<Key
|
||||
|
|
|
@ -253,126 +253,115 @@ public class Key {
|
|||
|
||||
final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
|
||||
R.styleable.Keyboard);
|
||||
int keyWidth;
|
||||
try {
|
||||
mHeight = KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_rowHeight,
|
||||
params.mHeight, row.mRowHeight) - params.mVerticalGap;
|
||||
mHorizontalGap = KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_horizontalGap,
|
||||
params.mWidth, params.mHorizontalGap);
|
||||
mVerticalGap = params.mVerticalGap;
|
||||
keyWidth = KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyWidth,
|
||||
params.mWidth, row.mDefaultKeyWidth);
|
||||
} finally {
|
||||
keyboardAttr.recycle();
|
||||
}
|
||||
mHeight = (int)KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_rowHeight, params.mHeight, row.mRowHeight)
|
||||
- params.mVerticalGap;
|
||||
final float horizontalGap = KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_horizontalGap, params.mWidth, params.mHorizontalGap);
|
||||
mVerticalGap = params.mVerticalGap;
|
||||
float keyWidth = KeyboardBuilder.getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyWidth, params.mWidth, row.mDefaultKeyWidth);
|
||||
keyboardAttr.recycle();
|
||||
|
||||
final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
|
||||
R.styleable.Keyboard_Key);
|
||||
try {
|
||||
final KeyStyle style;
|
||||
if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyStyle)) {
|
||||
String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
|
||||
style = keyStyles.getKeyStyle(styleName);
|
||||
if (style == null)
|
||||
throw new ParseException("Unknown key style: " + styleName, parser);
|
||||
} else {
|
||||
style = keyStyles.getEmptyKeyStyle();
|
||||
}
|
||||
|
||||
final int keyboardWidth = params.mOccupiedWidth;
|
||||
final int x = row.mCurrentX;
|
||||
int keyXPos = KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyXPos, keyboardWidth, x);
|
||||
if (keyXPos < 0) {
|
||||
// If keyXPos is negative, the actual x-coordinate will be k + keyXPos.
|
||||
keyXPos += keyboardWidth;
|
||||
if (keyXPos < x) {
|
||||
// keyXPos shouldn't be less than x because drawable area for this key starts
|
||||
// at x. Or, this key will overlaps the adjacent key on its left hand side.
|
||||
keyXPos = x;
|
||||
}
|
||||
}
|
||||
if (keyWidth == KEYWIDTH_FILL_RIGHT) {
|
||||
// If keyWidth is zero, the actual key width will be determined to fill out the
|
||||
// area up to the right edge of the keyboard.
|
||||
keyWidth = keyboardWidth - keyXPos;
|
||||
} else if (keyWidth <= KEYWIDTH_FILL_BOTH) {
|
||||
// If keyWidth is negative, the actual key width will be determined to fill out the
|
||||
// area between the nearest key on the left hand side and the right edge of the
|
||||
// keyboard.
|
||||
keyXPos = x;
|
||||
keyWidth = keyboardWidth - keyXPos;
|
||||
}
|
||||
|
||||
// Horizontal gap is divided equally to both sides of the key.
|
||||
mX = keyXPos + mHorizontalGap / 2;
|
||||
mY = row.mCurrentY;
|
||||
mWidth = keyWidth - mHorizontalGap;
|
||||
|
||||
// Update row to have x-coordinate of the right edge of this key.
|
||||
row.mCurrentX = keyXPos + keyWidth;
|
||||
|
||||
final CharSequence[] moreKeys = style.getTextArray(
|
||||
keyAttr, R.styleable.Keyboard_Key_moreKeys);
|
||||
// In Arabic symbol layouts, we'd like to keep digits in more keys regardless of
|
||||
// config_digit_more_keys_enabled.
|
||||
if (params.mId.isAlphabetKeyboard() && !res.getBoolean(
|
||||
R.bool.config_digit_more_keys_enabled)) {
|
||||
mMoreKeys = MoreKeySpecParser.filterOut(
|
||||
res, moreKeys, MoreKeySpecParser.DIGIT_FILTER);
|
||||
} else {
|
||||
mMoreKeys = moreKeys;
|
||||
}
|
||||
mMaxMoreKeysColumn = style.getInt(keyboardAttr,
|
||||
R.styleable.Keyboard_Key_maxMoreKeysColumn,
|
||||
params.mMaxMiniKeyboardColumn);
|
||||
|
||||
mRepeatable = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable, false);
|
||||
mFunctional = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional, false);
|
||||
mSticky = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky, false);
|
||||
mEnabled = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_enabled, true);
|
||||
mEdgeFlags = 0;
|
||||
|
||||
final KeyboardIconsSet iconsSet = params.mIconsSet;
|
||||
mVisualInsetsLeft = KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_visualInsetsLeft, keyboardWidth, 0);
|
||||
mVisualInsetsRight = KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_visualInsetsRight, keyboardWidth, 0);
|
||||
mPreviewIcon = iconsSet.getIcon(style.getInt(
|
||||
keyAttr, R.styleable.Keyboard_Key_keyIconPreview,
|
||||
KeyboardIconsSet.ICON_UNDEFINED));
|
||||
mIcon = iconsSet.getIcon(style.getInt(
|
||||
keyAttr, R.styleable.Keyboard_Key_keyIcon,
|
||||
KeyboardIconsSet.ICON_UNDEFINED));
|
||||
final int shiftedIconId = style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted,
|
||||
KeyboardIconsSet.ICON_UNDEFINED);
|
||||
if (shiftedIconId != KeyboardIconsSet.ICON_UNDEFINED) {
|
||||
final Drawable shiftedIcon = iconsSet.getIcon(shiftedIconId);
|
||||
params.addShiftedIcon(this, shiftedIcon);
|
||||
}
|
||||
mHintLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
|
||||
|
||||
mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel);
|
||||
mLabelOption = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption, 0);
|
||||
mOutputText = style.getText(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
|
||||
// Choose the first letter of the label as primary code if not
|
||||
// specified.
|
||||
final int code = style.getInt(keyAttr, R.styleable.Keyboard_Key_code,
|
||||
Keyboard.CODE_UNSPECIFIED);
|
||||
if (code == Keyboard.CODE_UNSPECIFIED && !TextUtils.isEmpty(mLabel)) {
|
||||
final int firstChar = mLabel.charAt(0);
|
||||
mCode = getRtlParenthesisCode(firstChar, params.mIsRtlKeyboard);
|
||||
} else if (code != Keyboard.CODE_UNSPECIFIED) {
|
||||
mCode = code;
|
||||
} else {
|
||||
mCode = Keyboard.CODE_DUMMY;
|
||||
}
|
||||
} finally {
|
||||
keyAttr.recycle();
|
||||
final KeyStyle style;
|
||||
if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyStyle)) {
|
||||
String styleName = keyAttr.getString(R.styleable.Keyboard_Key_keyStyle);
|
||||
style = keyStyles.getKeyStyle(styleName);
|
||||
if (style == null)
|
||||
throw new ParseException("Unknown key style: " + styleName, parser);
|
||||
} else {
|
||||
style = keyStyles.getEmptyKeyStyle();
|
||||
}
|
||||
|
||||
final int keyboardWidth = params.mOccupiedWidth;
|
||||
final float x = row.mCurrentX;
|
||||
float keyXPos = KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyXPos, keyboardWidth, x);
|
||||
if (keyXPos < 0) {
|
||||
// If keyXPos is negative, the actual x-coordinate will be keyboardWidth + keyXPos.
|
||||
keyXPos += keyboardWidth;
|
||||
if (keyXPos < x) {
|
||||
// keyXPos shouldn't be less than x because drawable area for this key starts
|
||||
// at x. Or, this key will overlaps the adjacent key on its left hand side.
|
||||
keyXPos = x;
|
||||
}
|
||||
}
|
||||
if (keyWidth == KEYWIDTH_FILL_RIGHT) {
|
||||
// If keyWidth is zero, the actual key width will be determined to fill out the
|
||||
// area up to the right edge of the keyboard.
|
||||
keyWidth = keyboardWidth - keyXPos;
|
||||
} else if (keyWidth <= KEYWIDTH_FILL_BOTH) {
|
||||
// If keyWidth is negative, the actual key width will be determined to fill out the
|
||||
// area between the nearest key on the left hand side and the right edge of the
|
||||
// keyboard.
|
||||
keyXPos = x;
|
||||
keyWidth = keyboardWidth - keyXPos;
|
||||
}
|
||||
|
||||
// Horizontal gap is divided equally to both sides of the key.
|
||||
mX = (int) (keyXPos + horizontalGap / 2);
|
||||
mY = row.mCurrentY;
|
||||
mWidth = (int) (keyWidth - horizontalGap);
|
||||
mHorizontalGap = (int) horizontalGap;
|
||||
// Update row to have current x coordinate.
|
||||
row.mCurrentX = keyXPos + keyWidth;
|
||||
|
||||
final CharSequence[] moreKeys = style.getTextArray(keyAttr,
|
||||
R.styleable.Keyboard_Key_moreKeys);
|
||||
// In Arabic symbol layouts, we'd like to keep digits in more keys regardless of
|
||||
// config_digit_more_keys_enabled.
|
||||
if (params.mId.isAlphabetKeyboard()
|
||||
&& !res.getBoolean(R.bool.config_digit_more_keys_enabled)) {
|
||||
mMoreKeys = MoreKeySpecParser.filterOut(res, moreKeys, MoreKeySpecParser.DIGIT_FILTER);
|
||||
} else {
|
||||
mMoreKeys = moreKeys;
|
||||
}
|
||||
mMaxMoreKeysColumn = style.getInt(keyboardAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn,
|
||||
params.mMaxMiniKeyboardColumn);
|
||||
|
||||
mRepeatable = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable, false);
|
||||
mFunctional = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional, false);
|
||||
mSticky = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky, false);
|
||||
mEnabled = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_enabled, true);
|
||||
mEdgeFlags = 0;
|
||||
|
||||
final KeyboardIconsSet iconsSet = params.mIconsSet;
|
||||
mVisualInsetsLeft = (int) KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_visualInsetsLeft, keyboardWidth, 0);
|
||||
mVisualInsetsRight = (int) KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_visualInsetsRight, keyboardWidth, 0);
|
||||
mPreviewIcon = iconsSet.getIcon(style.getInt(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyIconPreview, KeyboardIconsSet.ICON_UNDEFINED));
|
||||
mIcon = iconsSet.getIcon(style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIcon,
|
||||
KeyboardIconsSet.ICON_UNDEFINED));
|
||||
final int shiftedIconId = style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted,
|
||||
KeyboardIconsSet.ICON_UNDEFINED);
|
||||
if (shiftedIconId != KeyboardIconsSet.ICON_UNDEFINED) {
|
||||
final Drawable shiftedIcon = iconsSet.getIcon(shiftedIconId);
|
||||
params.addShiftedIcon(this, shiftedIcon);
|
||||
}
|
||||
mHintLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
|
||||
|
||||
mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel);
|
||||
mLabelOption = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption, 0);
|
||||
mOutputText = style.getText(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
|
||||
// Choose the first letter of the label as primary code if not
|
||||
// specified.
|
||||
final int code = style.getInt(keyAttr, R.styleable.Keyboard_Key_code,
|
||||
Keyboard.CODE_UNSPECIFIED);
|
||||
if (code == Keyboard.CODE_UNSPECIFIED && !TextUtils.isEmpty(mLabel)) {
|
||||
final int firstChar = mLabel.charAt(0);
|
||||
mCode = getRtlParenthesisCode(firstChar, params.mIsRtlKeyboard);
|
||||
} else if (code != Keyboard.CODE_UNSPECIFIED) {
|
||||
mCode = code;
|
||||
} else {
|
||||
mCode = Keyboard.CODE_DUMMY;
|
||||
}
|
||||
|
||||
keyAttr.recycle();
|
||||
}
|
||||
|
||||
public void addEdgeFlags(int flags) {
|
||||
|
|
|
@ -218,14 +218,14 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
final int displayHeight = mDisplayMetrics.heightPixels;
|
||||
final int keyboardHeight = (int)keyboardAttr.getDimension(
|
||||
R.styleable.Keyboard_keyboardHeight, displayHeight / 2);
|
||||
final int maxKeyboardHeight = getDimensionOrFraction(keyboardAttr,
|
||||
final int maxKeyboardHeight = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_maxKeyboardHeight, displayHeight, displayHeight / 2);
|
||||
int minKeyboardHeight = getDimensionOrFraction(keyboardAttr,
|
||||
int minKeyboardHeight = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_minKeyboardHeight, displayHeight, displayHeight / 2);
|
||||
if (minKeyboardHeight < 0) {
|
||||
// Specified fraction was negative, so it should be calculated against display
|
||||
// width.
|
||||
minKeyboardHeight = -getDimensionOrFraction(keyboardAttr,
|
||||
minKeyboardHeight = -(int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_minKeyboardHeight, displayWidth, displayWidth / 2);
|
||||
}
|
||||
// Keyboard height will not exceed maxKeyboardHeight and will not be less than
|
||||
|
@ -233,9 +233,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
mParams.mOccupiedHeight = Math.max(
|
||||
Math.min(keyboardHeight, maxKeyboardHeight), minKeyboardHeight);
|
||||
mParams.mOccupiedWidth = mParams.mId.mWidth;
|
||||
mParams.mTopPadding = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mTopPadding = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyboardTopPadding, mParams.mOccupiedHeight, 0);
|
||||
mParams.mBottomPadding = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mBottomPadding = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyboardBottomPadding, mParams.mOccupiedHeight, 0);
|
||||
|
||||
final int height = mParams.mOccupiedHeight;
|
||||
|
@ -243,13 +243,13 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
- mParams.mHorizontalCenterPadding;
|
||||
mParams.mHeight = height;
|
||||
mParams.mWidth = width;
|
||||
mParams.mDefaultKeyWidth = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mDefaultKeyWidth = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyWidth, width, width / 10);
|
||||
mParams.mDefaultRowHeight = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mDefaultRowHeight = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_rowHeight, height, height / 4);
|
||||
mParams.mHorizontalGap = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mHorizontalGap = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_horizontalGap, width, 0);
|
||||
mParams.mVerticalGap = getDimensionOrFraction(keyboardAttr,
|
||||
mParams.mVerticalGap = (int)getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_verticalGap, height, 0);
|
||||
|
||||
mParams.mIsRtlKeyboard = keyboardAttr.getBoolean(
|
||||
|
@ -384,13 +384,13 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
if (keyboardAttr.hasValue(R.styleable.Keyboard_horizontalGap))
|
||||
throw new IllegalAttribute(parser, "horizontalGap");
|
||||
final int keyboardWidth = mParams.mWidth;
|
||||
final int keyWidth = getDimensionOrFraction(keyboardAttr, R.styleable.Keyboard_keyWidth,
|
||||
keyboardWidth, row.mDefaultKeyWidth);
|
||||
final float keyWidth = getDimensionOrFraction(keyboardAttr,
|
||||
R.styleable.Keyboard_keyWidth, keyboardWidth, row.mDefaultKeyWidth);
|
||||
keyboardAttr.recycle();
|
||||
|
||||
final TypedArray keyAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
||||
R.styleable.Keyboard_Key);
|
||||
int keyXPos = KeyboardBuilder.getDimensionOrFraction(keyAttr,
|
||||
float keyXPos = getDimensionOrFraction(keyAttr,
|
||||
R.styleable.Keyboard_Key_keyXPos, keyboardWidth, row.mCurrentX);
|
||||
if (keyXPos < 0) {
|
||||
// If keyXPos is negative, the actual x-coordinate will be display_width + keyXPos.
|
||||
|
@ -688,24 +688,23 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
private void endKeyboard() {
|
||||
}
|
||||
|
||||
private void setSpacer(int keyXPos, int width, Row row) {
|
||||
private void setSpacer(float keyXPos, float width, Row row) {
|
||||
row.mCurrentX = keyXPos + width;
|
||||
mLeftEdge = false;
|
||||
mRightEdgeKey = null;
|
||||
}
|
||||
|
||||
public static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) {
|
||||
public static float getDimensionOrFraction(TypedArray a, int index, int base, float defValue) {
|
||||
final TypedValue value = a.peekValue(index);
|
||||
if (value == null)
|
||||
return defValue;
|
||||
if (isFractionValue(value)) {
|
||||
// Round it to avoid values like 47.9999 from getting truncated
|
||||
return Math.round(a.getFraction(index, base, base, defValue));
|
||||
return a.getFraction(index, base, base, defValue);
|
||||
} else if (isDimensionValue(value)) {
|
||||
return a.getDimensionPixelOffset(index, defValue);
|
||||
return a.getDimension(index, defValue);
|
||||
} else if (isIntegerValue(value)) {
|
||||
// For enum value.
|
||||
return a.getInt(index, defValue);
|
||||
return a.getInt(index, 0);
|
||||
}
|
||||
return defValue;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ import com.android.inputmethod.latin.R;
|
|||
*/
|
||||
public class Row {
|
||||
/** Default width of a key in this row. */
|
||||
public final int mDefaultKeyWidth;
|
||||
public final float mDefaultKeyWidth;
|
||||
/** Default height of a key in this row. */
|
||||
public final int mRowHeight;
|
||||
|
||||
public final int mCurrentY;
|
||||
// Will be updated by {@link Key}'s constructor.
|
||||
public int mCurrentX;
|
||||
public float mCurrentX;
|
||||
|
||||
public Row(Resources res, KeyboardParams params, XmlResourceParser parser, int y) {
|
||||
final int keyboardWidth = params.mWidth;
|
||||
|
@ -46,11 +46,11 @@ public class Row {
|
|||
R.styleable.Keyboard);
|
||||
mDefaultKeyWidth = KeyboardBuilder.getDimensionOrFraction(a,
|
||||
R.styleable.Keyboard_keyWidth, keyboardWidth, params.mDefaultKeyWidth);
|
||||
mRowHeight = KeyboardBuilder.getDimensionOrFraction(a,
|
||||
mRowHeight = (int)KeyboardBuilder.getDimensionOrFraction(a,
|
||||
R.styleable.Keyboard_rowHeight, keyboardHeight, params.mDefaultRowHeight);
|
||||
a.recycle();
|
||||
|
||||
mCurrentY = y;
|
||||
mCurrentX = 0;
|
||||
mCurrentX = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue