private static void dismissDialog() { animation.cancel(); if (dialog != null) { if (dialog.isShowing()) { dialog.dismiss(); } dialog.cannelTimeOut(); dialog = null; return; } }
private static WaitDialog showProgress(Context mContext, boolean show, ViewGroup layout) { if (show == false) { dismissDialog(); return null; } if (animation == null) { animation = new RotateAnimation( 0f, 359f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(500); animation.setRepeatCount(RotateAnimation.INFINITE); animation.setRepeatMode(RotateAnimation.RESTART); LinearInterpolator lin = new LinearInterpolator(); animation.setInterpolator(lin); } dialog = new WaitDialog(mContext, R.style.IpSettingDialog, animation); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(layout); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); if (!dialog.isShowing()) { ((View) layout.getTag()).startAnimation(animation); dialog.show(); } return dialog; }