mirror of
https://github.com/Nezumi-2711/Foodify-Shipper.git
synced 2026-09-22 20:00:51 +00:00
3.8 KiB
3.8 KiB
BasicDialog Documentation
Create dialog example
BasicDialog dialog = new BasicDialog();
dialog.Builder(context)
.setTitle("Title")
.setLeftButtonText("button1")
.setRightButtonText("button2")
.onButtonClick(() -> {
// Do something
})
.show();
Builder
Apply the default theme to a dialog
dialog.Builder(context)
Apply the app theme to a dialog (only works with material3 theme)
dialog.Builder(context,true)
Apply the custom theme to a dialog (only works with material3 theme)
dialog.Builder(context,theme)
Old Dialog theme
By default dialog colors will be set to material3 dynamic colors. With this method you can set the dialog color for the background and buttons to the older non-dynamic colors
dialog.setOldTheme();
Add onClick Listener
onClickListener for right button. The left button is for dismissing dialog
dialog.onButtonClick(new DialogButtonEvent() {
@Override
public void onButtonClick() {
// Do something
}
});
//or
dialog.onButtonClick(() -> {
// Do something
});
onClickListener for left and right button
dialog.onButtonClick(new DialogButtonEvents() {
@Override
public void onLeftButtonClick() {
// Do something
}
@Override
public void onRightButtonClick() {
// Do something
}
});
All BasicDialog Methods
//Create dialog
dialog.Builder(context);
//Usin the old dialog theme
dialog.setOldTheme();
//Set title
dialog.setTitle("Title");
//Set message
dialog.setMessage("Message");
//Set title text alignment
dialog.setTitleAlignment(TextAlignment);
//Set message text alignment
dialog.setMessageAlignment(TextAlignment);
//Set left button text
dialog.setLeftButtonText("Text");
//Set right button text
dialog.setRightButtonText("Text");
//Set text color
dialog.setTextColor(color);
//Set title text color
dialog.setTitleTextColor(color);
//Set message text color
dialog.setMessageTextColor(color);
//Set buttons color
dialog.setButtonsColor(color);
//Set left button color
dialog.setLeftButtonColor(color);
//Set right button color
dialog.setRightButtonColor(color);
//Set buttons text color
dialog.setButtonsTextColor(color);
//Set text color for left button
dialog.setLeftButtonTextColor(color);
//Set text color for right button
dialog.setRightButtonTextColor(color);
//Set buttons background resource
dialog.setButtonsBackgroundResource(drawable);
//Set left button background resource
dialog.setLeftButtonBackgroundResource(drawable);
//Set right button background resource
dialog.setRightButtonBackgroundResource(drawable);
//Set dialog color
dialog.setDialogBackgroundColor(color);
//Set dialog background resource
dialog.setDialogBackgroundResource(drawable);
//Set maximum dialog width. Default is 600dp
dialog.setMaxDialogWidth(width);
//Get maximum dialog width
int dialogWidth = dialog.getMaxDialogWidth();
//Get left button
Button leftButton = dialog.getLeftButton();
//Get right button
Button rightButton = dialog.getRightButton();
//Set dialog animations
dialog.setDialogAnimations(styleRes);
//Enable or disable swipe down to dismiss dialog.
//By default is set to true
dialog.swipeToDismiss(boolean);
//Set dialog onTouchListener.
//This method will overide swipe down to dismiss action
dialog.setOnTouchListener(onTouchListener);
//Shew dialog
dialog.show();
//Dismiss dialog
dialog.dismiss();


