package com.zhilin.patrol.views;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.zhilin.patrol.R;


/**
 * 加载框
 */
public class CustomProgressDialog extends Dialog {
    private Context context;
    private View layout;
    TextView loading_txt;

    public CustomProgressDialog(Context context) {
        super(context, R.style.CustomeDialogStyle);
        this.setCancelable(false);//点击屏幕不消失
        this.context = context;
        initView();
    }

    private void initView() {
        layout = View.inflate(context, R.layout.dialog_progress_custom, null);
        loading_txt = (TextView) layout.findViewById(R.id.loading_txt);
    }

    public void setText(String msg) {
        loading_txt.setText(msg);
    }

    public void showDialog(String msg) {
        loading_txt.setText(msg);
        this.setContentView(layout);
        this.setCanceledOnTouchOutside(false);//点击屏幕不消失
        this.show();
    }
}
