Buttons height

Buttons, add a parameter for our button default/large (user needed proper name). Those parameters should control buttons height, default 36dp, large 48 dp. Make bottom buttons 48
This commit is contained in:
androiddevkotlin 2021-01-27 12:28:17 +02:00
parent 878208deee
commit a9a423138a
2 changed files with 28 additions and 0 deletions

View file

@ -268,6 +268,18 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
dismissButtonStringRes = stringRes; dismissButtonStringRes = stringRes;
} }
protected int getDismissButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected int getRightButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected int getThirdButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height_small);
}
protected DialogButtonType getDismissButtonType() { protected DialogButtonType getDismissButtonType() {
return DialogButtonType.SECONDARY; return DialogButtonType.SECONDARY;
} }
@ -360,6 +372,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
private void setupDismissButton() { private void setupDismissButton() {
dismissButton = buttonsContainer.findViewById(R.id.dismiss_button); dismissButton = buttonsContainer.findViewById(R.id.dismiss_button);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getDismissButtonHeight());
dismissButton.setLayoutParams(lp);
int buttonTextId = getDismissButtonTextId(); int buttonTextId = getDismissButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), buttonTextId);
@ -376,6 +390,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
private void setupRightButton() { private void setupRightButton() {
rightButton = buttonsContainer.findViewById(R.id.right_bottom_button); rightButton = buttonsContainer.findViewById(R.id.right_bottom_button);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getRightButtonHeight());
rightButton.setLayoutParams(lp);
int buttonTextId = getRightBottomButtonTextId(); int buttonTextId = getRightBottomButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), buttonTextId);
@ -398,6 +414,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
protected void setupThirdButton() { protected void setupThirdButton() {
thirdButton = buttonsContainer.findViewById(R.id.third_button); thirdButton = buttonsContainer.findViewById(R.id.third_button);
android.widget.LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getThirdButtonHeight());
thirdButton.setLayoutParams(lp);
int buttonTextId = getThirdBottomButtonTextId(); int buttonTextId = getThirdBottomButtonTextId();
if (buttonTextId != DEFAULT_VALUE) { if (buttonTextId != DEFAULT_VALUE) {
UiUtilities.setupDialogButton(nightMode, thirdButton, getThirdBottomButtonType(), buttonTextId); UiUtilities.setupDialogButton(nightMode, thirdButton, getThirdBottomButtonType(), buttonTextId);

View file

@ -252,6 +252,16 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment {
return true; return true;
} }
@Override
protected int getRightButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
}
@Override
protected int getDismissButtonHeight(){
return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
}
@Override @Override
protected int getRightBottomButtonTextId() { protected int getRightBottomButtonTextId() {
return R.string.start_recording; return R.string.start_recording;