mirror of
https://github.com/Nezumi-2711/Foodify-Shipper.git
synced 2026-09-22 13:38:42 +00:00
113 lines
3.0 KiB
Markdown
113 lines
3.0 KiB
Markdown
# MessageDialog Documentation
|
|
Message dialog example
|
|
```java
|
|
MessageDialog messageDialog = new MessageDialog();
|
|
messageDialog.Builder(context)
|
|
.setTitle("Title")
|
|
.setMessage("Message")
|
|
.show();
|
|
```
|
|

|
|
## Builder
|
|
Apply the default theme to a dialog
|
|
```java
|
|
messageDialog.Builder(context)
|
|
```
|
|

|
|
Apply the app theme to a dialog **(only works with material3 theme)**
|
|
```java
|
|
messageDialog.Builder(context,true)
|
|
```
|
|
Apply the custom theme to a dialog **(only works with material3 theme)**
|
|
```java
|
|
messageDialog.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
|
|
```java
|
|
messageDialog.setOldTheme();
|
|
```
|
|

|
|
## Add onClick Listener
|
|
```java
|
|
messageDialog.onButtonClick(new DialogButtonEvent() {
|
|
@Override
|
|
public void onButtonClick() {
|
|
// Do something
|
|
}
|
|
});
|
|
|
|
//or
|
|
|
|
messageDialog.onButtonClick(() -> {
|
|
// Do something
|
|
});
|
|
```
|
|
## All MessageDialog Methods
|
|
```java
|
|
//Create dialog
|
|
messageDialog.Builder(context);
|
|
|
|
//Usin the old dialog theme
|
|
messageDialog.setOldTheme();
|
|
|
|
//Set title
|
|
messageDialog.setTitle("Title");
|
|
//Set message
|
|
messageDialog.setMessage("Message");
|
|
|
|
//Set title text alignment
|
|
messageDialog.setTitleAlignment(TextAlignment);
|
|
//Set message text alignment
|
|
messageDialog.setMessageAlignment(TextAlignment);
|
|
|
|
//Set button text
|
|
messageDialog.setButtonText("Text");
|
|
|
|
//Set text color
|
|
messageDialog.setTextColor(color);
|
|
//Set title text color
|
|
messageDialog.setTitleTextColor(color);
|
|
//Set message text color
|
|
messageDialog.setMessageTextColor(color);
|
|
|
|
//Set button color
|
|
messageDialog.setButtonColor(color);
|
|
|
|
//Set button text color
|
|
messageDialog.setButtonTextColor(color);
|
|
|
|
//Set button background resource
|
|
messageDialog.setButtonBackgroundResource(drawable);
|
|
|
|
//Set dialog color
|
|
messageDialog.setDialogBackgroundColor(color);
|
|
//Set dialog background resource
|
|
messageDialog.setDialogBackgroundResource(drawable);
|
|
|
|
//Set maximum dialog width. Default is 600dp
|
|
messageDialog.setMaxDialogWidth(width);
|
|
|
|
//Get maximum dialog width
|
|
int dialogWidth = messageDialog.getMaxDialogWidth();
|
|
|
|
//Get button
|
|
Button Button = messageDialog.getButton();
|
|
|
|
//Set dialog animations
|
|
messageDialog.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
|
|
messageDialog.show();
|
|
//Dismiss dialog
|
|
messageDialog.dismiss();
|
|
```
|