package com.cooleshow.base.utils.helper;

import android.app.Activity;
import android.widget.TextView;

import com.cooleshow.base.utils.PermissionUtils;
import com.cooleshow.base.widgets.DialogUtil;

import androidx.fragment.app.FragmentActivity;

/**
 * Author by pq, Date on 2022/6/28.
 */
public class DialogHelper {
    public static void showTipDialog(FragmentActivity context, String content) {
        DialogUtil.showInCenter(context.getSupportFragmentManager(), com.cooleshow.base.R.layout.common_popu, (holder, dialog) -> {
            TextView tvTitle = holder.getView(com.cooleshow.base.R.id.tv_title);
            TextView tvContent = holder.getView(com.cooleshow.base.R.id.tv_content);
            TextView btncancel = holder.getView(com.cooleshow.base.R.id.btn_cancel);
            TextView btnCommit = holder.getView(com.cooleshow.base.R.id.btn_commit);
            tvTitle.setText("提示");
            tvContent.setText(content);
            btncancel.setOnClickListener(view1 -> {
                dialog.dismiss();
            });
            btnCommit.setOnClickListener(view1 -> {
                PermissionUtils.toSelfSetting(context);
                dialog.dismiss();
            });
        });
    }
}
