Version 2.0
Warning, this is a major release. There are some changes that can break existing code.
- The
Builder
has been rewritten. See the guide below to migrate your existing 1.x code. setPositive(...)
,setNegative(...)
andsetNeutral(...)
have been deprecated. You should now usesetPositiveText(string)
,setPositiveText(int)
,onPositive(callback)
...- The deprecated
withAnimation(boolean)
method has been removed. - Updated material-dialogs to 0.9.0.2
How to migrate your existing code to 2.x
Using the new Builder
The dialogs are now initialized using MaterialStyledDialog.Builder
. Checkout this basic examples:
new MaterialStyledDialog.Builder(this)
.setTitle("Awesome!")
.setDescription("What can we improve? Your feedback is always welcome.")
.show();
or
MaterialStyledDialog dialog = new MaterialStyledDialog.Builder(this)
.setTitle("Awesome!")
.setDescription("What can we improve? Your feedback is always welcome.")
.build();
...
dialog.show();
Adding buttons and callbacks
The previous methods setPositive(...)
, setNegative(...)
and setNeutral(...)
have been deprecated. You should use the next ones:
new MaterialStyledDialog.Builder(this)
.setTitle("Awesome!")
.setDescription("What can we improve? Your feedback is always welcome.")
.setPositiveText(R.string.button)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Log.d("MaterialStyledDialogs", "Do something!");
})
//.setNegativeText(...)
//.onNegative(...)
//.setNeutralText(...)
//.onNeutral(...)
.show();