package com.ubt.jimu.connect.view; import android.content.Context; import android.content.DialogInterface; import android.graphics.drawable.ColorDrawable; import android.text.TextUtils; import android.text.method.ScrollingMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.ubt.jimu.R; import com.ubtech.utils.DisplayUtil; import com.ubtech.view.dialog.BaseDialog; import com.ubtech.view.widget.UButton; /* loaded from: classes.dex */ public class ComponentInfoDialog extends BaseDialog implements View.OnClickListener { public CharSequence b; public String c; public String d; public boolean e; public int f; public int g; public int h; public DialogInterface.OnClickListener i; public DialogInterface.OnClickListener j; public View.OnClickListener k; private TextView l; private TextView m; private ImageView n; public UButton o; public UButton p; public UButton q; public UButton r; public ComponentInfoDialog(Context context) { super(context); this.e = false; this.f = 0; this.g = -1; this.h = -1; } public void a(View view, Builder builder) { this.l = (TextView) view.findViewById(R.id.tvDialogTitle); this.m = (TextView) view.findViewById(R.id.tvTips); this.n = (ImageView) view.findViewById(R.id.imgLogo); this.p = (UButton) view.findViewById(R.id.btn_gray_cancel); this.q = (UButton) view.findViewById(R.id.btn_blue_cancel); this.q.setOnClickListener(this); this.o = (UButton) view.findViewById(R.id.btn_ok); this.r = (UButton) view.findViewById(R.id.btn_gray_cancel); this.r.setOnClickListener(this); this.o.setOnClickListener(this); if (!TextUtils.isEmpty(this.b)) { this.m.setText(this.b); this.m.setMovementMethod(ScrollingMovementMethod.getInstance()); } this.m.setOnClickListener(this); if (this.j == null) { this.o.setVisibility(8); } if (!TextUtils.isEmpty(this.d)) { this.o.setText(this.d); } if (TextUtils.isEmpty(builder.b)) { this.l.setVisibility(8); } else { this.l.setVisibility(0); this.l.setText(builder.b); } if (TextUtils.isEmpty(builder.g)) { int i = builder.f; if (i != 0) { this.n.setImageResource(i); this.n.setVisibility(0); } else { this.n.setVisibility(8); } } else { Glide.e(getContext()).a(builder.g).a(this.n); this.n.setVisibility(0); if (this.h > 0 && this.g > 0) { ViewGroup.LayoutParams layoutParams = this.n.getLayoutParams(); layoutParams.height = this.h; layoutParams.width = this.g; this.n.setLayoutParams(layoutParams); } } int i2 = builder.j; if (17 != i2) { this.m.setGravity(i2); } if (this.e) { this.q.setVisibility(8); this.p.setVisibility(0); this.r = this.p; } else { this.q.setVisibility(0); this.p.setVisibility(8); this.r = this.q; } if (this.i == null) { this.p.setVisibility(8); this.q.setVisibility(8); } if (!TextUtils.isEmpty(this.c)) { this.r.setText(this.c); } this.m.setTextColor(this.f); } @Override // android.view.View.OnClickListener public void onClick(View view) { int id = view.getId(); if (id == R.id.btn_gray_cancel || id == R.id.btn_blue_cancel) { DialogInterface.OnClickListener onClickListener = this.i; if (onClickListener != null) { onClickListener.onClick(this, 0); return; } else { dismiss(); return; } } if (id == R.id.btn_ok) { DialogInterface.OnClickListener onClickListener2 = this.j; if (onClickListener2 != null) { onClickListener2.onClick(this, 0); return; } else { dismiss(); return; } } if (id != R.id.tvTips) { dismiss(); return; } View.OnClickListener onClickListener3 = this.k; if (onClickListener3 != null) { onClickListener3.onClick(this.m); } } public static class Builder { protected Context a; protected String b; protected CharSequence c; protected String d; protected String e; protected String g; protected DialogInterface.OnClickListener k; protected DialogInterface.OnClickListener l; protected View.OnClickListener m; protected int o; protected int f = 0; protected boolean h = true; protected boolean i = true; protected int j = 17; protected boolean n = false; protected int p = -1; protected int q = -1; public Builder(Context context) { this.o = 0; this.a = context; this.o = context.getResources().getColor(R.color.comm_bg_596F80); } public ComponentInfoDialog a() { ComponentInfoDialog componentInfoDialog = new ComponentInfoDialog(this.a); componentInfoDialog.requestWindowFeature(1); componentInfoDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); componentInfoDialog.e = this.n; componentInfoDialog.b = this.c; componentInfoDialog.d = this.e; componentInfoDialog.c = this.d; componentInfoDialog.j = this.l; componentInfoDialog.i = this.k; componentInfoDialog.k = this.m; componentInfoDialog.f = this.o; componentInfoDialog.h = this.q; componentInfoDialog.g = this.p; View inflate = LayoutInflater.from(this.a).inflate(R.layout.layout_component_info_dialog, (ViewGroup) null, false); componentInfoDialog.a(inflate, this); componentInfoDialog.setContentView(inflate); componentInfoDialog.setCanceledOnTouchOutside(this.h); componentInfoDialog.setCancelable(this.i); Window window = componentInfoDialog.getWindow(); WindowManager.LayoutParams attributes = window.getAttributes(); window.setBackgroundDrawableResource(R.color.comm_transparent); int a = DisplayUtil.a(this.a, R.dimen.component_info_dialog_width); int a2 = DisplayUtil.a(this.a, R.dimen.component_info_dialog_height); attributes.width = a; attributes.height = a2; attributes.gravity = 17; window.setAttributes(attributes); return componentInfoDialog; } public Builder a(String str) { this.b = str; return this; } public Builder a(CharSequence charSequence) { this.c = charSequence; return this; } public Builder a(boolean z) { this.h = z; return this; } } }