public MyProgressDialogUtils(String message, Context mContext) { super(); this.mContext = mContext; mProgressDialog = new MyProgressDialog(mContext, R.style.MyProgressDialog); mProgressDialog.setMessage(message); mProgressDialog.setCancelable(false); mProgressDialog.setOnCancelListener(this); }
// 设置用户是否可以取消对话框 public void setProgressDialogCancelable() { mProgressDialog.setCancelable(true); mProgressDialog.setOnCancelListener( new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { if (mProgressDialogCanceledListener != null) { mProgressDialogCanceledListener.canceled(); } } }); }
public MyProgressDialogUtils(int message, Context mContext) { super(); this.message = message; this.mContext = mContext; // <modify by Yongfeng.zhang 2014.11.12 // mProgressDialog=new ProgressDialog(mContext); mProgressDialog = new MyProgressDialog(mContext, R.style.MyProgressDialog); // >end by Yongfeng.zhang 2014.11.12 mProgressDialog.setMessage(mContext.getString(message)); mProgressDialog.setCancelable(false); // mProgressDialog.setCanceledOnTouchOutside(true); mProgressDialog.setOnCancelListener(this); }
// 使对话框消失 public void dismissDialog() { if (mProgressDialog != null) { mProgressDialog.dismiss(); } }
// 显示对话框 public void showDialog() { mProgressDialog.show(); }