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)); oneHandedKey.setImageDrawable(keyboardAttr.getDrawable(R.styleable.Keyboard_iconStartOneHandedMode));
keyboardAttr.recycle(); 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); mToolbarArrowIcon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right);
mDefaultBackground = mToolbarKey.getBackground(); mDefaultBackground = mToolbarKey.getBackground();
colors.setBackgroundColor(mDefaultBackground, BackgroundType.SUGGESTION); colors.setBackgroundColor(mDefaultBackground, BackgroundType.SUGGESTION);

View file

@ -22,8 +22,6 @@
android:id="@+id/suggestions_strip_toolbar_key" android:id="@+id/suggestions_strip_toolbar_key"
android:layout_width="@dimen/config_suggestions_strip_edge_key_width" android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
android:layout_height="@dimen/config_suggestions_strip_edge_key_width" android:layout_height="@dimen/config_suggestions_strip_edge_key_width"
android:maxHeight="@dimen/config_suggestions_strip_height"
android:maxWidth="@dimen/config_suggestions_strip_height"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="0" android:layout_weight="0"
style="?attr/suggestionWordStyle" style="?attr/suggestionWordStyle"