package com.datarecovery.master.dialog;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;

import com.atmob.app.lib.base.BaseDialog;
import com.datarecovery.master.R;
import com.datarecovery.master.databinding.DialogScanFileBinding;


@BaseDialog.FullScreen(height = false)
public class ScanFileDialog extends BaseDialog<DialogScanFileBinding> {

    private final LiveData<String> detectedLastFileName;

    private OnCancelListener onCancelListener;

    public ScanFileDialog(@NonNull Context context, LiveData<String> detectedLastFileName) {
        super(context, R.style.Theme_Common_Dialog);
        this.detectedLastFileName = detectedLastFileName;
        setCancelable(false);
        binding.setCancelClick(v -> {
            if (onCancelListener != null) {
                onCancelListener.onCancel();
            }
            dismiss();
        });
        binding.setDetectedFileName(detectedLastFileName);
    }

    public void setOnCancelListener(OnCancelListener onCancelListener) {
        this.onCancelListener = onCancelListener;
    }


    public interface OnCancelListener {
        void onCancel();
    }
}
