package com.swiftcleaner.chovey.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;

import androidx.appcompat.widget.AppCompatButton;
import androidx.cardview.widget.CardView;

import com.swiftcleaner.chovey.R;

public class CustomScoreDialog extends Dialog {

    private Context context;
    private OnDialogClickListener listener;
    public interface OnDialogClickListener {
        void onCancel();
        void onSubmit();
    }
    public CustomScoreDialog(Context context) {
        super(context, R.style.TransparentDialogTheme);
        this.context = context;
        setContentView(R.layout.dialog_function_exit_item);

        AppCompatButton dialog_cancel = findViewById(R.id.dialog_cancel);
        AppCompatButton dialog_ok = findViewById(R.id.dialog_ok);
        CardView cardView = findViewById(R.id.cardview);
        cardView.setCardBackgroundColor(Color.TRANSPARENT);

        dialog_cancel.setOnClickListener(v -> {
            if (listener != null) {
                listener.onCancel();
            }
            dismiss();
        });

        dialog_ok.setOnClickListener(v -> {
            if (listener != null) {
                listener.onSubmit();
            }
            dismiss();
        });

        setCanceledOnTouchOutside(false);
    }

    public void show() {
        super.show();
    }

    public void setOnDialogClickListener(OnDialogClickListener listener) {
        this.listener = listener;
    }
}