Add methods for setup the right bottom button in MenuBottomSheetDialogFragment
This commit is contained in:
parent
fd43a3c59e
commit
3a7d6a9626
1 changed files with 28 additions and 0 deletions
|
@ -78,6 +78,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
||||||
if (bottomDividerColorId != -1) {
|
if (bottomDividerColorId != -1) {
|
||||||
mainView.findViewById(R.id.bottom_row_divider).setBackgroundColor(getResolvedColor(bottomDividerColorId));
|
mainView.findViewById(R.id.bottom_row_divider).setBackgroundColor(getResolvedColor(bottomDividerColorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
mainView.findViewById(R.id.dismiss_button).setOnClickListener(new View.OnClickListener() {
|
mainView.findViewById(R.id.dismiss_button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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());
|
((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);
|
setupHeightAndBackground(mainView);
|
||||||
|
|
||||||
return mainView;
|
return mainView;
|
||||||
|
@ -188,6 +207,15 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ColorRes
|
@ColorRes
|
||||||
protected int getBgColorId() {
|
protected int getBgColorId() {
|
||||||
return nightMode ? R.color.bg_color_dark : R.color.bg_color_light;
|
return nightMode ? R.color.bg_color_dark : R.color.bg_color_light;
|
||||||
|
|
Loading…
Reference in a new issue