66import android .content .res .Configuration ;
77import android .content .res .TypedArray ;
88import android .os .Build ;
9- import android .text .Html ;
109import android .text .Spanned ;
1110import android .view .LayoutInflater ;
1211import android .view .View ;
2625import dev .shreyaspatil .MaterialDialog .interfaces .OnDismissListener ;
2726import dev .shreyaspatil .MaterialDialog .interfaces .OnShowListener ;
2827import dev .shreyaspatil .MaterialDialog .model .DialogButton ;
29- import dev .shreyaspatil .MaterialDialog .model .DialogText ;
28+ import dev .shreyaspatil .MaterialDialog .model .DialogMessage ;
29+ import dev .shreyaspatil .MaterialDialog .model .DialogTitle ;
3030import dev .shreyaspatil .MaterialDialog .model .TextAlignment ;
3131
3232@ SuppressWarnings ("unused" )
@@ -40,8 +40,8 @@ public abstract class AbstractDialog implements DialogInterface {
4040
4141 protected Dialog mDialog ;
4242 protected Activity mActivity ;
43- protected DialogText title ;
44- protected DialogText message ;
43+ protected DialogTitle title ;
44+ protected DialogMessage message ;
4545 protected boolean mCancelable ;
4646 protected DialogButton mPositiveButton ;
4747 protected DialogButton mNegativeButton ;
@@ -57,8 +57,8 @@ public abstract class AbstractDialog implements DialogInterface {
5757 protected OnShowListener mOnShowListener ;
5858
5959 protected AbstractDialog (@ NonNull Activity mActivity ,
60- @ NonNull DialogText title ,
61- @ NonNull DialogText message ,
60+ @ NonNull DialogTitle title ,
61+ @ NonNull DialogMessage message ,
6262 boolean mCancelable ,
6363 @ NonNull DialogButton mPositiveButton ,
6464 @ NonNull DialogButton mNegativeButton ,
@@ -98,13 +98,8 @@ protected View createView(@NonNull LayoutInflater inflater, @Nullable ViewGroup
9898 // Set Message
9999 if (message != null ) {
100100 mMessageView .setVisibility (View .VISIBLE );
101- Spanned spannedMessage = null ;
102- if (android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .N ) {
103- spannedMessage = Html .fromHtml (message .getText (), Html .FROM_HTML_MODE_COMPACT );
104- } else {
105- spannedMessage = Html .fromHtml (message .getText ());
106- }
107- mMessageView .setText (spannedMessage );
101+
102+ mMessageView .setText (message .getText ());
108103 mMessageView .setTextAlignment (message .getTextAlignment ().getAlignment ());
109104 } else {
110105 mMessageView .setVisibility (View .GONE );
@@ -349,8 +344,8 @@ public interface OnClickListener {
349344 */
350345 public static abstract class Builder <D extends AbstractDialog > {
351346 protected final Activity activity ;
352- protected DialogText title ;
353- protected DialogText message ;
347+ protected DialogTitle title ;
348+ protected DialogMessage message ;
354349 protected boolean isCancelable ;
355350 protected DialogButton positiveButton ;
356351 protected DialogButton negativeButton ;
@@ -380,12 +375,12 @@ public Builder<D> setTitle(@NonNull String title) {
380375 */
381376 @ NonNull
382377 public Builder <D > setTitle (@ NonNull String title , @ NonNull TextAlignment alignment ) {
383- this .title = new DialogText (title , alignment );
378+ this .title = new DialogTitle (title , alignment );
384379 return this ;
385380 }
386381
387382 /**
388- * @param message Sets the Message of Material Dialog with the default alignment as center.
383+ * @param message Sets the plain text Message of Material Dialog with the default alignment as center.
389384 * @return this, for chaining.
390385 */
391386 @ NonNull
@@ -394,13 +389,33 @@ public Builder<D> setMessage(@NonNull String message) {
394389 }
395390
396391 /**
397- * @param message Sets the Message of Material Dialog.
392+ * @param message Sets the plain text Message of Material Dialog.
398393 * @param alignment Sets the Alignment for the message.
399394 * @return this, for chaining.
400395 */
401396 @ NonNull
402397 public Builder <D > setMessage (@ NonNull String message , @ NonNull TextAlignment alignment ) {
403- this .message = new DialogText (message , alignment );
398+ this .message = DialogMessage .text (message , alignment );
399+ return this ;
400+ }
401+
402+ /**
403+ * @param message Sets the spanned text Message of Material Dialog with the default alignment as center.
404+ * @return this, for chaining.
405+ */
406+ @ NonNull
407+ public Builder <D > setMessage (@ NonNull Spanned message ) {
408+ return setMessage (message , TextAlignment .CENTER );
409+ }
410+
411+ /**
412+ * @param message Sets the spanned text Message of Material Dialog.
413+ * @param alignment Sets the Alignment for the message.
414+ * @return this, for chaining.
415+ */
416+ @ NonNull
417+ public Builder <D > setMessage (@ NonNull Spanned message , @ NonNull TextAlignment alignment ) {
418+ this .message = DialogMessage .spanned (message , alignment );
404419 return this ;
405420 }
406421
0 commit comments