mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 07:09:10 +00:00
fix broken popup key width in number layouts
This commit is contained in:
parent
af636badab
commit
df6af1f07e
2 changed files with 9 additions and 7 deletions
|
@ -23,7 +23,7 @@ public final class PopupKeysKeyboard extends Keyboard {
|
|||
|
||||
PopupKeysKeyboard(final PopupKeysKeyboardParams params) {
|
||||
super(params);
|
||||
mDefaultKeyCoordX = params.getDefaultKeyCoordX() + params.mDefaultAbsoluteKeyWidth / 2;
|
||||
mDefaultKeyCoordX = params.getDefaultKeyCoordX() + params.mAbsolutePopupKeyWidth / 2;
|
||||
}
|
||||
|
||||
public int getDefaultCoordX() {
|
||||
|
@ -287,8 +287,8 @@ public final class PopupKeysKeyboard extends Keyboard {
|
|||
final float padding = context.getResources().getDimension(
|
||||
R.dimen.config_popup_keys_keyboard_key_horizontal_padding)
|
||||
+ (key.hasLabelsInPopupKeys()
|
||||
? mParams.mDefaultAbsoluteKeyWidth * LABEL_PADDING_RATIO : 0.0f);
|
||||
keyWidth = getMaxKeyWidth(key, mParams.mDefaultAbsoluteKeyWidth, padding, paintToMeasure);
|
||||
? mParams.mAbsolutePopupKeyWidth * LABEL_PADDING_RATIO : 0.0f);
|
||||
keyWidth = getMaxKeyWidth(key, mParams.mAbsolutePopupKeyWidth, padding, paintToMeasure);
|
||||
rowHeight = keyboard.mMostCommonKeyHeight;
|
||||
}
|
||||
final int dividerWidth;
|
||||
|
@ -342,7 +342,7 @@ public final class PopupKeysKeyboard extends Keyboard {
|
|||
// left of the default position.
|
||||
if (params.mDividerWidth > 0 && pos != 0) {
|
||||
final int dividerX = (pos > 0) ? x - params.mDividerWidth
|
||||
: x + params.mDefaultAbsoluteKeyWidth;
|
||||
: x + params.mAbsolutePopupKeyWidth;
|
||||
final Key divider = new PopupKeyDivider(
|
||||
params, dividerX, y, params.mDividerWidth, params.mDefaultAbsoluteRowHeight);
|
||||
params.onAddKey(divider);
|
||||
|
|
|
@ -66,6 +66,8 @@ public class KeyboardParams {
|
|||
|
||||
public int mPopupKeysTemplate;
|
||||
public int mMaxPopupKeysKeyboardColumn;
|
||||
// popup key width is separate from mDefaultAbsoluteKeyWidth because it should not depend on alpha or number layout
|
||||
public int mAbsolutePopupKeyWidth;
|
||||
|
||||
public int GRID_WIDTH;
|
||||
public int GRID_HEIGHT;
|
||||
|
@ -225,11 +227,11 @@ public class KeyboardParams {
|
|||
|
||||
mBaseWidth = mOccupiedWidth - mLeftPadding - mRightPadding;
|
||||
final float defaultKeyWidthFactor = context.getResources().getInteger(R.integer.config_screen_metrics) > 2 ? 0.9f : 1f;
|
||||
mDefaultKeyWidth = mId.isNumberLayout()
|
||||
? 0.17f
|
||||
: keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
|
||||
final float alphaSymbolKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
|
||||
1, 1, defaultKeyWidthFactor / DEFAULT_KEYBOARD_COLUMNS);
|
||||
mDefaultKeyWidth = mId.isNumberLayout() ? 0.17f : alphaSymbolKeyWidth;
|
||||
mDefaultAbsoluteKeyWidth = (int) (mDefaultKeyWidth * mBaseWidth);
|
||||
mAbsolutePopupKeyWidth = (int) (alphaSymbolKeyWidth * mBaseWidth);
|
||||
|
||||
// todo: maybe settings should not be accessed from here?
|
||||
if (Settings.getInstance().getCurrent().mNarrowKeyGaps) {
|
||||
|
|
Loading…
Add table
Reference in a new issue