package com.sunzee.ui.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.sunzee.R;

/**
 * @author whw
 * @time 2019/3/13
 * @Description 普通样式弹框
 */
public class WifiDetailDialog extends Dialog implements View.OnClickListener {

    public static final int OK = 2;
    public static final int NO = 3;
    private final Context mContext;
    private Button mBtnConfirm;
    private Button mBtnCancel;
    private TextView mTvTitle;
    private TextView mTvContent;

    public void setListener(WifiDialog.DialogClickListener2 listener) {
        this.listener = listener;
    }

    private WifiDialog.DialogClickListener2 listener;


    public WifiDetailDialog(@NonNull Context context) {
        super(context, R.style.DialogBgD);//加载样式
        mContext = context;
        setContentView(R.layout.dialog_normal);
        initView();
        initEvent();
    }

    private void initEvent() {
        mBtnCancel.setOnClickListener(this);
        mBtnConfirm.setOnClickListener(this);
    }

    protected void initView() {
        mBtnConfirm = findViewById(R.id.btn_confirm);
        mBtnCancel = findViewById(R.id.btn_cancel);
        mTvTitle = findViewById(R.id.tv_title);
        mTvContent = findViewById(R.id.tv_content);
    }


    public void setTitle(String title) {
        mTvTitle.setText(title);
    }

    public void setContent(String content) {
        mTvContent.setText(content);
    }

    public void setBtnText(String titile) {
        mBtnConfirm.setText(titile);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.btn_cancel:
                dismiss();
                break;
        }
        listener.onClickListener(v.getId());

    }


    public interface DialogClickListener {

        void onClickListener(int type);

    }
}
