set maxHeight/maxWidth of toolbar key programmatically

fixes #221
This commit is contained in:
Helium314 2023-10-20 09:50:27 +02:00
parent d183baf401
commit fd65e92e39
2 changed files with 3 additions and 2 deletions

View file

@ -197,6 +197,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
oneHandedKey.setImageDrawable(keyboardAttr.getDrawable(R.styleable.Keyboard_iconStartOneHandedMode));
keyboardAttr.recycle();
final int toolbarHeight = Math.min(mToolbarKey.getLayoutParams().height, (int) getResources().getDimension(R.dimen.config_suggestions_strip_height));
mToolbarKey.getLayoutParams().height = toolbarHeight;
mToolbarKey.getLayoutParams().width = toolbarHeight; // we want it square
mToolbarArrowIcon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right);
mDefaultBackground = mToolbarKey.getBackground();
colors.setBackgroundColor(mDefaultBackground, BackgroundType.SUGGESTION);