package cn.dankal.basiclib.widget.dialog;

import android.content.Context;
import androidx.annotation.ColorInt;
import androidx.annotation.IdRes;
import androidx.annotation.StringRes;
import android.view.View;


public abstract class BaseDialog {
    public Context context;

    public CustomDialog dialog;
    public BaseDialog(Context context) {
        this.context = context;
        initDialog();
    }


    public abstract void initDialog();


    public void show(){
        if (!dialog.isShowing()){
            dialog.show();
        }
    }

    public void dismiss(){
        if (dialog.isShowing()){
            dialog.dismiss();
        }
    }


    public void setText(@IdRes int viewId, @StringRes int str){
        dialog.setText(viewId, str);
    }

    public void setText(@IdRes int viewId,CharSequence str){
        dialog.setText(viewId, str);
    }


    public void setTextColor(@IdRes int viewId, @ColorInt int color){
        dialog.setTextColor(viewId, color);
    }
    public void setTextSize(@IdRes int viewId, int size){
        dialog.setTextSize(viewId, size);
    }


    public void setViewClick(@IdRes int viewId, View.OnClickListener clickListener){
        dialog.addViewOnclick(viewId, clickListener);
    }


}
