package com.cooleshow.base.widgets.dialog;

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

import com.cooleshow.base.R;

import androidx.annotation.NonNull;

/**
 * Author by pq, Date on 2022/5/6.
 */
public class CommonDialog extends Dialog {

    private TextView mTvTitle;
    private TextView mTvContent;
    private TextView mBtncancel;
    private TextView mBtnCommit;

    public CommonDialog(@NonNull Context context) {
        super(context, R.style.DialogStyle);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.common_popu);
        mTvTitle = findViewById(R.id.tv_title);
        mTvContent = findViewById(R.id.tv_content);
        mBtncancel = findViewById(R.id.btn_cancel);
        mBtnCommit = findViewById(R.id.btn_commit);
    }

    public void setTitle(String title) {
        if (mTvTitle != null) {
            mTvTitle.setText(title);
        }
    }

    public void setContent(String content) {
        if (mTvContent != null) {
            mTvContent.setText(content);
        }
    }

    public void setOnConfirmClickListener(View.OnClickListener onConfirmClickListener) {
        if (mBtnCommit != null) {
            mBtnCommit.setOnClickListener(onConfirmClickListener);
        }
    }

    public void setOnCancelClickListener(View.OnClickListener onCancelClickListener) {
        if (mBtncancel != null) {
            mBtncancel.setOnClickListener(onCancelClickListener);
        }
    }
}
