package com.atmob.voiceai.dialog;

import android.content.Context;
import android.view.Gravity;

import androidx.annotation.NonNull;

import com.atmob.app.lib.base.BaseDialog;
import com.atmob.voiceai.R;
import com.atmob.voiceai.databinding.DialogRecordingInstructionsBinding;


@BaseDialog.FullScreen(height = false, gravity = Gravity.BOTTOM)
public class RecordingInstructionsDialog extends BaseDialog<DialogRecordingInstructionsBinding> {

    boolean isCheck;

    private OnRecordingListener onRecordingListener;

    public RecordingInstructionsDialog(@NonNull Context context) {
        super(context, R.style.Theme_Common_BottomSheetDialog);
        setCheckBox();
        binding.setDoNotShowAgainClick(v -> {
            isCheck = !isCheck;
            setCheckBox();
        });
        binding.setOnCloseClick(v -> dismiss());
        binding.setKnowClick(v -> {
            if (onRecordingListener != null) {
                onRecordingListener.onKnowClick();
            }
            dismiss();
        });
    }

    public void setOnRecordingListener(OnRecordingListener onRecordingListener) {
        this.onRecordingListener = onRecordingListener;
    }

    private void setCheckBox() {
        if (isCheck) {
            binding.ivCheckbox.setImageResource(R.drawable.icon_checkbox_selected);
        } else {
            binding.ivCheckbox.setImageResource(R.drawable.icon_checkbox_no_select);
        }
    }

    public interface OnRecordingListener {
        void onKnowClick();
    }
}
