package com.atmob.voiceai.dialog;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.StringRes;

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

@BaseDialog.FullScreen(height = false)
public class CommonLoadingDialog extends BaseDialog<DialogCommonLoadingBinding> {

    public CommonLoadingDialog(@NonNull Context context) {
        super(context, R.style.Theme_Common_Dialog);
        setCancelable(false);
    }

    public CommonLoadingDialog setMessage(@StringRes int message) {
        binding.commonLoadingText.setText(message);
        return this;
    }

    public CommonLoadingDialog setMessage(String message) {
        if (TextUtils.isEmpty(message)) {
            binding.commonLoadingText.setVisibility(View.GONE);
        } else {
            binding.commonLoadingText.setVisibility(View.VISIBLE);
            binding.commonLoadingText.setText(message);
        }
        return this;
    }

    @Override
    protected boolean useQueue() {
        return false;
    }
}