Skip to content

Commit 56ee38c

Browse files
committed
fix(emoji): scale grid cells by emoji font scale
1 parent ec332d5 commit 56ee38c

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ cline_docs/
7373
.continue/
7474
prompt_history.json
7575
chat.json
76-
docs/superpowers/
76+
docs/superpowers/
77+
.agents
78+
.antigravitycli/

app/src/main/java/helium314/keyboard/keyboard/emoji/DynamicGridKeyboard.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,33 @@ public DynamicGridKeyboard(final SharedPreferences prefs, final Keyboard templat
6565
final Key key1 = getTemplateKey(Constants.RECENTS_TEMPLATE_KEY_CODE_1);
6666
final int horizontalGap = Math.abs(key1.getX() - key0.getX()) - key0.getWidth();
6767
final float widthScale = determineWidthScale(key0.getWidth() + horizontalGap);
68+
int columnsNumVal;
69+
int horizontalStepVal;
70+
int horizontalGapVal;
6871
if (categoryId == EmojiCategory.ID_EMOTICONS) {
6972
// Emoticons need more space, so we use approx half the columns
7073
final int standardColumns = mBaseWidth / (int) ((key0.getWidth() + horizontalGap) * widthScale);
71-
mColumnsNum = Math.max(1, standardColumns / 2);
72-
mHorizontalStep = mBaseWidth / mColumnsNum;
73-
mHorizontalGap = (int) (horizontalGap * widthScale * 2);
74+
columnsNumVal = Math.max(1, standardColumns / 2);
75+
horizontalStepVal = mBaseWidth / columnsNumVal;
76+
horizontalGapVal = (int) (horizontalGap * widthScale * 2);
7477
} else {
75-
mHorizontalGap = (int) (horizontalGap * widthScale);
76-
mHorizontalStep = (int) ((key0.getWidth() + horizontalGap) * widthScale);
77-
mColumnsNum = mBaseWidth / mHorizontalStep;
78+
horizontalGapVal = (int) (horizontalGap * widthScale);
79+
horizontalStepVal = (int) ((key0.getWidth() + horizontalGap) * widthScale);
80+
columnsNumVal = mBaseWidth / horizontalStepVal;
7881
}
79-
mVerticalStep = (int) ((key0.getHeight() + mVerticalGap)
82+
int verticalStepVal = (int) ((key0.getHeight() + mVerticalGap)
8083
/ Math.sqrt(Settings.getValues().mKeyboardHeightScale));
84+
if (Settings.getValues().mEmojiKeyFit) {
85+
final float scale = Settings.getValues().mFontSizeMultiplierEmoji;
86+
horizontalGapVal = (int) (horizontalGapVal * scale);
87+
horizontalStepVal = (int) (horizontalStepVal * scale);
88+
columnsNumVal = Math.max(1, mBaseWidth / horizontalStepVal);
89+
verticalStepVal = (int) (verticalStepVal * scale);
90+
}
91+
mHorizontalGap = horizontalGapVal;
92+
mHorizontalStep = horizontalStepVal;
93+
mColumnsNum = columnsNumVal;
94+
mVerticalStep = verticalStepVal;
8195
if (spacerWidth > 0)
8296
setSpacerColumns(spacerWidth);
8397
mMaxKeyCount = maxKeyCount;

0 commit comments

Comments
 (0)