package com.mbridge.msdk.foundation.d.a; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.GradientDrawable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.CompoundButton; import android.widget.RadioButton; import com.mbridge.msdk.c.b; import com.mbridge.msdk.c.g; import com.mbridge.msdk.c.h; import com.mbridge.msdk.c.i; import com.mbridge.msdk.foundation.controller.c; import com.mbridge.msdk.foundation.d.b; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.ak; import com.mbridge.msdk.foundation.tools.x; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import com.mbridge.msdk.widget.FeedBackButton; import com.mbridge.msdk.widget.FeedbackRadioGroup; import com.mbridge.msdk.widget.dialog.MBFeedBackDialog; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; /* loaded from: classes4.dex */ public final class a { private static int a = -1; private static String b; private String d; private CampaignEx e; private FeedBackButton g; private String h; private String k; private MBFeedBackDialog l; private Dialog m; private JSONArray n; private int s; private List t; private int w; private float c = 1.0f; private String f = ""; private float i = -1.0f; private int j = -1; private int o = -1; private int p = -1; private int q = -1; private int r = -1; private int u = ak.a(c.m().c(), 20.0f); private String v = ""; private com.mbridge.msdk.widget.dialog.a x = new com.mbridge.msdk.widget.dialog.a() { // from class: com.mbridge.msdk.foundation.d.a.a.1 @Override // com.mbridge.msdk.widget.dialog.a public final void a() { a.a(a.this); } @Override // com.mbridge.msdk.widget.dialog.a public final void b() { a.b(a.this); } @Override // com.mbridge.msdk.widget.dialog.a public final void c() { a.c(a.this); } }; private int y = a; private int z = -1; private int A = -1; private int B = -1; public final void a(int i) { this.s = i; } public final void a(CampaignEx campaignEx) { this.e = campaignEx; } public final void a(String str) { this.f = str; } public final void b(int i) { this.w = i; } public final CampaignEx c() { return this.e; } public final int f() { return this.s; } public final int g() { return this.w; } public a(String str) { this.t = new ArrayList(); this.k = str; if (this.t == null) { this.t = new ArrayList(); } k(); i(); j(); } public final void a(C0197a c0197a) { if (this.t == null) { this.t = new ArrayList(); } this.t.add(c0197a); } public final void a() { FeedBackButton feedBackButton = this.g; if (feedBackButton != null) { feedBackButton.setOnClickListener(null); this.g.setVisibility(8); ViewGroup viewGroup = (ViewGroup) this.g.getParent(); if (viewGroup != null) { viewGroup.removeView(this.g); } } MBFeedBackDialog mBFeedBackDialog = this.l; if (mBFeedBackDialog != null) { mBFeedBackDialog.cancel(); this.l.setListener(null); } this.l = null; this.t = null; this.g = null; this.x = null; } public final void b() { MBFeedBackDialog mBFeedBackDialog = this.l; if (mBFeedBackDialog == null || !mBFeedBackDialog.isShowing()) { return; } this.l.cancel(); } public final FeedBackButton d() { if (this.g == null) { i(); } return this.g; } private void i() { Context c = c.m().c(); if (c != null) { try { FeedBackButton feedBackButton = new FeedBackButton(c); this.g = feedBackButton; int i = 8; if (this.y != 8) { i = 0; } feedBackButton.setVisibility(i); this.g.setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.foundation.d.a.a.2 @Override // android.view.View.OnClickListener public final void onClick(View view) { a.this.e(); } }); } catch (Exception e) { e.printStackTrace(); } } } /* JADX WARN: Removed duplicated region for block: B:12:0x004e */ /* JADX WARN: Removed duplicated region for block: B:14:0x0053 A[Catch: Exception -> 0x002a, TryCatch #0 {Exception -> 0x002a, blocks: (B:2:0x0000, B:4:0x0023, B:7:0x002f, B:9:0x003b, B:10:0x003f, B:14:0x0053, B:15:0x0072, B:17:0x0076, B:18:0x007a, B:20:0x0080, B:23:0x0088, B:29:0x008e, B:34:0x0063, B:36:0x002c), top: B:1:0x0000 }] */ /* JADX WARN: Removed duplicated region for block: B:17:0x0076 A[Catch: Exception -> 0x002a, TryCatch #0 {Exception -> 0x002a, blocks: (B:2:0x0000, B:4:0x0023, B:7:0x002f, B:9:0x003b, B:10:0x003f, B:14:0x0053, B:15:0x0072, B:17:0x0076, B:18:0x007a, B:20:0x0080, B:23:0x0088, B:29:0x008e, B:34:0x0063, B:36:0x002c), top: B:1:0x0000 }] */ /* JADX WARN: Removed duplicated region for block: B:29:0x008e A[Catch: Exception -> 0x002a, TRY_LEAVE, TryCatch #0 {Exception -> 0x002a, blocks: (B:2:0x0000, B:4:0x0023, B:7:0x002f, B:9:0x003b, B:10:0x003f, B:14:0x0053, B:15:0x0072, B:17:0x0076, B:18:0x007a, B:20:0x0080, B:23:0x0088, B:29:0x008e, B:34:0x0063, B:36:0x002c), top: B:1:0x0000 }] */ /* JADX WARN: Removed duplicated region for block: B:33:? A[RETURN, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:34:0x0063 A[Catch: Exception -> 0x002a, TryCatch #0 {Exception -> 0x002a, blocks: (B:2:0x0000, B:4:0x0023, B:7:0x002f, B:9:0x003b, B:10:0x003f, B:14:0x0053, B:15:0x0072, B:17:0x0076, B:18:0x007a, B:20:0x0080, B:23:0x0088, B:29:0x008e, B:34:0x0063, B:36:0x002c), top: B:1:0x0000 }] */ /* JADX WARN: Removed duplicated region for block: B:35:0x0050 */ /* JADX WARN: Removed duplicated region for block: B:9:0x003b A[Catch: Exception -> 0x002a, TryCatch #0 {Exception -> 0x002a, blocks: (B:2:0x0000, B:4:0x0023, B:7:0x002f, B:9:0x003b, B:10:0x003f, B:14:0x0053, B:15:0x0072, B:17:0x0076, B:18:0x007a, B:20:0x0080, B:23:0x0088, B:29:0x008e, B:34:0x0063, B:36:0x002c), top: B:1:0x0000 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void e() { /* r10 = this; com.mbridge.msdk.foundation.d.b r0 = com.mbridge.msdk.foundation.d.b.a() // Catch: java.lang.Exception -> L2a java.lang.String r1 = r10.k // Catch: java.lang.Exception -> L2a r2 = 0 r3 = 1 java.lang.String r4 = com.mbridge.msdk.foundation.d.a.a.b // Catch: java.lang.Exception -> L2a java.lang.String r5 = r10.f // Catch: java.lang.Exception -> L2a r0.a(r1, r2, r3, r4, r5) // Catch: java.lang.Exception -> L2a com.mbridge.msdk.foundation.d.b r0 = com.mbridge.msdk.foundation.d.b.a() // Catch: java.lang.Exception -> L2a com.mbridge.msdk.foundation.controller.c r1 = com.mbridge.msdk.foundation.controller.c.m() // Catch: java.lang.Exception -> L2a android.content.Context r1 = r1.c() // Catch: java.lang.Exception -> L2a android.app.Activity r0 = r0.a(r1) // Catch: java.lang.Exception -> L2a com.mbridge.msdk.widget.dialog.MBFeedBackDialog r1 = r10.l // Catch: java.lang.Exception -> L2a if (r1 == 0) goto L2c android.content.Context r1 = r1.getContext() // Catch: java.lang.Exception -> L2a if (r1 == r0) goto L2f goto L2c L2a: r0 = move-exception goto L92 L2c: r10.j() // Catch: java.lang.Exception -> L2a L2f: com.mbridge.msdk.foundation.controller.c r0 = com.mbridge.msdk.foundation.controller.c.m() // Catch: java.lang.Exception -> L2a android.content.Context r0 = r0.c() // Catch: java.lang.Exception -> L2a com.mbridge.msdk.widget.FeedBackButton r1 = r10.g // Catch: java.lang.Exception -> L2a if (r1 == 0) goto L3f android.content.Context r0 = r1.getContext() // Catch: java.lang.Exception -> L2a L3f: com.mbridge.msdk.foundation.d.b r1 = com.mbridge.msdk.foundation.d.b.a() // Catch: java.lang.Exception -> L2a java.lang.String r2 = r10.k // Catch: java.lang.Exception -> L2a com.mbridge.msdk.widget.dialog.MBFeedBackDialog r3 = r10.l // Catch: java.lang.Exception -> L2a boolean r1 = r1.a(r2, r0, r3) // Catch: java.lang.Exception -> L2a r2 = 2 if (r1 == 0) goto L50 r3 = r2 goto L51 L50: r3 = 3 L51: if (r3 != r2) goto L63 com.mbridge.msdk.foundation.d.b r4 = com.mbridge.msdk.foundation.d.b.a() // Catch: java.lang.Exception -> L2a java.lang.String r5 = r10.k // Catch: java.lang.Exception -> L2a r6 = 0 r7 = 2 java.lang.String r8 = com.mbridge.msdk.foundation.d.a.a.b // Catch: java.lang.Exception -> L2a java.lang.String r9 = r10.f // Catch: java.lang.Exception -> L2a r4.a(r5, r6, r7, r8, r9) // Catch: java.lang.Exception -> L2a goto L72 L63: com.mbridge.msdk.foundation.d.b r4 = com.mbridge.msdk.foundation.d.b.a() // Catch: java.lang.Exception -> L2a java.lang.String r5 = r10.k // Catch: java.lang.Exception -> L2a r6 = 0 r7 = 3 java.lang.String r8 = com.mbridge.msdk.foundation.d.a.a.b // Catch: java.lang.Exception -> L2a java.lang.String r9 = r10.f // Catch: java.lang.Exception -> L2a r4.a(r5, r6, r7, r8, r9) // Catch: java.lang.Exception -> L2a L72: java.util.List r2 = r10.t // Catch: java.lang.Exception -> L2a if (r2 == 0) goto L8c java.util.Iterator r2 = r2.iterator() // Catch: java.lang.Exception -> L2a L7a: boolean r4 = r2.hasNext() // Catch: java.lang.Exception -> L2a if (r4 == 0) goto L8c java.lang.Object r4 = r2.next() // Catch: java.lang.Exception -> L2a com.mbridge.msdk.foundation.d.a.a$a r4 = (com.mbridge.msdk.foundation.d.a.a.C0197a) r4 // Catch: java.lang.Exception -> L2a if (r4 == 0) goto L7a r4.a(r3) // Catch: java.lang.Exception -> L2a goto L7a L8c: if (r1 != 0) goto L95 r10.a(r0) // Catch: java.lang.Exception -> L2a goto L95 L92: r0.printStackTrace() L95: return */ throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.foundation.d.a.a.e():void"); } private void j() { try { if (b.a().a(c.m().c()) != null) { g b2 = h.a().b(c.m().k()); if (b2 == null) { h.a(); b2 = i.a(); } b.C0189b G = b2.G(); if (G == null) { af.c("", "feedback fbk is null"); return; } k(); this.l = new MBFeedBackDialog(com.mbridge.msdk.foundation.d.b.a().a(c.m().c()), this.x); FeedbackRadioGroup a2 = a(G); this.l.setCancelText(G.d()); this.l.setConfirmText(G.a()); this.l.setPrivacyText(G.c()); this.v = G.e(); this.l.setTitle(G.f()); this.l.setContent(a2); this.l.setCancelButtonClickable(!TextUtils.isEmpty(b)); a(a2, G); } } catch (Exception e) { e.printStackTrace(); } } private void a(Context context) { if (context != null) { try { com.mbridge.msdk.click.c.f(context, ak.a(this.e)); } catch (Exception unused) { com.mbridge.msdk.click.c.d(context, ak.a(this.e)); } } } private void k() { if (this.x == null) { this.x = new com.mbridge.msdk.widget.dialog.a() { // from class: com.mbridge.msdk.foundation.d.a.a.3 @Override // com.mbridge.msdk.widget.dialog.a public final void a() { a.a(a.this); } @Override // com.mbridge.msdk.widget.dialog.a public final void b() { a.b(a.this); } @Override // com.mbridge.msdk.widget.dialog.a public final void c() { a.c(a.this); } }; } } private FeedbackRadioGroup a(b.C0189b c0189b) { JSONArray b2 = c0189b.b(); Context c = c.m().c(); if (b2 == null || b2.length() <= 0 || c == null) { return null; } FeedbackRadioGroup feedbackRadioGroup = new FeedbackRadioGroup(c); feedbackRadioGroup.setOrientation(0); return feedbackRadioGroup; } /* JADX WARN: Removed duplicated region for block: B:12:0x004a */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private void a(com.mbridge.msdk.widget.FeedbackRadioGroup r11, com.mbridge.msdk.c.b.C0189b r12) { /* r10 = this; org.json.JSONArray r12 = r12.b() com.mbridge.msdk.foundation.controller.c r0 = com.mbridge.msdk.foundation.controller.c.m() android.content.Context r0 = r0.c() if (r12 == 0) goto L7e int r1 = r12.length() if (r1 <= 0) goto L7e if (r0 == 0) goto L7e java.lang.String r1 = "mbridge_cm_feedback_choice_btn_bg" java.lang.String r2 = "drawable" com.mbridge.msdk.foundation.tools.x.a(r0, r1, r2) android.content.res.Resources r1 = com.mbridge.msdk.foundation.tools.x.a(r0) java.lang.String r2 = "mbridge_cm_feedback_rb_text_color_color_list" java.lang.String r3 = "color" int r2 = com.mbridge.msdk.foundation.tools.x.a(r0, r2, r3) if (r1 == 0) goto L34 android.content.res.ColorStateList r1 = r1.getColorStateList(r2) // Catch: java.lang.Exception -> L30 goto L35 L30: r1 = move-exception r1.printStackTrace() L34: r1 = 0 L35: r2 = 1065353216(0x3f800000, float:1.0) int r3 = com.mbridge.msdk.foundation.tools.ak.a(r0, r2) int r4 = com.mbridge.msdk.foundation.tools.ak.a(r0, r2) int r2 = com.mbridge.msdk.foundation.tools.ak.a(r0, r2) r5 = 0 L44: int r6 = r12.length() if (r5 >= r6) goto L7e java.lang.String r6 = r12.optString(r5) android.widget.RadioButton r7 = new android.widget.RadioButton r7.(r0) r7.setButtonTintList(r1) r7.setText(r6) if (r1 == 0) goto L5e r7.setTextColor(r1) L5e: r7.setCompoundDrawablePadding(r3) r7.setPadding(r3, r4, r3, r4) android.text.TextUtils$TruncateAt r6 = android.text.TextUtils.TruncateAt.END r7.setEllipsize(r6) android.widget.RadioGroup$LayoutParams r6 = new android.widget.RadioGroup$LayoutParams r8 = -1 r9 = -2 r6.(r8, r9) int r8 = r2 / 4 r6.setMargins(r2, r8, r2, r8) r10.a(r7) r11.addView(r7, r6) int r5 = r5 + 1 goto L44 L7e: return */ throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.foundation.d.a.a.a(com.mbridge.msdk.widget.FeedbackRadioGroup, com.mbridge.msdk.c.b$b):void"); } private void a(RadioButton radioButton) { if (radioButton != null) { radioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.mbridge.msdk.foundation.d.a.a.4 @Override // android.widget.CompoundButton.OnCheckedChangeListener public final void onCheckedChanged(CompoundButton compoundButton, boolean z) { if (z) { String unused = a.b = (String) compoundButton.getText(); } if (a.this.l != null) { a.this.l.setCancelButtonClickable(!TextUtils.isEmpty(a.b)); } } }); } } public final void a(FeedBackButton feedBackButton) { FeedBackButton feedBackButton2 = this.g; if (feedBackButton2 != null) { feedBackButton2.setVisibility(8); } if (feedBackButton != null) { feedBackButton.setAlpha(this.c); feedBackButton.setEnabled(this.c != 0.0f); feedBackButton.setVisibility(this.y != 8 ? 0 : 8); this.g = feedBackButton; CampaignEx campaignEx = this.e; if (campaignEx != null && !campaignEx.isDynamicView()) { l(); } feedBackButton.setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.foundation.d.a.a.6 @Override // android.view.View.OnClickListener public final void onClick(View view) { a.this.e(); } }); } } private void l() { FeedBackButton feedBackButton = this.g; if (feedBackButton != null) { int i = this.A; if (i > -1) { feedBackButton.setX(i); } int i2 = this.B; if (i2 > -1) { this.g.setY(i2); } float f = this.c; if (f >= 0.0f) { this.g.setAlpha(f); this.g.setEnabled(this.c != 0.0f); } ViewGroup.LayoutParams layoutParams = this.g.getLayoutParams(); int i3 = this.z; if (i3 > 0) { this.g.setWidth(i3); if (layoutParams != null) { layoutParams.width = this.z; } } int i4 = this.j; if (i4 > 0) { this.g.setHeight(i4); if (layoutParams != null) { layoutParams.height = this.j; } } if (layoutParams != null) { this.g.setLayoutParams(layoutParams); } try { if (!TextUtils.isEmpty(this.h)) { this.g.setTextColor(Color.parseColor(this.h)); } } catch (Exception e) { e.printStackTrace(); } float f2 = this.i; if (f2 > 0.0f) { this.g.setTextSize(f2); } JSONArray jSONArray = this.n; if (jSONArray != null && jSONArray.length() == 4) { Context c = c.m().c(); this.g.setPadding(ak.a(c, (float) this.n.optDouble(0)), ak.a(c, (float) this.n.optDouble(1)), ak.a(c, (float) this.n.optDouble(2)), ak.a(c, (float) this.n.optDouble(3))); } GradientDrawable gradientDrawable = new GradientDrawable(); int i5 = this.u; if (i5 > 0) { gradientDrawable.setCornerRadius(i5); } if (!TextUtils.isEmpty(this.d)) { gradientDrawable.setColor(Color.parseColor(this.d)); } else { gradientDrawable.setColor(Color.parseColor(FeedBackButton.FEEDBACK_BTN_BACKGROUND_COLOR_STR)); } this.g.setBackground(gradientDrawable); } } public final void c(int i) { this.y = i; FeedBackButton feedBackButton = this.g; if (feedBackButton != null) { feedBackButton.setVisibility(i); } } public final void a(int i, int i2, int i3, int i4, int i5, float f, String str, String str2, float f2, JSONArray jSONArray) { if (i > -1) { this.A = i; } if (i2 > -1) { this.B = i2; } if (i3 > -1) { this.z = i3; } if (i4 > -1) { this.j = i4; } if (f2 > -1.0f) { this.i = f2; } if (jSONArray != null) { this.n = jSONArray; } this.h = str; this.d = str2; this.c = f; this.u = i5; l(); } /* renamed from: com.mbridge.msdk.foundation.d.a.a$a, reason: collision with other inner class name */ public static class C0197a implements com.mbridge.msdk.widget.dialog.a { private com.mbridge.msdk.foundation.d.a a; private String b; public C0197a(String str, com.mbridge.msdk.foundation.d.a aVar) { this.a = aVar; this.b = str; } @Override // com.mbridge.msdk.widget.dialog.a public final void a() { com.mbridge.msdk.foundation.d.b.c = false; com.mbridge.msdk.foundation.d.a aVar = this.a; if (aVar != null) { aVar.summit(a.b); } } @Override // com.mbridge.msdk.widget.dialog.a public final void b() { com.mbridge.msdk.foundation.d.b.c = false; com.mbridge.msdk.foundation.d.a aVar = this.a; if (aVar != null) { aVar.close(); } } @Override // com.mbridge.msdk.widget.dialog.a public final void c() { com.mbridge.msdk.foundation.d.a aVar = this.a; if (aVar != null) { aVar.close(); } } public final void a(int i) { com.mbridge.msdk.foundation.d.b.c = true; com.mbridge.msdk.foundation.d.a aVar = this.a; if (aVar == null || i != 2) { return; } aVar.showed(); } } public static /* synthetic */ void a(a aVar) { com.mbridge.msdk.foundation.d.b.a().a(aVar.k, 1, 4, b, aVar.f); List list = aVar.t; if (list != null) { for (C0197a c0197a : list) { if (c0197a != null) { c0197a.a(); } } } if (!TextUtils.isEmpty(aVar.v)) { try { Activity a2 = com.mbridge.msdk.foundation.d.b.a().a(c.m().c()); if (a2 != null) { View inflate = LayoutInflater.from(a2).inflate(x.a(a2, "mbridge_cm_feedback_notice_layout", TtmlNode.TAG_LAYOUT), (ViewGroup) null); Dialog dialog = new Dialog(a2, 3); aVar.m = dialog; dialog.requestWindowFeature(1); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); Window window = aVar.m.getWindow(); layoutParams.copyFrom(window.getAttributes()); layoutParams.width = -2; layoutParams.height = -2; aVar.m.setContentView(inflate); aVar.m.show(); window.setAttributes(layoutParams); inflate.postDelayed(new Runnable() { // from class: com.mbridge.msdk.foundation.d.a.a.5 @Override // java.lang.Runnable public final void run() { try { if (a.this.m == null || !a.this.m.isShowing()) { return; } a.this.m.dismiss(); } catch (Exception e) { e.printStackTrace(); } } }, 2000L); } } catch (Exception e) { e.printStackTrace(); } } b = ""; } public static /* synthetic */ void b(a aVar) { com.mbridge.msdk.foundation.d.b.a().a(aVar.k, 0, 4, b, aVar.f); List list = aVar.t; if (list != null) { for (C0197a c0197a : list) { if (c0197a != null) { c0197a.b(); } } } b = ""; } public static /* synthetic */ void c(a aVar) { com.mbridge.msdk.foundation.d.b.a().a(aVar.k, 0, 4, b, aVar.f); Context e = c.m().e(); if (e == null) { e = c.m().c(); } List list = aVar.t; if (list != null) { for (C0197a c0197a : list) { if (c0197a != null) { c0197a.b(); } } } aVar.a(e); b = ""; } }