@@ -134,8 +134,8 @@ protected final This setArg(String key, boolean value){
134134 return (This ) this ;
135135 }
136136 @ SuppressWarnings ("unchecked cast" )
137- protected final This setArg (String key , String value ){
138- getArgs ().putString (key , value );
137+ protected final This setArg (String key , CharSequence value ){
138+ getArgs ().putCharSequence (key , value );
139139 return (This ) this ;
140140 }
141141 @ SuppressWarnings ("unchecked cast" )
@@ -149,10 +149,10 @@ protected final This setArg(String key, long value){
149149 return (This ) this ;
150150 }
151151 @ Nullable
152- protected final String getArgString (String key ){
152+ protected final CharSequence getArgString (String key ){
153153 Object value = getArgs ().get (key );
154- if (value instanceof String ){
155- return (String ) value ;
154+ if (value instanceof CharSequence ){
155+ return (CharSequence ) value ;
156156 } else if (value instanceof Integer ){
157157 return getString ((Integer ) value );
158158 }
@@ -179,7 +179,7 @@ protected final Bundle getArgs(){
179179 * @param title the title as string
180180 * @return this instance
181181 */
182- public This title (String title ){ return setArg (TITLE , title ); }
182+ public This title (CharSequence title ){ return setArg (TITLE , title ); }
183183
184184 /**
185185 * Sets this dialogs title
@@ -193,7 +193,7 @@ protected final Bundle getArgs(){
193193 * Gets the string representation of the title set
194194 * @return the dialog title
195195 */
196- public @ Nullable String getTitle (){
196+ public @ Nullable CharSequence getTitle (){
197197 return getArgString (TITLE );
198198 }
199199
@@ -203,15 +203,15 @@ protected final Bundle getArgs(){
203203 * @param message title as string
204204 * @return this instance
205205 */
206- public This msg (String message ){ return setArg (MESSAGE , message ); }
206+ public This msg (CharSequence message ){ setArg ( HTML , false ); return setArg (MESSAGE , message ); }
207207
208208 /**
209209 * Sets this dialogs message
210210 *
211211 * @param messageResourceId the message as android string resource
212212 * @return this instance
213213 */
214- public This msg (@ StringRes int messageResourceId ){ return setArg (MESSAGE , messageResourceId ); }
214+ public This msg (@ StringRes int messageResourceId ){ setArg ( HTML , false ); return setArg (MESSAGE , messageResourceId ); }
215215
216216 /**
217217 * Sets this dialogs message as html styled string
@@ -233,7 +233,7 @@ protected final Bundle getArgs(){
233233 * Gets the string representation of the message set
234234 * @return the dialog message
235235 */
236- public @ Nullable String getMessage (){
236+ public @ Nullable CharSequence getMessage (){
237237 return getArgString (MESSAGE );
238238 }
239239
@@ -243,7 +243,7 @@ protected final Bundle getArgs(){
243243 * @param positiveButton the text as string
244244 * @return this instance
245245 */
246- public This pos (String positiveButton ){ return setArg (POSITIVE_BUTTON_TEXT , positiveButton ); }
246+ public This pos (CharSequence positiveButton ){ return setArg (POSITIVE_BUTTON_TEXT , positiveButton ); }
247247
248248 /**
249249 * Sets this dialogs positive button text
@@ -259,7 +259,7 @@ protected final Bundle getArgs(){
259259 * @param negativeButton the text as string
260260 * @return this instance
261261 */
262- public This neg (String negativeButton ){ return setArg (NEGATIVE_BUTTON_TEXT , negativeButton ); }
262+ public This neg (CharSequence negativeButton ){ return setArg (NEGATIVE_BUTTON_TEXT , negativeButton ); }
263263
264264 /**
265265 * Sets this dialogs negative button text
@@ -282,7 +282,7 @@ protected final Bundle getArgs(){
282282 * @param neutralButton the text as string
283283 * @return this instance
284284 */
285- public This neut (String neutralButton ){ return setArg (NEUTRAL_BUTTON_TEXT , neutralButton ); }
285+ public This neut (CharSequence neutralButton ){ return setArg (NEUTRAL_BUTTON_TEXT , neutralButton ); }
286286
287287 /**
288288 * Sets this dialogs neutral button text
@@ -514,30 +514,30 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
514514 context = dialog .getContext ();
515515
516516 dialog .setTitle (getTitle ());
517- String msg = getMessage ();
517+ CharSequence msg = getMessage ();
518518 if (msg != null ) {
519- if (getArgs ().getBoolean (HTML )) {
519+ if (getArgs ().getBoolean (HTML ) && msg instanceof String ) {
520520 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
521- dialog .setMessage (Html .fromHtml (msg , 0 ));
521+ dialog .setMessage (Html .fromHtml (( String ) msg , 0 ));
522522 } else {
523523 //noinspection deprecation
524- dialog .setMessage (Html .fromHtml (msg ));
524+ dialog .setMessage (Html .fromHtml (( String ) msg ));
525525 }
526526 } else {
527527 dialog .setMessage (msg );
528528 }
529529 }
530- String positiveButtonText = getArgString (POSITIVE_BUTTON_TEXT );
530+ CharSequence positiveButtonText = getArgString (POSITIVE_BUTTON_TEXT );
531531 if (positiveButtonText != null ) {
532532 dialog .setButton (DialogInterface .BUTTON_POSITIVE ,
533533 positiveButtonText , forwardOnClickListener );
534534 }
535- String negativeButtonText = getArgString (NEGATIVE_BUTTON_TEXT );
535+ CharSequence negativeButtonText = getArgString (NEGATIVE_BUTTON_TEXT );
536536 if (negativeButtonText != null ) {
537537 dialog .setButton (DialogInterface .BUTTON_NEGATIVE ,
538538 negativeButtonText , forwardOnClickListener );
539539 }
540- String neutralButtonText = getArgString (NEUTRAL_BUTTON_TEXT );
540+ CharSequence neutralButtonText = getArgString (NEUTRAL_BUTTON_TEXT );
541541 if (neutralButtonText != null ) {
542542 dialog .setButton (DialogInterface .BUTTON_NEUTRAL ,
543543 neutralButtonText , forwardOnClickListener );
0 commit comments