package com.bigdo.controls;
import com.bigdo.app.R;
import android.app.AlertDialog;
import android.content.Context;
import android.view.Gravity;
import android.widget.TextView;
public class XProgressDialog extends AlertDialog {
// private static XProgressDialog xProgressDialog = null;
public XProgressDialog(Context context) {
super(context);
}
public XProgressDialog(Context context, int theme) {
super(context, theme);
}
/**
*
* 这是消息内容
*
* @param message
* 消息
* @return
*
*/
public XProgressDialog setMessage(String message) {
TextView tvMsg = (TextView) this
.findViewById(R.id.activity_progress_box_msg);
if (tvMsg != null) {
tvMsg.setText(message);
}
return this;
}
public static XProgressDialog show(Context context, String message) {
XProgressDialog xProgressDialog = new XProgressDialog(context,
R.style.XProgressDialog);
xProgressDialog.show();
xProgressDialog.setContentView(R.layout.xprogress_dialog_activity);
xProgressDialog.getWindow().setGravity(Gravity.CENTER);
// xProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
TextView tvMsg = (TextView) xProgressDialog
.findViewById(R.id.activity_progress_box_msg);
if (tvMsg != null) {
tvMsg.setText(message);
}
xProgressDialog.setCanceledOnTouchOutside(false);
return xProgressDialog;
}
public static XProgressDialog show(Context context, String message,
int gravity) {
XProgressDialog xProgressDialog = new XProgressDialog(context,
R.style.XProgressDialog);
xProgressDialog.show();
xProgressDialog.setContentView(R.layout.xprogress_dialog_activity);
xProgressDialog.getWindow().setGravity(gravity);
// xProgressDialog.getWindow().getAttributes().gravity = gravity;
TextView tvMsg = (TextView) xProgressDialog
.findViewById(R.id.activity_progress_box_msg);
if (tvMsg != null) {
tvMsg.setText(message);
}
xProgressDialog.setCanceledOnTouchOutside(false);
return xProgressDialog;
}
/**
* 显示并这是消息内容
*
* @param message
* 消息
* @return
*/
public XProgressDialog show(String message) {
TextView tvMsg = (TextView) this
.findViewById(R.id.activity_progress_box_msg);
if (tvMsg != null) {
tvMsg.setText(message);
}
this.show();
return this;
}
}