@@ -613,10 +613,7 @@ protected void onBottomInsetChanged (int extraBottomInset, int extraBottomInsetW
613613 searchControlsLayout .setTranslationY ((Screen .dp (49f ) + extraBottomInset ) * (1f - searchControlsFactor ));
614614 }
615615 updateSearchControlsInset ();
616- if (keyboardWrapper != null && keyboardLayout != null ) {
617- Views .applyBottomInset (keyboardWrapper , extraBottomInsetWithoutIme );
618- Views .setLayoutHeight (keyboardWrapper , keyboardLayout .getSize () + extraBottomInsetWithoutIme );
619- }
616+ updateCommandKeyboardHeight ();
620617 }
621618
622619 private void updateSearchControlsInset () {
@@ -7534,6 +7531,13 @@ private void openCommandsKeyboard (boolean byUserEvent) {
75347531 openCommandsKeyboard (commandsMessageId , commandsKeyboard , true , byUserEvent );
75357532 }
75367533
7534+ private void updateCommandKeyboardHeight () {
7535+ if (keyboardWrapper != null && keyboardLayout != null ) {
7536+ Views .setLayoutHeight (keyboardWrapper , Math .min (Keyboard .getSize (), keyboardLayout .getSize ()) + extraBottomInsetWithoutIme );
7537+ Views .applyBottomInset (keyboardWrapper , extraBottomInsetWithoutIme );
7538+ }
7539+ }
7540+
75377541 private void openCommandsKeyboard (long messageId , TdApi .ReplyMarkupShowKeyboard keyboard , boolean force , boolean byUserEvent ) {
75387542 if (keyboardLayout == null ) {
75397543 keyboardWrapper = new ScrollView (context ());
@@ -7544,7 +7548,7 @@ private void openCommandsKeyboard (long messageId, TdApi.ReplyMarkupShowKeyboard
75447548 keyboardLayout .setCallback (this );
75457549
75467550 keyboardWrapper .addView (keyboardLayout );
7547- keyboardWrapper .setLayoutParams (new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , keyboardLayout .getSize () + extraBottomInsetWithoutIme ));
7551+ keyboardWrapper .setLayoutParams (new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , Math . min ( Keyboard . getSize (), keyboardLayout .getSize () ) + extraBottomInsetWithoutIme ));
75487552 Views .applyBottomInset (keyboardWrapper , extraBottomInsetWithoutIme );
75497553
75507554 bottomWrap .addView (keyboardWrapper );
@@ -7556,7 +7560,7 @@ private void openCommandsKeyboard (long messageId, TdApi.ReplyMarkupShowKeyboard
75567560 commandsMessageId = messageId ;
75577561 commandsKeyboard = keyboard ;
75587562 keyboardLayout .setKeyboard (keyboard );
7559- Views . setLayoutHeight ( keyboardWrapper , keyboardLayout . getSize () + extraBottomInsetWithoutIme );
7563+ updateCommandKeyboardHeight ( );
75607564 }
75617565
75627566 if (byUserEvent ) {
0 commit comments