diff --git a/README.md b/README.md index 889a4b9..3be46e8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ And add the library to your module **build.gradle**: ```gradle dependencies { - implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0' + implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.1' } ``` @@ -381,6 +381,18 @@ new MaterialStyledDialog.Builder(this)
+### Get the buttons of the dialog +If you need to access the buttons of your dialog, you can achieve it like this: +```kotlin +val dialog = MaterialStyledDialog.Builder(this) + .setTitle("Awesome!") + .setDescription("This is a sample description.") + .show() + +dialog.positiveButton().text = "Positive" +dialog.negativeButton().text = "Negative" +``` + ## License Copyright 2016-2020 Javier Santos diff --git a/app/build.gradle b/app/build.gradle index c7a4055..f00a2b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.github.javiersantos.materialstyleddialogs.demo" minSdkVersion 16 targetSdkVersion 29 - versionCode 300 - versionName "3.0.0" + versionCode 301 + versionName "3.0.1" } buildTypes { release { diff --git a/library/build.gradle b/library/build.gradle index b6f6122..c5df2e9 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 29 - versionCode 300 - versionName "3.0.0" + versionCode 301 + versionName "3.0.1" } buildTypes { release { diff --git a/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.kt b/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.kt index 054686c..b1d7ae5 100644 --- a/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.kt +++ b/library/src/main/java/com/github/javiersantos/materialstyleddialogs/MaterialStyledDialog.kt @@ -17,7 +17,10 @@ import androidx.appcompat.widget.AppCompatImageView import androidx.core.content.res.ResourcesCompat import com.afollestad.materialdialogs.DialogCallback import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.WhichButton +import com.afollestad.materialdialogs.actions.getActionButton import com.afollestad.materialdialogs.customview.customView +import com.afollestad.materialdialogs.internal.button.DialogActionButton import com.github.javiersantos.materialstyleddialogs.UtilsAnimation.startAnimation import com.github.javiersantos.materialstyleddialogs.UtilsLibrary.dpToPixels import com.github.javiersantos.materialstyleddialogs.UtilsLibrary.getColor @@ -167,6 +170,11 @@ class MaterialStyledDialog( return contentView } + fun positiveButton() = builder.dialog?.getActionButton(WhichButton.POSITIVE) + fun negativeButton() = builder.dialog?.getActionButton(WhichButton.NEGATIVE) + @Deprecated("Neutral button is deprecated in the parent library: https://github.com/afollestad/material-dialogs") + fun neutralButton() = builder.dialog?.getActionButton(WhichButton.NEUTRAL) + class Builder(var context: Context) : IBuilder { var dialog: MaterialDialog? = null