77import android .os .Bundle ;
88
99import android .text .Html ;
10+ import android .text .util .Linkify ;
1011import android .util .TypedValue ;
1112
1213import android .view .View ;
@@ -44,6 +45,7 @@ public class KAlertDialog extends AlertDialog implements View.OnClickListener {
4445
4546 private boolean mShowCancel , mShowContent , mShowTitleText , mCloseFromCancel , mShowConfirm ;
4647 private int contentTextSize = 0 ;
48+ private int titleTextSize = 0 ;
4749
4850 private FrameLayout mErrorFrame , mSuccessFrame , mProgressFrame , mWarningFrame ;
4951
@@ -195,7 +197,7 @@ private void changeAlertType(int alertType, boolean fromCreate) {
195197 setConfirmButtonColor (mColor );
196198 break ;
197199 case CUSTOM_IMAGE_TYPE :
198- setCustomImage (mCustomImgDrawable );
200+ setCustomImage1 (mCustomImgDrawable );
199201 setConfirmButtonColor (mColor );
200202 break ;
201203 case PROGRESS_TYPE :
@@ -223,6 +225,9 @@ public KAlertDialog setTitleText(String text) {
223225 mTitleText = text ;
224226 if (mTitleTextView != null && mTitleText != null ) {
225227 showTitleText ();
228+ if (titleTextSize != 0 ) {
229+ mTitleTextView .setTextSize (TypedValue .COMPLEX_UNIT_PX , spToPx (titleTextSize , getContext ()));
230+ }
226231 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
227232 mTitleTextView .setText (Html .fromHtml (mTitleText ,1 ));
228233 }else {
@@ -236,18 +241,19 @@ private void showTitleText() {
236241 mShowTitleText = true ;
237242 if (mTitleTextView != null ) {
238243 mTitleTextView .setVisibility (View .VISIBLE );
244+ mContentTextView .setAutoLinkMask (Linkify .ALL );
239245 }
240246 }
241247
242248 public KAlertDialog setCustomImage (int resourceId , Context context ) {
243249 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
244- return setCustomImage (getContext ().getResources ().getDrawable (resourceId ,context .getTheme ()));
250+ return setCustomImage1 (getContext ().getResources ().getDrawable (resourceId ,context .getTheme ()));
245251 } else {
246- return setCustomImage (getContext ().getResources ().getDrawable (resourceId ));
252+ return setCustomImage1 (getContext ().getResources ().getDrawable (resourceId ));
247253 }
248254 }
249255
250- public KAlertDialog setCustomImage (Drawable drawable ) {
256+ private KAlertDialog setCustomImage1 (Drawable drawable ) {
251257 mCustomImgDrawable = drawable ;
252258 if (mCustomImage != null && mCustomImgDrawable != null ) {
253259 mCustomImage .setVisibility (View .VISIBLE );
@@ -264,7 +270,7 @@ public KAlertDialog setContentText(String text) {
264270 mContentTextView .setTextSize (TypedValue .COMPLEX_UNIT_PX , spToPx (contentTextSize , getContext ()));
265271 }
266272 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
267- mContentTextView .setText (Html .fromHtml (mContentText ,1 ));
273+ mContentTextView .setText (Html .fromHtml (mContentText ,0 ));
268274 }else {
269275 mContentTextView .setText (Html .fromHtml (mContentText ));
270276 }
@@ -293,6 +299,7 @@ private void showContentText () {
293299 mShowContent = true ;
294300 if (mContentTextView != null ) {
295301 mContentTextView .setVisibility (View .VISIBLE );
302+ mContentTextView .setAutoLinkMask (Linkify .ALL );
296303 }
297304 }
298305
@@ -424,6 +431,15 @@ public KAlertDialog cancelButtonColor (int color, Context context){
424431 }
425432 }
426433
434+ public KAlertDialog setTitleTextSize (int value ){
435+ this .titleTextSize = value ;
436+ return this ;
437+ }
438+
439+ public int getTitleTextSize () {
440+ return titleTextSize ;
441+ }
442+
427443 public KAlertDialog setContentTextSize ( int value ){
428444 this .contentTextSize = value ;
429445 return this ;
0 commit comments