package com.daya.live_teaching.widget.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 LiveCommonDialog extends Dialog {

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

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

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(com.daya.live_teaching.R.layout.live_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);
        findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

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

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

    public void setConfirmBtnText(String text) {
        if (mBtnCommit != null) {
            mBtnCommit.setText(text);
        }
    }

    public void setCancelBtnText(String text) {
        if (mBtncancel != null) {
            mBtncancel.setText(text);
        }
    }

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

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