package com.mobon.sdk; import android.content.Context; import android.graphics.Canvas; import android.graphics.Path; import android.graphics.RectF; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.google.android.gms.ads.RequestConfiguration; import java.util.Map; import org.json.JSONObject; /* loaded from: classes2.dex */ public class g extends RelativeLayout { /* renamed from: a, reason: collision with root package name */ private final Context f7603a; /* renamed from: b, reason: collision with root package name */ private String f7604b; /* renamed from: c, reason: collision with root package name */ private int f7605c; /* renamed from: d, reason: collision with root package name */ private Handler f7606d; /* renamed from: e, reason: collision with root package name */ private Path f7607e; /* renamed from: f, reason: collision with root package name */ private boolean f7608f; /* renamed from: g, reason: collision with root package name */ private int f7609g; /* renamed from: h, reason: collision with root package name */ private h7.f f7610h; /* renamed from: i, reason: collision with root package name */ private String f7611i; /* renamed from: j, reason: collision with root package name */ private int f7612j; /* renamed from: k, reason: collision with root package name */ private String f7613k; /* renamed from: l, reason: collision with root package name */ private Object f7614l; /* renamed from: m, reason: collision with root package name */ private boolean f7615m; /* renamed from: n, reason: collision with root package name */ private final ViewGroup f7616n; /* renamed from: o, reason: collision with root package name */ private TextView f7617o; /* renamed from: p, reason: collision with root package name */ private TextView f7618p; /* renamed from: q, reason: collision with root package name */ private TextView f7619q; /* renamed from: r, reason: collision with root package name */ private ImageView f7620r; /* renamed from: s, reason: collision with root package name */ private ImageView f7621s; class a implements View.OnClickListener { a() { } @Override // android.view.View.OnClickListener public void onClick(View view) { if (TextUtils.isEmpty(g.this.f7613k)) { return; } f7.m.b(g.this.f7603a, g.this.f7613k, false); } } class b implements h7.c { class a implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ JSONObject f7624a; /* renamed from: com.mobon.sdk.g$b$a$a, reason: collision with other inner class name */ class C0107a implements h7.e { C0107a() { } @Override // h7.e public void a(String str, f7.b bVar) { f7.f.a("onLoadedAdData mobon : " + str); try { g.this.m(); g.this.v(new JSONObject(str)); g.this.f7614l = null; } catch (Exception e10) { e10.printStackTrace(); } } @Override // h7.e public void b() { } @Override // h7.e public void c(String str) { g.this.f7616n.removeAllViews(); if (g.this.f7610h != null) { g.this.f7610h.onLoadedAdInfo(false, "No fill"); g.this.f7610h = null; } } @Override // h7.e public void d(f7.b bVar) { g.this.f7614l = bVar.i(); if (g.this.f7614l == null) { if (g.this.f7610h != null) { g.this.f7610h.onLoadedAdInfo(false, "ERROR " + bVar.f() + " load"); g.this.f7610h = null; return; } return; } f7.f.a("onAdAdapter " + bVar.f() + " getView Not NULL!!!! "); g.this.f7616n.removeAllViews(); if (g.this.getParent() != null) { g.this.f7615m = true; ((ViewGroup) g.this.getParent()).removeView(g.this); } g.this.f7616n.addView((View) g.this.f7614l); if (g.this.f7610h != null) { g.this.f7610h.onLoadedAdInfo(true, RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED); g.this.f7610h = null; } g.this.f7615m = false; } @Override // h7.e public void e() { } @Override // h7.e public void onAdClicked() { } @Override // h7.e public void onAdClosed() { } @Override // h7.e public void onAdImpression() { } } a(JSONObject jSONObject) { this.f7624a = jSONObject; } @Override // java.lang.Runnable public void run() { if (e.f7583a) { new f7.h(g.this.f7603a, this.f7624a, "NATIVE_FEED").a(new C0107a()); } } } b() { } @Override // h7.c public void a(boolean z10, JSONObject jSONObject, String str) { if (z10) { new Handler(Looper.getMainLooper()).post(new a(jSONObject)); return; } synchronized (this) { if (g.this.f7610h != null) { g.this.f7610h.onLoadedAdInfo(false, str); } g.this.f7610h = null; } } } class c implements View.OnClickListener { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f7627a; c(String str) { this.f7627a = str; } @Override // android.view.View.OnClickListener public void onClick(View view) { f7.f.a("landing url : " + this.f7627a); f7.m.b(g.this.f7603a, this.f7627a, false); if (g.this.f7610h != null) { g.this.f7610h.onAdClicked(); } } } class d implements Runnable { d() { } @Override // java.lang.Runnable public void run() { if (g.this.f7616n != null) { g.this.f7616n.removeAllViews(); } } } public g(Context context, ViewGroup viewGroup) { super(context); this.f7604b = "NATIVE_RECTAGLE"; this.f7610h = null; this.f7603a = context; this.f7616n = viewGroup; if (viewGroup == null) { throw new IllegalArgumentException("nativeAdView container view null"); } } private void getAdData() { Map k10 = com.mobon.sdk.a.k(this.f7603a); k10.put("s", this.f7611i); com.mobon.sdk.a.n(this.f7603a, this.f7611i, k10, this.f7605c > 0, this.f7612j, false, new b()); } /* JADX WARN: Code restructure failed: missing block: B:10:0x0034, code lost: if (n(r4.optString("mimg_250_250")) != false) goto L84; */ /* JADX WARN: Code restructure failed: missing block: B:18:0x0048, code lost: if (n(r4.optString("mimg_960_100")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:19:0x004a, code lost: r1 = r0; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x005d, code lost: if (n(r4.optString("mimg_728_90")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:27:0x0070, code lost: if (n(r4.optString("mimg_720_120")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:31:0x0083, code lost: if (n(r4.optString("mimg_300_65")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:35:0x0096, code lost: if (n(r4.optString("mimg_320_100")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:39:0x00aa, code lost: if (n(r4.optString("mimg_640_350")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:43:0x00be, code lost: if (n(r4.optString("mimg_300_180")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:47:0x00d2, code lost: if (n(r4.optString("mimg_300_250")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:51:0x00e7, code lost: if (n(r4.optString("mimg_720_1230")) != false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:62:0x011b, code lost: if (n(r4.optString("mimg_850_800")) != false) goto L84; */ /* JADX WARN: Code restructure failed: missing block: B:66:0x012f, code lost: if (n(r4.optString("mimg_160_600")) != false) goto L84; */ /* JADX WARN: Code restructure failed: missing block: B:70:0x0143, code lost: if (n(r4.optString("mimg_120_600")) != false) goto L84; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private java.lang.String l(org.json.JSONObject r4, float r5) { /* Method dump skipped, instructions count: 333 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.mobon.sdk.g.l(org.json.JSONObject, float):java.lang.String"); } /* JADX INFO: Access modifiers changed from: private */ public void m() { if (this.f7616n == null) { throw new IllegalArgumentException("nativeAdView container view null"); } RelativeLayout relativeLayout = new RelativeLayout(this.f7603a); ImageView imageView = new ImageView(this.f7603a); imageView.setImageDrawable(this.f7603a.getResources().getDrawable(i.f7637a)); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2); layoutParams.setMargins(0, f7.m.a(this.f7603a, 5), f7.m.a(this.f7603a, 5), 0); layoutParams.addRule(11, -1); imageView.setLayoutParams(layoutParams); imageView.setOnClickListener(new a()); relativeLayout.addView(imageView); this.f7616n.addView(relativeLayout); this.f7616n.setVisibility(4); } private boolean n(String str) { if (TextUtils.isEmpty(str)) { return false; } String substring = str.substring(str.lastIndexOf(".") + 1); return substring.equals("jpg") || substring.equals("png") || substring.equals("gif"); } /* JADX INFO: Access modifiers changed from: private */ /* JADX WARN: Removed duplicated region for block: B:34:0x00f0 A[Catch: Exception -> 0x02d2, TryCatch #0 {Exception -> 0x02d2, blocks: (B:3:0x0009, B:5:0x000d, B:6:0x0011, B:8:0x0021, B:10:0x0028, B:14:0x0031, B:16:0x0066, B:17:0x006d, B:19:0x00a0, B:21:0x00a6, B:22:0x00ab, B:25:0x00b7, B:27:0x00bb, B:31:0x00ca, B:32:0x00e6, B:34:0x00f0, B:35:0x00f4, B:39:0x00db, B:41:0x00d5, B:43:0x00d9, B:44:0x0115, B:46:0x0119, B:48:0x0123, B:49:0x012e, B:50:0x0128, B:51:0x0133, B:53:0x0137, B:54:0x0140, B:56:0x0144, B:57:0x0158, B:58:0x029b, B:59:0x029e, B:61:0x02a5, B:62:0x02c0, B:64:0x02ce, B:67:0x015c, B:69:0x0160, B:70:0x0185, B:72:0x0189, B:74:0x0193, B:75:0x019b, B:77:0x01a0, B:79:0x01a4, B:82:0x01b1, B:84:0x01d2, B:85:0x01f4, B:88:0x0200, B:91:0x0209, B:93:0x020f, B:94:0x022e, B:96:0x0232, B:97:0x0236, B:98:0x024d, B:99:0x0252, B:101:0x0256, B:102:0x0269, B:104:0x0281, B:106:0x0285, B:107:0x0069), top: B:2:0x0009 }] */ /* JADX WARN: Removed duplicated region for block: B:61:0x02a5 A[Catch: Exception -> 0x02d2, TryCatch #0 {Exception -> 0x02d2, blocks: (B:3:0x0009, B:5:0x000d, B:6:0x0011, B:8:0x0021, B:10:0x0028, B:14:0x0031, B:16:0x0066, B:17:0x006d, B:19:0x00a0, B:21:0x00a6, B:22:0x00ab, B:25:0x00b7, B:27:0x00bb, B:31:0x00ca, B:32:0x00e6, B:34:0x00f0, B:35:0x00f4, B:39:0x00db, B:41:0x00d5, B:43:0x00d9, B:44:0x0115, B:46:0x0119, B:48:0x0123, B:49:0x012e, B:50:0x0128, B:51:0x0133, B:53:0x0137, B:54:0x0140, B:56:0x0144, B:57:0x0158, B:58:0x029b, B:59:0x029e, B:61:0x02a5, B:62:0x02c0, B:64:0x02ce, B:67:0x015c, B:69:0x0160, B:70:0x0185, B:72:0x0189, B:74:0x0193, B:75:0x019b, B:77:0x01a0, B:79:0x01a4, B:82:0x01b1, B:84:0x01d2, B:85:0x01f4, B:88:0x0200, B:91:0x0209, B:93:0x020f, B:94:0x022e, B:96:0x0232, B:97:0x0236, B:98:0x024d, B:99:0x0252, B:101:0x0256, B:102:0x0269, B:104:0x0281, B:106:0x0285, B:107:0x0069), top: B:2:0x0009 }] */ /* JADX WARN: Removed duplicated region for block: B:64:0x02ce A[Catch: Exception -> 0x02d2, TRY_LEAVE, TryCatch #0 {Exception -> 0x02d2, blocks: (B:3:0x0009, B:5:0x000d, B:6:0x0011, B:8:0x0021, B:10:0x0028, B:14:0x0031, B:16:0x0066, B:17:0x006d, B:19:0x00a0, B:21:0x00a6, B:22:0x00ab, B:25:0x00b7, B:27:0x00bb, B:31:0x00ca, B:32:0x00e6, B:34:0x00f0, B:35:0x00f4, B:39:0x00db, B:41:0x00d5, B:43:0x00d9, B:44:0x0115, B:46:0x0119, B:48:0x0123, B:49:0x012e, B:50:0x0128, B:51:0x0133, B:53:0x0137, B:54:0x0140, B:56:0x0144, B:57:0x0158, B:58:0x029b, B:59:0x029e, B:61:0x02a5, B:62:0x02c0, B:64:0x02ce, B:67:0x015c, B:69:0x0160, B:70:0x0185, B:72:0x0189, B:74:0x0193, B:75:0x019b, B:77:0x01a0, B:79:0x01a4, B:82:0x01b1, B:84:0x01d2, B:85:0x01f4, B:88:0x0200, B:91:0x0209, B:93:0x020f, B:94:0x022e, B:96:0x0232, B:97:0x0236, B:98:0x024d, B:99:0x0252, B:101:0x0256, B:102:0x0269, B:104:0x0281, B:106:0x0285, B:107:0x0069), top: B:2:0x0009 }] */ /* JADX WARN: Removed duplicated region for block: B:66:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public void v(org.json.JSONObject r15) { /* Method dump skipped, instructions count: 764 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.mobon.sdk.g.v(org.json.JSONObject):void"); } @Override // android.view.ViewGroup, android.view.View protected void dispatchDraw(Canvas canvas) { if (this.f7608f) { if (this.f7607e == null) { Path path = new Path(); this.f7607e = path; RectF rectF = new RectF(0.0f, 0.0f, canvas.getWidth(), canvas.getHeight()); float f10 = this.f7609g; path.addRoundRect(rectF, f10, f10, Path.Direction.CW); } canvas.clipPath(this.f7607e); } super.dispatchDraw(canvas); } public void k() { new Handler(Looper.getMainLooper()).post(new d()); } public void o() { if (f.c(this.f7603a) == null) { System.out.println("context null"); return; } if (f7.l.a(this.f7603a, "Key.AGE_LEVEL_KIDS")) { h7.f fVar = this.f7610h; if (fVar != null) { fVar.onLoadedAdInfo(false, "No fill"); return; } return; } f7.f.a("NativeAdView onInit !!!!"); if (TextUtils.isEmpty(this.f7611i)) { throw new IllegalArgumentException("nativeAdView empty unitId"); } getAdData(); } @Override // android.view.ViewGroup, android.view.View protected void onDetachedFromWindow() { super.onDetachedFromWindow(); Handler handler = this.f7606d; if (handler != null) { handler.removeCallbacksAndMessages(null); } this.f7605c = 0; k(); } @Override // android.widget.RelativeLayout, android.view.View protected void onMeasure(int i10, int i11) { super.onMeasure(i10, i11); } @Override // android.view.View public void onWindowFocusChanged(boolean z10) { f7.f.a("hasWindowFocus = " + z10); super.onWindowFocusChanged(z10); } @Override // android.view.View protected void onWindowVisibilityChanged(int i10) { Handler handler; f7.f.a("onWindowVisibilityChanged = " + i10); if (i10 == 8 && (handler = this.f7606d) != null) { handler.removeCallbacksAndMessages(null); } super.onWindowVisibilityChanged(i10); } public g p(ImageView imageView) { this.f7620r = imageView; return this; } public g q(ImageView imageView) { this.f7621s = imageView; return this; } public g r(TextView textView) { this.f7619q = textView; return this; } public g s(TextView textView) { this.f7618p = textView; return this; } public void setAdListener(h7.f fVar) { this.f7610h = fVar; } public void setInterval(int i10) { this.f7605c = i10; } public g t(TextView textView) { this.f7617o = textView; return this; } public g u(String str) { this.f7611i = str; return this; } }