diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java index 327eaadf24..a80d28f5a7 100644 --- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java @@ -78,6 +78,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra if (bottomDividerColorId != -1) { mainView.findViewById(R.id.bottom_row_divider).setBackgroundColor(getResolvedColor(bottomDividerColorId)); } + mainView.findViewById(R.id.dismiss_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -87,6 +88,24 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra }); ((TextView) mainView.findViewById(R.id.dismiss_button_text)).setText(getDismissButtonTextId()); + int rightBottomButtonTextId = getRightBottomButtonTextId(); + if (rightBottomButtonTextId != -1) { + View buttonsDivider = mainView.findViewById(R.id.bottom_buttons_divider); + buttonsDivider.setVisibility(View.VISIBLE); + if (bottomDividerColorId != -1) { + buttonsDivider.setBackgroundColor(getResolvedColor(bottomDividerColorId)); + } + View rightButton = mainView.findViewById(R.id.right_bottom_button); + rightButton.setVisibility(View.VISIBLE); + rightButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onRightBottomButtonClick(); + } + }); + ((TextView) rightButton.findViewById(R.id.right_bottom_button_text)).setText(rightBottomButtonTextId); + } + setupHeightAndBackground(mainView); return mainView; @@ -188,6 +207,15 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra } + @StringRes + protected int getRightBottomButtonTextId() { + return -1; + } + + protected void onRightBottomButtonClick() { + + } + @ColorRes protected int getBgColorId() { return nightMode ? R.color.bg_color_dark : R.color.bg_color_light;