@ -43,21 +43,21 @@ import java.lang.ref.WeakReference;
* @createTime : 2020 / 9 / 27 14 : 50
* @createTime : 2020 / 9 / 27 14 : 50
* /
* /
public class WaitDialog extends BaseDialog {
public class WaitDialog extends BaseDialog {
public static int overrideEnterDuration = - 1 ;
public static int overrideEnterDuration = - 1 ;
public static int overrideExitDuration = - 1 ;
public static int overrideExitDuration = - 1 ;
public static int overrideEnterAnimRes = 0 ;
public static int overrideEnterAnimRes = 0 ;
public static int overrideExitAnimRes = 0 ;
public static int overrideExitAnimRes = 0 ;
public static BOOLEAN overrideCancelable ;
public static BOOLEAN overrideCancelable ;
protected OnBindView < WaitDialog > onBindView ;
protected OnBindView < WaitDialog > onBindView ;
public enum TYPE {
public enum TYPE {
NONE ,
NONE ,
SUCCESS ,
SUCCESS ,
WARNING ,
WARNING ,
ERROR
ERROR
}
}
protected static WeakReference < WaitDialog > me ;
protected static WeakReference < WaitDialog > me ;
protected CharSequence message ;
protected CharSequence message ;
protected long tipShowDuration = 1500 ;
protected long tipShowDuration = 1500 ;
@ -66,20 +66,20 @@ public class WaitDialog extends BaseDialog {
protected TextInfo messageTextInfo ;
protected TextInfo messageTextInfo ;
protected int maskColor = - 1 ;
protected int maskColor = - 1 ;
protected BOOLEAN privateCancelable ;
protected BOOLEAN privateCancelable ;
private DialogLifecycleCallback < WaitDialog > dialogLifecycleCallback ;
private DialogLifecycleCallback < WaitDialog > dialogLifecycleCallback ;
protected WaitDialog ( ) {
protected WaitDialog ( ) {
super ( ) ;
super ( ) ;
me = new WeakReference < > ( this ) ;
me = new WeakReference < > ( this ) ;
cancelable = DialogX . cancelableTipDialog ;
cancelable = DialogX . cancelableTipDialog ;
}
}
public static WaitDialog show ( CharSequence message ) {
public static WaitDialog show ( CharSequence message ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . message = message ;
me ( ) . message = message ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null ) {
dialogImpl . progressView . loading ( ) ;
dialogImpl . progressView . loading ( ) ;
setMessage ( message ) ;
setMessage ( message ) ;
return me ( ) ;
return me ( ) ;
@ -90,12 +90,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( Activity activity , CharSequence message ) {
public static WaitDialog show ( Activity activity , CharSequence message ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . message = message ;
me ( ) . message = message ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
dialogImpl . progressView . loading ( ) ;
dialogImpl . progressView . loading ( ) ;
setMessage ( message ) ;
setMessage ( message ) ;
return me ( ) ;
return me ( ) ;
@ -106,12 +106,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( int messageResId ) {
public static WaitDialog show ( int messageResId ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null ) {
dialogImpl . progressView . loading ( ) ;
dialogImpl . progressView . loading ( ) ;
setMessage ( messageResId ) ;
setMessage ( messageResId ) ;
return me ( ) ;
return me ( ) ;
@ -122,12 +122,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( Activity activity , int messageResId ) {
public static WaitDialog show ( Activity activity , int messageResId ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
dialogImpl . progressView . loading ( ) ;
dialogImpl . progressView . loading ( ) ;
setMessage ( messageResId ) ;
setMessage ( messageResId ) ;
return me ( ) ;
return me ( ) ;
@ -138,12 +138,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( CharSequence message , float progress ) {
public static WaitDialog show ( CharSequence message , float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
me ( ) . preMessage ( message ) ;
me ( ) . preMessage ( message ) ;
if ( dialogImpl ! = null ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null ) {
setMessage ( message ) ;
setMessage ( message ) ;
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
@ -155,12 +155,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( Activity activity , CharSequence message , float progress ) {
public static WaitDialog show ( Activity activity , CharSequence message , float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
me ( ) . preMessage ( message ) ;
me ( ) . preMessage ( message ) ;
if ( dialogImpl ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
setMessage ( message ) ;
setMessage ( message ) ;
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
@ -172,12 +172,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( int messageResId , float progress ) {
public static WaitDialog show ( int messageResId , float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . preMessage ( messageResId ) ;
if ( dialogImpl ! = null ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null ) {
setMessage ( messageResId ) ;
setMessage ( messageResId ) ;
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
@ -189,12 +189,12 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( Activity activity , int messageResId , float progress ) {
public static WaitDialog show ( Activity activity , int messageResId , float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . preMessage ( messageResId ) ;
if ( dialogImpl ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
setMessage ( messageResId ) ;
setMessage ( messageResId ) ;
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
@ -206,11 +206,11 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( Activity activity , float progress ) {
public static WaitDialog show ( Activity activity , float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null & & dialogImpl . bkg . getContext ( ) = = activity ) {
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
} else {
} else {
@ -220,11 +220,11 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public static WaitDialog show ( float progress ) {
public static WaitDialog show ( float progress ) {
DialogImpl dialogImpl = me ( ) . dialogImpl ;
DialogImpl dialogImpl = me ( ) . dialogImpl ;
me ( ) . showType = - 1 ;
me ( ) . showType = - 1 ;
if ( dialogImpl ! = null ) {
if ( dialogImpl ! = null & & dialogImpl . progressView ! = null ) {
me ( ) . setProgress ( progress ) ;
me ( ) . setProgress ( progress ) ;
return me ( ) ;
return me ( ) ;
} else {
} else {
@ -234,19 +234,19 @@ public class WaitDialog extends BaseDialog {
return waitDialog ;
return waitDialog ;
}
}
}
}
public float getProgress ( ) {
public float getProgress ( ) {
return waitProgress ;
return waitProgress ;
}
}
public WaitDialog setProgress ( float waitProgress ) {
public WaitDialog setProgress ( float waitProgress ) {
this . waitProgress = waitProgress ;
this . waitProgress = waitProgress ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
private View dialogView ;
private View dialogView ;
public WaitDialog show ( ) {
public WaitDialog show ( ) {
super . beforeShow ( ) ;
super . beforeShow ( ) ;
int layoutResId = R . layout . layout_dialogx_wait ;
int layoutResId = R . layout . layout_dialogx_wait ;
@ -264,7 +264,7 @@ public class WaitDialog extends BaseDialog {
} ) ;
} ) ;
return this ;
return this ;
}
}
public WaitDialog show ( final Activity activity ) {
public WaitDialog show ( final Activity activity ) {
super . beforeShow ( ) ;
super . beforeShow ( ) ;
int layoutResId = R . layout . layout_dialogx_wait ;
int layoutResId = R . layout . layout_dialogx_wait ;
@ -282,9 +282,9 @@ public class WaitDialog extends BaseDialog {
} ) ;
} ) ;
return this ;
return this ;
}
}
protected DialogImpl dialogImpl ;
protected DialogImpl dialogImpl ;
public class DialogImpl implements DialogConvertViewInterface {
public class DialogImpl implements DialogConvertViewInterface {
public DialogXBaseRelativeLayout boxRoot ;
public DialogXBaseRelativeLayout boxRoot ;
public MaxRelativeLayout bkg ;
public MaxRelativeLayout bkg ;
@ -293,14 +293,14 @@ public class WaitDialog extends BaseDialog {
public ProgressViewInterface progressView ;
public ProgressViewInterface progressView ;
public RelativeLayout boxCustomView ;
public RelativeLayout boxCustomView ;
public TextView txtInfo ;
public TextView txtInfo ;
private int layoutResId ;
private int layoutResId ;
public DialogImpl ( int layoutResId ) {
public DialogImpl ( int layoutResId ) {
this . layoutResId = layoutResId ;
this . layoutResId = layoutResId ;
}
}
public void lazyCreate ( ) {
public void lazyCreate ( ) {
dialogView = createView ( layoutResId ) ;
dialogView = createView ( layoutResId ) ;
boxRoot = dialogView . findViewById ( R . id . box_root ) ;
boxRoot = dialogView . findViewById ( R . id . box_root ) ;
bkg = dialogView . findViewById ( R . id . bkg ) ;
bkg = dialogView . findViewById ( R . id . bkg ) ;
@ -318,7 +318,7 @@ public class WaitDialog extends BaseDialog {
dialogImpl = this ;
dialogImpl = this ;
refreshView ( ) ;
refreshView ( ) ;
}
}
public DialogImpl ( View convertView ) {
public DialogImpl ( View convertView ) {
boxRoot = convertView . findViewById ( R . id . box_root ) ;
boxRoot = convertView . findViewById ( R . id . box_root ) ;
bkg = convertView . findViewById ( R . id . bkg ) ;
bkg = convertView . findViewById ( R . id . bkg ) ;
@ -336,18 +336,18 @@ public class WaitDialog extends BaseDialog {
dialogImpl = this ;
dialogImpl = this ;
refreshView ( ) ;
refreshView ( ) ;
}
}
public void init ( ) {
public void init ( ) {
if ( messageTextInfo = = null ) messageTextInfo = DialogX . tipTextInfo ;
if ( messageTextInfo = = null ) messageTextInfo = DialogX . tipTextInfo ;
if ( backgroundColor = = - 1 ) backgroundColor = DialogX . tipBackgroundColor ;
if ( backgroundColor = = - 1 ) backgroundColor = DialogX . tipBackgroundColor ;
if ( style . overrideWaitTipRes ( ) = = null ) {
if ( style . overrideWaitTipRes ( ) = = null ) {
blurView . setRadiusPx ( dip2px ( 15 ) ) ;
blurView . setRadiusPx ( dip2px ( 15 ) ) ;
} else {
} else {
blurView . setRadiusPx ( style . overrideWaitTipRes ( ) . overrideRadiusPx ( ) < 0 ? dip2px ( 15 ) : style . overrideWaitTipRes ( ) . overrideRadiusPx ( ) ) ;
blurView . setRadiusPx ( style . overrideWaitTipRes ( ) . overrideRadiusPx ( ) < 0 ? dip2px ( 15 ) : style . overrideWaitTipRes ( ) . overrideRadiusPx ( ) ) ;
}
}
boxRoot . setClickable ( true ) ;
boxRoot . setClickable ( true ) ;
boxRoot . setParentDialog ( me . get ( ) ) ;
boxRoot . setParentDialog ( me . get ( ) ) ;
boxRoot . setOnLifecycleCallBack ( new DialogXBaseRelativeLayout . OnLifecycleCallBack ( ) {
boxRoot . setOnLifecycleCallBack ( new DialogXBaseRelativeLayout . OnLifecycleCallBack ( ) {
@Override
@Override
@ -372,18 +372,18 @@ public class WaitDialog extends BaseDialog {
}
}
enterAnim . setDuration ( enterAnimDurationTemp ) ;
enterAnim . setDuration ( enterAnimDurationTemp ) ;
bkg . startAnimation ( enterAnim ) ;
bkg . startAnimation ( enterAnim ) ;
boxRoot . animate ( )
boxRoot . animate ( )
. setDuration ( enterAnimDurationTemp )
. setDuration ( enterAnimDurationTemp )
. alpha ( 1f )
. alpha ( 1f )
. setInterpolator ( new DecelerateInterpolator ( ) )
. setInterpolator ( new DecelerateInterpolator ( ) )
. setListener ( null ) ;
. setListener ( null ) ;
getDialogLifecycleCallback ( ) . onShow ( me ( ) ) ;
getDialogLifecycleCallback ( ) . onShow ( me ( ) ) ;
}
}
} ) ;
} ) ;
}
}
@Override
@Override
public void onDismiss ( ) {
public void onDismiss ( ) {
isShow = false ;
isShow = false ;
@ -392,7 +392,7 @@ public class WaitDialog extends BaseDialog {
me . clear ( ) ;
me . clear ( ) ;
}
}
} ) ;
} ) ;
if ( readyTipType ! = null ) {
if ( readyTipType ! = null ) {
progressView . noLoading ( ) ;
progressView . noLoading ( ) ;
( ( View ) progressView ) . postDelayed ( new Runnable ( ) {
( ( View ) progressView ) . postDelayed ( new Runnable ( ) {
@ -402,7 +402,7 @@ public class WaitDialog extends BaseDialog {
}
}
} , 100 ) ;
} , 100 ) ;
}
}
boxRoot . setOnBackPressedListener ( new OnBackPressedListener ( ) {
boxRoot . setOnBackPressedListener ( new OnBackPressedListener ( ) {
@Override
@Override
public boolean onBackPressed ( ) {
public boolean onBackPressed ( ) {
@ -417,9 +417,9 @@ public class WaitDialog extends BaseDialog {
}
}
} ) ;
} ) ;
}
}
private float oldProgress ;
private float oldProgress ;
public void refreshView ( ) {
public void refreshView ( ) {
if ( style . overrideWaitTipRes ( ) ! = null ) {
if ( style . overrideWaitTipRes ( ) ! = null ) {
int overrideBackgroundColorRes = style . overrideWaitTipRes ( ) . overrideBackgroundColorRes ( isLightTheme ( ) ) ;
int overrideBackgroundColorRes = style . overrideWaitTipRes ( ) . overrideBackgroundColorRes ( isLightTheme ( ) ) ;
@ -446,17 +446,17 @@ public class WaitDialog extends BaseDialog {
}
}
}
}
if ( DialogX . tipProgressColor ! = - 1 ) progressView . setColor ( DialogX . tipProgressColor ) ;
if ( DialogX . tipProgressColor ! = - 1 ) progressView . setColor ( DialogX . tipProgressColor ) ;
if ( waitProgress > = 0 & & waitProgress < = 1 & & oldProgress ! = waitProgress ) {
if ( waitProgress > = 0 & & waitProgress < = 1 & & oldProgress ! = waitProgress ) {
progressView . progress ( waitProgress ) ;
progressView . progress ( waitProgress ) ;
oldProgress = waitProgress ;
oldProgress = waitProgress ;
}
}
showText ( txtInfo , message ) ;
showText ( txtInfo , message ) ;
useTextInfo ( txtInfo , messageTextInfo ) ;
useTextInfo ( txtInfo , messageTextInfo ) ;
if ( maskColor ! = - 1 ) boxRoot . setBackgroundColor ( maskColor ) ;
if ( maskColor ! = - 1 ) boxRoot . setBackgroundColor ( maskColor ) ;
if ( onBindView ! = null & & onBindView . getCustomView ( ) ! = null ) {
if ( onBindView ! = null & & onBindView . getCustomView ( ) ! = null ) {
onBindView . bindParent ( boxCustomView , me . get ( ) ) ;
onBindView . bindParent ( boxCustomView , me . get ( ) ) ;
boxCustomView . setVisibility ( View . VISIBLE ) ;
boxCustomView . setVisibility ( View . VISIBLE ) ;
@ -466,13 +466,13 @@ public class WaitDialog extends BaseDialog {
boxProgress . setVisibility ( View . VISIBLE ) ;
boxProgress . setVisibility ( View . VISIBLE ) ;
}
}
}
}
public void doDismiss ( final View v ) {
public void doDismiss ( final View v ) {
boxRoot . post ( new Runnable ( ) {
boxRoot . post ( new Runnable ( ) {
@Override
@Override
public void run ( ) {
public void run ( ) {
if ( v ! = null ) v . setEnabled ( false ) ;
if ( v ! = null ) v . setEnabled ( false ) ;
int exitAnimResId = R . anim . anim_dialogx_default_exit ;
int exitAnimResId = R . anim . anim_dialogx_default_exit ;
if ( overrideExitAnimRes ! = 0 ) {
if ( overrideExitAnimRes ! = 0 ) {
exitAnimResId = overrideExitAnimRes ;
exitAnimResId = overrideExitAnimRes ;
@ -488,12 +488,12 @@ public class WaitDialog extends BaseDialog {
exitAnim . setDuration ( exitAnimDurationTemp ) ;
exitAnim . setDuration ( exitAnimDurationTemp ) ;
exitAnim . setInterpolator ( new AccelerateInterpolator ( ) ) ;
exitAnim . setInterpolator ( new AccelerateInterpolator ( ) ) ;
bkg . startAnimation ( exitAnim ) ;
bkg . startAnimation ( exitAnim ) ;
boxRoot . animate ( )
boxRoot . animate ( )
. alpha ( 0f )
. alpha ( 0f )
. setInterpolator ( new AccelerateInterpolator ( ) )
. setInterpolator ( new AccelerateInterpolator ( ) )
. setDuration ( exitAnimDurationTemp ) ;
. setDuration ( exitAnimDurationTemp ) ;
new Handler ( Looper . getMainLooper ( ) ) . postDelayed ( new Runnable ( ) {
new Handler ( Looper . getMainLooper ( ) ) . postDelayed ( new Runnable ( ) {
@Override
@Override
public void run ( ) {
public void run ( ) {
@ -503,7 +503,7 @@ public class WaitDialog extends BaseDialog {
}
}
} ) ;
} ) ;
}
}
public void showTip ( final TYPE tip ) {
public void showTip ( final TYPE tip ) {
runOnMain ( new Runnable ( ) {
runOnMain ( new Runnable ( ) {
@Override
@Override
@ -524,7 +524,7 @@ public class WaitDialog extends BaseDialog {
progressView . error ( ) ;
progressView . error ( ) ;
break ;
break ;
}
}
//此事件是在完成衔接动画绘制后执行的逻辑
//此事件是在完成衔接动画绘制后执行的逻辑
progressView . whenShowTick ( new Runnable ( ) {
progressView . whenShowTick ( new Runnable ( ) {
@Override
@Override
@ -545,12 +545,12 @@ public class WaitDialog extends BaseDialog {
} ) ;
} ) ;
}
}
}
}
@Override
@Override
public String dialogKey ( ) {
public String dialogKey ( ) {
return getClass ( ) . getSimpleName ( ) + "(" + Integer . toHexString ( hashCode ( ) ) + ")" ;
return getClass ( ) . getSimpleName ( ) + "(" + Integer . toHexString ( hashCode ( ) ) + ")" ;
}
}
@Override
@Override
public boolean isLightTheme ( ) {
public boolean isLightTheme ( ) {
if ( DialogX . tipTheme = = null ) {
if ( DialogX . tipTheme = = null ) {
@ -559,7 +559,7 @@ public class WaitDialog extends BaseDialog {
return DialogX . tipTheme = = DialogX . THEME . LIGHT ;
return DialogX . tipTheme = = DialogX . THEME . LIGHT ;
}
}
}
}
public void refreshUI ( ) {
public void refreshUI ( ) {
runOnMain ( new Runnable ( ) {
runOnMain ( new Runnable ( ) {
@Override
@Override
@ -568,67 +568,67 @@ public class WaitDialog extends BaseDialog {
}
}
} ) ;
} ) ;
}
}
public void doDismiss ( ) {
public void doDismiss ( ) {
if ( dialogImpl = = null ) return ;
if ( dialogImpl = = null ) return ;
dialogImpl . doDismiss ( null ) ;
dialogImpl . doDismiss ( null ) ;
}
}
public static void dismiss ( ) {
public static void dismiss ( ) {
me ( ) . doDismiss ( ) ;
me ( ) . doDismiss ( ) ;
}
}
protected static WaitDialog me ( ) {
protected static WaitDialog me ( ) {
if ( me = = null | | me . get ( ) = = null ) me = new WeakReference < > ( new WaitDialog ( ) ) ;
if ( me = = null | | me . get ( ) = = null ) me = new WeakReference < > ( new WaitDialog ( ) ) ;
return me . get ( ) ;
return me . get ( ) ;
}
}
protected TYPE readyTipType ;
protected TYPE readyTipType ;
protected void showTip ( CharSequence message , TYPE type ) {
protected void showTip ( CharSequence message , TYPE type ) {
showType = type . ordinal ( ) ;
showType = type . ordinal ( ) ;
this . message = message ;
this . message = message ;
readyTipType = type ;
readyTipType = type ;
show ( ) ;
show ( ) ;
}
}
protected void showTip ( Activity activity , CharSequence message , TYPE type ) {
protected void showTip ( Activity activity , CharSequence message , TYPE type ) {
showType = type . ordinal ( ) ;
showType = type . ordinal ( ) ;
this . message = message ;
this . message = message ;
readyTipType = type ;
readyTipType = type ;
show ( activity ) ;
show ( activity ) ;
}
}
protected void showTip ( int messageResId , TYPE type ) {
protected void showTip ( int messageResId , TYPE type ) {
showType = type . ordinal ( ) ;
showType = type . ordinal ( ) ;
this . message = getString ( messageResId ) ;
this . message = getString ( messageResId ) ;
readyTipType = type ;
readyTipType = type ;
show ( ) ;
show ( ) ;
}
}
protected void showTip ( Activity activity , int messageResId , TYPE type ) {
protected void showTip ( Activity activity , int messageResId , TYPE type ) {
showType = type . ordinal ( ) ;
showType = type . ordinal ( ) ;
this . message = getString ( messageResId ) ;
this . message = getString ( messageResId ) ;
readyTipType = type ;
readyTipType = type ;
show ( activity ) ;
show ( activity ) ;
}
}
public static CharSequence getMessage ( ) {
public static CharSequence getMessage ( ) {
return me ( ) . message ;
return me ( ) . message ;
}
}
public static WaitDialog setMessage ( CharSequence message ) {
public static WaitDialog setMessage ( CharSequence message ) {
me ( ) . preMessage ( message ) ;
me ( ) . preMessage ( message ) ;
me ( ) . refreshUI ( ) ;
me ( ) . refreshUI ( ) ;
return me ( ) ;
return me ( ) ;
}
}
public static WaitDialog setMessage ( int messageResId ) {
public static WaitDialog setMessage ( int messageResId ) {
me ( ) . preMessage ( messageResId ) ;
me ( ) . preMessage ( messageResId ) ;
me ( ) . refreshUI ( ) ;
me ( ) . refreshUI ( ) ;
return me ( ) ;
return me ( ) ;
}
}
public boolean isCancelable ( ) {
public boolean isCancelable ( ) {
if ( privateCancelable ! = null ) {
if ( privateCancelable ! = null ) {
return privateCancelable = = BOOLEAN . TRUE ;
return privateCancelable = = BOOLEAN . TRUE ;
@ -638,12 +638,12 @@ public class WaitDialog extends BaseDialog {
}
}
return cancelable ;
return cancelable ;
}
}
public WaitDialog setCancelable ( boolean cancelable ) {
public WaitDialog setCancelable ( boolean cancelable ) {
privateCancelable = cancelable ? BOOLEAN . TRUE : BOOLEAN . FALSE ;
privateCancelable = cancelable ? BOOLEAN . TRUE : BOOLEAN . FALSE ;
return this ;
return this ;
}
}
/ * *
/ * *
* 用于从 WaitDialog 到 TipDialog 的消息设置
* 用于从 WaitDialog 到 TipDialog 的消息设置
* 此方法不会立即执行 , 而是等到动画衔接完成后由事件设置
* 此方法不会立即执行 , 而是等到动画衔接完成后由事件设置
@ -655,95 +655,95 @@ public class WaitDialog extends BaseDialog {
me ( ) . message = message ;
me ( ) . message = message ;
return me ( ) ;
return me ( ) ;
}
}
protected WaitDialog preMessage ( int messageResId ) {
protected WaitDialog preMessage ( int messageResId ) {
me ( ) . message = getString ( messageResId ) ;
me ( ) . message = getString ( messageResId ) ;
return me ( ) ;
return me ( ) ;
}
}
public DialogLifecycleCallback < WaitDialog > getDialogLifecycleCallback ( ) {
public DialogLifecycleCallback < WaitDialog > getDialogLifecycleCallback ( ) {
return dialogLifecycleCallback = = null ? new DialogLifecycleCallback < WaitDialog > ( ) {
return dialogLifecycleCallback = = null ? new DialogLifecycleCallback < WaitDialog > ( ) {
} : dialogLifecycleCallback ;
} : dialogLifecycleCallback ;
}
}
public WaitDialog setDialogLifecycleCallback ( DialogLifecycleCallback < WaitDialog > dialogLifecycleCallback ) {
public WaitDialog setDialogLifecycleCallback ( DialogLifecycleCallback < WaitDialog > dialogLifecycleCallback ) {
this . dialogLifecycleCallback = dialogLifecycleCallback ;
this . dialogLifecycleCallback = dialogLifecycleCallback ;
if ( isShow ) dialogLifecycleCallback . onShow ( me . get ( ) ) ;
if ( isShow ) dialogLifecycleCallback . onShow ( me . get ( ) ) ;
return this ;
return this ;
}
}
public DialogImpl getDialogImpl ( ) {
public DialogImpl getDialogImpl ( ) {
return dialogImpl ;
return dialogImpl ;
}
}
public WaitDialog setCustomView ( OnBindView < WaitDialog > onBindView ) {
public WaitDialog setCustomView ( OnBindView < WaitDialog > onBindView ) {
this . onBindView = onBindView ;
this . onBindView = onBindView ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public View getCustomView ( ) {
public View getCustomView ( ) {
if ( onBindView = = null ) return null ;
if ( onBindView = = null ) return null ;
return onBindView . getCustomView ( ) ;
return onBindView . getCustomView ( ) ;
}
}
public WaitDialog removeCustomView ( ) {
public WaitDialog removeCustomView ( ) {
this . onBindView . clean ( ) ;
this . onBindView . clean ( ) ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public OnBackPressedListener getOnBackPressedListener ( ) {
public OnBackPressedListener getOnBackPressedListener ( ) {
return onBackPressedListener ;
return onBackPressedListener ;
}
}
public WaitDialog setOnBackPressedListener ( OnBackPressedListener onBackPressedListener ) {
public WaitDialog setOnBackPressedListener ( OnBackPressedListener onBackPressedListener ) {
this . onBackPressedListener = onBackPressedListener ;
this . onBackPressedListener = onBackPressedListener ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public int getBackgroundColor ( ) {
public int getBackgroundColor ( ) {
return backgroundColor ;
return backgroundColor ;
}
}
public WaitDialog setBackgroundColor ( @ColorInt int backgroundColor ) {
public WaitDialog setBackgroundColor ( @ColorInt int backgroundColor ) {
this . backgroundColor = backgroundColor ;
this . backgroundColor = backgroundColor ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public WaitDialog setBackgroundColorRes ( @ColorRes int backgroundColorResId ) {
public WaitDialog setBackgroundColorRes ( @ColorRes int backgroundColorResId ) {
this . backgroundColor = getColor ( backgroundColorResId ) ;
this . backgroundColor = getColor ( backgroundColorResId ) ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public WaitDialog setMaskColor ( @ColorInt int maskColor ) {
public WaitDialog setMaskColor ( @ColorInt int maskColor ) {
this . maskColor = maskColor ;
this . maskColor = maskColor ;
refreshUI ( ) ;
refreshUI ( ) ;
return this ;
return this ;
}
}
public WaitDialog setEnterAnimDuration ( long enterAnimDuration ) {
public WaitDialog setEnterAnimDuration ( long enterAnimDuration ) {
this . enterAnimDuration = enterAnimDuration ;
this . enterAnimDuration = enterAnimDuration ;
return this ;
return this ;
}
}
public long getExitAnimDuration ( ) {
public long getExitAnimDuration ( ) {
return exitAnimDuration ;
return exitAnimDuration ;
}
}
public WaitDialog setExitAnimDuration ( long exitAnimDuration ) {
public WaitDialog setExitAnimDuration ( long exitAnimDuration ) {
this . exitAnimDuration = exitAnimDuration ;
this . exitAnimDuration = exitAnimDuration ;
return this ;
return this ;
}
}
@Override
@Override
public void onUIModeChange ( Configuration newConfig ) {
public void onUIModeChange ( Configuration newConfig ) {
refreshUI ( ) ;
refreshUI ( ) ;
}
}
public static WaitDialog getInstance ( ) {
public static WaitDialog getInstance ( ) {
return me ( ) ;
return me ( ) ;
}
}