package com.ucarhu.demo;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.ucarhu.demo.UCarAlertUtil;
import com.ucarhu.demo.widget.UCarAlertView;

public class UCarAlertUtil {

    public interface OnClickListener {
        boolean onClick();
    }

    public static UCarAlertView makeDialog(Activity activity, int i, int i2, String str, CharSequence charSequence, String str2, String str3, OnClickListener onClickListener, OnClickListener onClickListener2) {
        UCarAlertView uCarAlertView = new UCarAlertView(activity);
        View inflate = LayoutInflater.from(activity).inflate(i, (ViewGroup) null, false);
        TextView textView = (TextView) inflate.findViewById(R.id.tv_dialog_icon_title);
        if (i2 != 0) {
            textView.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, ContextCompat.getDrawable(activity, i2), (Drawable) null, (Drawable) null);
        }
        textView.setText(str);
        if (i2 == 0 && TextUtils.isEmpty(str)) {
            textView.setVisibility(8);
        }
        ((TextView) inflate.findViewById(R.id.tv_dialog_message)).setText(charSequence);
        TextView textView2 = (TextView) inflate.findViewById(R.id.tv_dialog_done);
        textView2.setText(str2);
        textView2.setOnClickListener(new View.OnClickListener(uCarAlertView) {
            /* class com.ucarhu.demo.$$Lambda$UCarAlertUtil$NG9tj9wjaFyb32J_GPGhU9fd4CY */
            public final /* synthetic */ UCarAlertView f$1;

            {
                this.f$1 = r2;
            }

            public final void onClick(View view) {
                UCarAlertUtil.lambda$makeDialog$17(UCarAlertUtil.OnClickListener.this, this.f$1, view);
            }
        });
        TextView textView3 = (TextView) inflate.findViewById(R.id.tv_dialog_cancel);
        textView3.setText(str3);
        textView3.setOnClickListener(new View.OnClickListener(uCarAlertView) {
            /* class com.ucarhu.demo.$$Lambda$UCarAlertUtil$smBwxzIafp7bkwMNJU8Oswu2Ao */
            public final /* synthetic */ UCarAlertView f$1;

            {
                this.f$1 = r2;
            }

            public final void onClick(View view) {
                UCarAlertUtil.lambda$makeDialog$18(UCarAlertUtil.OnClickListener.this, this.f$1, view);
            }
        });
        uCarAlertView.setContentView(inflate);
        return uCarAlertView;
    }

    static /* synthetic */ void lambda$makeDialog$17(OnClickListener onClickListener, UCarAlertView uCarAlertView, View view) {
        if (onClickListener == null || !onClickListener.onClick()) {
            uCarAlertView.dismiss();
        }
    }

    static /* synthetic */ void lambda$makeDialog$18(OnClickListener onClickListener, UCarAlertView uCarAlertView, View view) {
        if (onClickListener == null || !onClickListener.onClick()) {
            uCarAlertView.dismiss();
        }
    }
}
