Material Alert Dialog
- min SDK 16
- was written in Java now in Kotlin
- simple beautiful dialogs with image and GIF support
Add this into your project's root build.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to your module build.gradle:
dependencies {
implementation 'com.github.umairayub79:MaDialog:1.3'
}
//build a simple dialog
new MaDialog.Builder(MainActivity.this)
.setTitle("Example Dialog")
.setMessage("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis scelerisquevel. ")
.setPositiveButtonText("ok")
.setNegativeButtonText("cancel")
setButtonOrientation(LinearLayout.HORIZONTAL)
.AddNewButton(R.style.AppTheme, "Yes", new MaDialogListener() {
@Override
public void onClick() {
}
})
.setPositiveButtonListener(new MaDialogListener() {
@Override
public void onClick() {
//todo
}
})
.setNegativeButtonListener(new MaDialogListener() {
@Override
public void onClick() {
//todo
}
})
.build();
//Available Methods
.setTitle(String);
.setMessage(String);
.setImage(int);
.setGif(int);
.setMessageTextColor(int);
.setTitleTextColor(int);
.setButtonTextColor(int);
.AddNewButton(int,String,MaDialogListener);
.setButtonOrientation(int);
.setBackgroundColor(int);
.setNegativeButtonText(String);
.setPositiveButtonText(String);
.setCancelableOnOutsideTouch(boolean);
.setPositiveButtonListener(MaDialogListener);
.setNegativeButtonListener(MaDialogListener);
.build();