From a9a423138af52e84f016fcefd8bd0e44d6524901 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 27 Jan 2021 12:28:17 +0200 Subject: [PATCH] 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 --- .../base/MenuBottomSheetDialogFragment.java | 18 ++++++++++++++++++ .../monitoring/TripRecordingBottomSheet.java | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java index 2af2d9673b..0afa81a300 100644 --- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java @@ -268,6 +268,18 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra 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() { return DialogButtonType.SECONDARY; } @@ -360,6 +372,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra private void setupDismissButton() { 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(); if (buttonTextId != DEFAULT_VALUE) { UiUtilities.setupDialogButton(nightMode, dismissButton, getDismissButtonType(), buttonTextId); @@ -376,6 +390,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra private void setupRightButton() { 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(); if (buttonTextId != DEFAULT_VALUE) { UiUtilities.setupDialogButton(nightMode, rightButton, getRightBottomButtonType(), buttonTextId); @@ -398,6 +414,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra protected void setupThirdButton() { 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(); if (buttonTextId != DEFAULT_VALUE) { UiUtilities.setupDialogButton(nightMode, thirdButton, getThirdBottomButtonType(), buttonTextId); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java index 096430f3da..1cb23e7ba9 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java @@ -252,6 +252,16 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment { 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 protected int getRightBottomButtonTextId() { return R.string.start_recording;