mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-09 16:17:44 +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) {
|
PopupKeysKeyboard(final PopupKeysKeyboardParams params) {
|
||||||
super(params);
|
super(params);
|
||||||
mDefaultKeyCoordX = params.getDefaultKeyCoordX() + params.mDefaultAbsoluteKeyWidth / 2;
|
mDefaultKeyCoordX = params.getDefaultKeyCoordX() + params.mAbsolutePopupKeyWidth / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefaultCoordX() {
|
public int getDefaultCoordX() {
|
||||||
|
@ -287,8 +287,8 @@ public final class PopupKeysKeyboard extends Keyboard {
|
||||||
final float padding = context.getResources().getDimension(
|
final float padding = context.getResources().getDimension(
|
||||||
R.dimen.config_popup_keys_keyboard_key_horizontal_padding)
|
R.dimen.config_popup_keys_keyboard_key_horizontal_padding)
|
||||||
+ (key.hasLabelsInPopupKeys()
|
+ (key.hasLabelsInPopupKeys()
|
||||||
? mParams.mDefaultAbsoluteKeyWidth * LABEL_PADDING_RATIO : 0.0f);
|
? mParams.mAbsolutePopupKeyWidth * LABEL_PADDING_RATIO : 0.0f);
|
||||||
keyWidth = getMaxKeyWidth(key, mParams.mDefaultAbsoluteKeyWidth, padding, paintToMeasure);
|
keyWidth = getMaxKeyWidth(key, mParams.mAbsolutePopupKeyWidth, padding, paintToMeasure);
|
||||||
rowHeight = keyboard.mMostCommonKeyHeight;
|
rowHeight = keyboard.mMostCommonKeyHeight;
|
||||||
}
|
}
|
||||||
final int dividerWidth;
|
final int dividerWidth;
|
||||||
|
@ -342,7 +342,7 @@ public final class PopupKeysKeyboard extends Keyboard {
|
||||||
// left of the default position.
|
// left of the default position.
|
||||||
if (params.mDividerWidth > 0 && pos != 0) {
|
if (params.mDividerWidth > 0 && pos != 0) {
|
||||||
final int dividerX = (pos > 0) ? x - params.mDividerWidth
|
final int dividerX = (pos > 0) ? x - params.mDividerWidth
|
||||||
: x + params.mDefaultAbsoluteKeyWidth;
|
: x + params.mAbsolutePopupKeyWidth;
|
||||||
final Key divider = new PopupKeyDivider(
|
final Key divider = new PopupKeyDivider(
|
||||||
params, dividerX, y, params.mDividerWidth, params.mDefaultAbsoluteRowHeight);
|
params, dividerX, y, params.mDividerWidth, params.mDefaultAbsoluteRowHeight);
|
||||||
params.onAddKey(divider);
|
params.onAddKey(divider);
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class KeyboardParams {
|
||||||
|
|
||||||
public int mPopupKeysTemplate;
|
public int mPopupKeysTemplate;
|
||||||
public int mMaxPopupKeysKeyboardColumn;
|
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_WIDTH;
|
||||||
public int GRID_HEIGHT;
|
public int GRID_HEIGHT;
|
||||||
|
@ -225,11 +227,11 @@ public class KeyboardParams {
|
||||||
|
|
||||||
mBaseWidth = mOccupiedWidth - mLeftPadding - mRightPadding;
|
mBaseWidth = mOccupiedWidth - mLeftPadding - mRightPadding;
|
||||||
final float defaultKeyWidthFactor = context.getResources().getInteger(R.integer.config_screen_metrics) > 2 ? 0.9f : 1f;
|
final float defaultKeyWidthFactor = context.getResources().getInteger(R.integer.config_screen_metrics) > 2 ? 0.9f : 1f;
|
||||||
mDefaultKeyWidth = mId.isNumberLayout()
|
final float alphaSymbolKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
|
||||||
? 0.17f
|
|
||||||
: keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
|
|
||||||
1, 1, defaultKeyWidthFactor / DEFAULT_KEYBOARD_COLUMNS);
|
1, 1, defaultKeyWidthFactor / DEFAULT_KEYBOARD_COLUMNS);
|
||||||
|
mDefaultKeyWidth = mId.isNumberLayout() ? 0.17f : alphaSymbolKeyWidth;
|
||||||
mDefaultAbsoluteKeyWidth = (int) (mDefaultKeyWidth * mBaseWidth);
|
mDefaultAbsoluteKeyWidth = (int) (mDefaultKeyWidth * mBaseWidth);
|
||||||
|
mAbsolutePopupKeyWidth = (int) (alphaSymbolKeyWidth * mBaseWidth);
|
||||||
|
|
||||||
// todo: maybe settings should not be accessed from here?
|
// todo: maybe settings should not be accessed from here?
|
||||||
if (Settings.getInstance().getCurrent().mNarrowKeyGaps) {
|
if (Settings.getInstance().getCurrent().mNarrowKeyGaps) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue