@@ -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