package com.zxhl.cms.widget;

import android.app.Activity;
import android.app.Dialog;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.zxhl.cms.R;
import com.zxhl.cms.net.model.chat.ChatMessageChargeOrNotEntity;

public class MemberDialogUtils {
    /**
     * 会员弹窗提示
     *
     * @param context
     * @return
     */
    public static Dialog showMemberChargeTip(Activity context, ChatMessageChargeOrNotEntity result, String content, String tipContent, ChatDialogUtils.ChatDialogCallBackParams callBackParams) {
        if (context == null) {
            return null;
        }
        Dialog mDialog = new Dialog(context, R.style.CenterCompatDialogTheme);
        View mDialogView =
                CenterDialog.INSTANCE.showBottomDialog(
                        R.layout.chat_dialog_layout_member_tip,
                        context,
                        mDialog,
                        0,
                        Gravity.CENTER
                );
        mDialogView.findViewById(R.id.id_img_close).setOnClickListener(v -> {
            callBackParams.cancel();
            mDialog.dismiss();
        });
        ((TextView) mDialogView.findViewById(R.id.dialog_tip_content_tv)).setText(content);
        TextView chatDuiHuanTV = mDialogView.findViewById(R.id.chat_duihuan_tv);
        chatDuiHuanTV.setText(result.charge + tipContent);
        chatDuiHuanTV.setOnClickListener(v -> {
            callBackParams.confirm(0);
            mDialog.dismiss();
        });
        mDialogView.findViewById(R.id.chat_goto_charge_vip_tv).setOnClickListener(v -> {
            callBackParams.confirm(1);
            mDialog.dismiss();
        });
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setCancelable(false);
        mDialog.show();
        return mDialog;
    }
}
