package com.cooleshow.base.widgets.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;

import com.cooleshow.base.R;

import androidx.annotation.NonNull;

/**
 * Author by pq, Date on 2022/7/19.
 */
public class PrivacyTipDialog extends Dialog {

    private TextView mTvContent;
    private TextView mCancel;
    private TextView mBtnCommit;

    public PrivacyTipDialog(@NonNull Context context) {
        super(context, R.style.DialogStyle);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_privacy_agreement_layout);
        setCanceledOnTouchOutside(false);
        setCancelable(false);
        mTvContent = findViewById(R.id.tv_content);
        mCancel = findViewById(R.id.btn_cancel);
        mBtnCommit = findViewById(R.id.btn_commit);
        mTvContent.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public void setContent(CharSequence content) {
        if (mTvContent != null) {
            mTvContent.setText(content);
        }
    }

    public void setOnCancelClickListener(View.OnClickListener onCancelClickListener) {
        if (mCancel != null) {
            mCancel.setOnClickListener(onCancelClickListener);
        }
    }

    public void setOnConfirmClickListener(View.OnClickListener onConfirmClickListener) {
        if (mBtnCommit != null) {
            mBtnCommit.setOnClickListener(onConfirmClickListener);
        }
    }
}
