Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382
以下内容为反编译后的 l.java 源代码,内容仅作参考
package sg.bigo.ads.ad.interstitial;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.drawable.GradientDrawable;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.Interpolator;
import android.view.animation.ScaleAnimation;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.URLUtil;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.chartboost.heliumsdk.impl.K1zS1t1;
import com.chartboost.heliumsdk.impl.KHS1Kz;
import com.chartboost.heliumsdk.impl.SHKSt1z;
import com.chartboost.heliumsdk.impl.tSHz11;
import com.google.android.gms.auth.api.proxy.AuthApiStatusCodes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
import sg.bigo.ads.R;
import sg.bigo.ads.api.NativeAdView;
import sg.bigo.ads.api.core.c;
import sg.bigo.ads.api.core.n;
import sg.bigo.ads.common.utils.b;
import sg.bigo.ads.common.view.AdImageView;
import sg.bigo.ads.common.view.AutoNextLineLinearLayout;
import sg.bigo.ads.common.view.RoundedFrameLayout;
public final class l {
@Nullable
private Runnable A;
@Nullable
private AlertDialog B;
@Nullable
private View C;
private int H;
private long I;
private boolean J;
@Nullable
private Runnable K;
@Nullable
final Context a;
@Nullable
final sg.bigo.ads.ad.a.c b;
@Nullable
final sg.bigo.ads.api.core.c c;
@Nullable
final sg.bigo.ads.api.a.k d;
@Nullable
FrameLayout e;
@Nullable
FrameLayout f;
boolean l;
int m;
long o;
List<Integer> p;
long q;
@Nullable
Runnable r;
@Nullable
Runnable s;
@Nullable
Runnable t;
@NonNull
final a v;
@NonNull
final c w;
@NonNull
final d x;
@Nullable
private Runnable y;
@Nullable
private Runnable z;
boolean g = true;
private boolean D = false;
boolean h = false;
private boolean E = false;
boolean i = false;
boolean j = false;
boolean k = false;
private boolean F = false;
int n = 0;
private long G = -1;
@NonNull
private final List<Runnable> L = new ArrayList();
@NonNull
public final b u = new b();
@SuppressLint({"ClickableViewAccessibility"})
public static class a {
int a;
boolean b;
boolean c;
boolean d;
boolean e;
int f;
boolean g;
int h;
boolean i;
int j;
float k;
float l;
@Nullable
View m;
@Nullable
View n;
@Nullable
View o;
@Nullable
l p;
@NonNull
final Map<View, sg.bigo.ads.core.adview.g> q;
@NonNull
final sg.bigo.ads.core.adview.g r;
private a() {
this.a = 0;
this.q = new HashMap();
this.r = new sg.bigo.ads.core.adview.g() {
@Override
public final void a(int i, int i2, int i3, int i4) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Disable click by style config.");
}
};
}
public a(byte b) {
this();
}
public static View a(a aVar, View view, float f, float f2) {
ArrayList arrayList = new ArrayList();
aVar.a(view, f, f2, 0, new int[2], arrayList);
if (arrayList.size() > 0) {
return (View) arrayList.get(arrayList.size() - 1);
}
return null;
}
private void a(View view, float f, float f2, int i, @NonNull int[] iArr, @NonNull List<View> list) {
if (i > 10) {
return;
}
int i2 = i + 1;
if (view == null) {
return;
}
view.getLocationOnScreen(iArr);
int i3 = iArr[0];
int i4 = iArr[1];
if (f > i3 && f < view.getWidth() + i3 && f2 > i4 && f2 < view.getHeight() + i4 && (view.getTag() instanceof Integer) && this.q.containsKey(view)) {
list.add(view);
}
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
int childCount = viewGroup.getChildCount();
for (int i5 = 0; i5 < childCount; i5++) {
a(viewGroup.getChildAt(i5), f, f2, i2, iArr, list);
}
}
}
private void a(final sg.bigo.ads.ad.a.c cVar, @NonNull final View view, final int i) {
final int scaledTouchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
view.setOnTouchListener(new View.OnTouchListener() {
boolean a;
int b;
int c;
final int h = 11;
private View a(float f) {
a aVar = a.this;
if (f < aVar.h) {
return aVar.n;
}
if (f > aVar.j - aVar.f) {
return aVar.o;
}
return null;
}
@Override
public final boolean onTouch(View view2, MotionEvent motionEvent) {
boolean z;
sg.bigo.ads.core.adview.g gVar;
int i2;
if (motionEvent.getActionMasked() == 0) {
a.this.k = motionEvent.getRawX();
a.this.l = motionEvent.getRawY();
this.b = view.getScrollX();
this.c = view.getScrollY();
this.a = false;
a aVar = a.this;
aVar.m = a(aVar.l);
a aVar2 = a.this;
if (aVar2.m == null) {
aVar2.m = a.a(aVar2, view, motionEvent.getRawX(), motionEvent.getRawY());
}
return !view.isScrollContainer();
}
if (motionEvent.getActionMasked() == 2) {
if (i == 3 && (Math.abs(motionEvent.getRawX() - a.this.k) >= scaledTouchSlop || Math.abs(motionEvent.getRawY() - a.this.l) >= scaledTouchSlop)) {
this.a = true;
}
} else if (motionEvent.getActionMasked() == 1) {
float rawX = motionEvent.getRawX();
float rawY = motionEvent.getRawY();
View a = a(rawY);
if (a == null) {
a = a.a(a.this, view, motionEvent.getRawX(), motionEvent.getRawY());
}
int i3 = i;
if (i3 != 2) {
if (i3 == 3) {
a aVar3 = a.this;
if (aVar3.m == a) {
if (!this.a) {
if (Math.abs(rawX - aVar3.k) < scaledTouchSlop) {
}
}
}
z = false;
}
}
if (z) {
a aVar4 = a.this;
if (a == aVar4.n) {
a = view;
sg.bigo.ads.ad.a.c cVar2 = cVar;
gVar = aVar4.a(cVar2, aVar4.i ? cVar2 : aVar4.r);
if (!a.this.i) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Forbid click by up area.");
}
i2 = 24;
} else if (a == aVar4.o) {
a = view;
sg.bigo.ads.ad.a.c cVar3 = cVar;
gVar = aVar4.a(cVar3, aVar4.g ? cVar3 : aVar4.r);
if (!a.this.g) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Forbid click by below area.");
}
i2 = 25;
} else {
if (a != null) {
gVar = aVar4.q.get(a);
Object tag = a.getTag();
if (tag instanceof Integer) {
i2 = ((Integer) tag).intValue();
}
} else {
gVar = null;
}
i2 = 0;
}
if (a != null) {
if (gVar == null) {
gVar = a.this.r;
}
View view3 = view;
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
int i4 = this.h;
int i5 = 0;
while (i5 < 100 && (view2.getParent() instanceof ViewGroup)) {
i5++;
if (view2 == view3 || (view2 instanceof NativeAdView)) {
break;
}
x += view2.getLeft();
y += view2.getTop();
view2 = (View) view2.getParent();
}
if (gVar != null) {
gVar.a(x, y, i4, i2);
}
}
}
if (Math.abs(rawX - a.this.k) < scaledTouchSlop && Math.abs(rawY - a.this.l) < scaledTouchSlop) {
return true;
}
}
return false;
}
});
}
private void a(sg.bigo.ads.ad.a.c cVar, @NonNull View view, @NonNull View view2, sg.bigo.ads.core.adview.g gVar, int i) {
if (gVar == null) {
view2.setOnTouchListener(null);
} else {
a(cVar, view, i);
}
}
public final sg.bigo.ads.core.adview.g a(final sg.bigo.ads.ad.a.c cVar, sg.bigo.ads.core.adview.g gVar) {
return gVar == cVar ? new sg.bigo.ads.core.adview.g() {
@Override
public final void a(int i, int i2, int i3, int i4) {
a.this.p.k = true;
cVar.a(i, i2, i3, i4);
}
} : gVar;
}
public final void a(sg.bigo.ads.ad.a.c cVar, @NonNull View view, @NonNull View view2, int i, @Nullable sg.bigo.ads.core.adview.g gVar) {
if (view.getTag() != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Error that touch view exists another tag.");
}
view.setTag(R.id.content, "TouchView");
view2.setTag(Integer.valueOf(i));
if (gVar != null) {
this.q.put(view2, gVar);
}
a(cVar, view, view2, gVar, this.a);
}
}
public class b {
boolean a = false;
public b() {
}
private void b(Runnable runnable) {
l.b(l.this);
sg.bigo.ads.common.g.c.a(2, runnable);
}
public final boolean a() {
l lVar = l.this;
if (lVar.g && !this.a) {
this.a = true;
Runnable runnable = lVar.s;
if (runnable != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Show mid page due to close button pressed in main page.");
b(runnable);
return true;
}
}
return false;
}
public final boolean a(@Nullable Runnable runnable) {
Runnable runnable2;
l lVar = l.this;
if (lVar.g && !this.a) {
this.a = true;
Runnable runnable3 = lVar.s;
if (runnable3 == null && (runnable2 = lVar.r) != null) {
sg.bigo.ads.common.g.c.a(runnable2);
l lVar2 = l.this;
runnable3 = lVar2.r;
lVar2.s = runnable3;
}
if (runnable3 != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Show mid page due to video completion.");
l.this.t = runnable;
b(runnable3);
return true;
}
}
return false;
}
}
public static class c {
int a;
int b;
int c;
private c() {
}
public c(byte b) {
this();
}
}
public static class d {
long a;
boolean b;
private boolean c;
private final Map<Integer, Long> d;
private d() {
this.d = new HashMap();
}
public d(byte b) {
this();
}
public static int a(int i, boolean z) {
if (i == 1) {
return z ? 2 : 1;
}
if (i == 2) {
return 4;
}
if (i == 3) {
return 3;
}
if (i == 4) {
return 5;
}
return i == 5 ? 6 : 0;
}
private static int a(@NonNull String str, int i) {
return (str + i).hashCode();
}
public final void a(sg.bigo.ads.api.core.c cVar, int i, String str, int i2) {
if (TextUtils.isEmpty(str)) {
return;
}
int a = a(str, i2);
if (this.d.get(Integer.valueOf(a)) == null) {
this.d.put(Integer.valueOf(a), Long.valueOf(SystemClock.elapsedRealtime()));
sg.bigo.ads.core.c.a.a(cVar, a(i, false), 1, String.valueOf(a), 0L, false, 0, (String) null);
}
}
public final void a(sg.bigo.ads.api.core.c cVar, int i, String str, int i2, int i3, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
int a = a(str, i2);
Long l = this.d.get(Integer.valueOf(a));
if (l == null) {
return;
}
sg.bigo.ads.core.c.a.a(cVar, a(i, false), 6, String.valueOf(a), SystemClock.elapsedRealtime() - l.longValue(), true, i3, str2);
}
public final void a(sg.bigo.ads.api.core.c cVar, boolean z, int i, String str) {
if (this.c || this.a <= 0) {
return;
}
this.c = true;
sg.bigo.ads.core.c.a.a(cVar, a(1, z), 4, (String) null, SystemClock.elapsedRealtime() - this.a, true, i, str);
}
public final void b(sg.bigo.ads.api.core.c cVar, int i, String str, int i2) {
if (TextUtils.isEmpty(str)) {
return;
}
int a = a(str, i2);
Long l = this.d.get(Integer.valueOf(a));
if (l == null) {
return;
}
sg.bigo.ads.core.c.a.a(cVar, a(i, false), 5, String.valueOf(a), SystemClock.elapsedRealtime() - l.longValue(), false, 0, (String) null);
}
}
public l(Context context, sg.bigo.ads.ad.a.c cVar, sg.bigo.ads.api.core.c cVar2, sg.bigo.ads.api.a.k kVar, Runnable runnable, Runnable runnable2, Runnable runnable3) {
byte b2 = 0;
this.v = new a(b2);
this.w = new c(b2);
this.x = new d(b2);
this.a = context;
this.b = cVar;
this.c = cVar2;
this.d = kVar;
this.y = runnable;
this.z = runnable2;
this.A = runnable3;
}
@Nullable
private View a(Context context, sg.bigo.ads.ad.a.c cVar, final sg.bigo.ads.api.core.c cVar2, boolean z) {
String str;
String str2;
String str3;
String[] strArr;
String[] strArr2;
String str4;
String str5;
int i;
TextView textView;
TextView textView2;
TextView textView3;
TextView textView4;
TextView textView5;
TextView textView6;
TextView textView7;
TextView textView8;
View view;
String str6;
int i2;
View view2;
int i3;
View view3;
TextView textView9;
TextView textView10;
String str7;
TextView textView11;
TextView textView12;
TextView textView13;
TextView textView14;
View findViewById;
n.a ak;
String l = cVar2.l();
if (TextUtils.isEmpty(l)) {
return null;
}
c.d o = cVar2.o();
if (o != null) {
str = o.a();
str2 = o.b();
str3 = o.c();
String f = o.f();
strArr2 = o.e();
str4 = f;
strArr = o.d();
} else {
str = null;
str2 = null;
str3 = null;
strArr = null;
strArr2 = null;
str4 = null;
}
boolean z2 = cVar2 instanceof sg.bigo.ads.api.core.n;
if (z2) {
sg.bigo.ads.api.core.n nVar = (sg.bigo.ads.api.core.n) cVar2;
if ((TextUtils.isEmpty(str) || !URLUtil.isNetworkUrl(str)) && (ak = nVar.ak()) != null) {
str = ak.c();
}
if (TextUtils.isEmpty(str2)) {
str2 = nVar.q();
}
if (TextUtils.isEmpty(str3)) {
str3 = nVar.r();
}
if (TextUtils.isEmpty(str) || !URLUtil.isNetworkUrl(str)) {
if (nVar.aJ()) {
str = sg.bigo.ads.common.k.b(nVar.aD());
} else {
String aK = nVar.aK();
if (!TextUtils.isEmpty(aK) && URLUtil.isNetworkUrl(aK)) {
str = aK;
}
}
}
}
if (TextUtils.isEmpty(str2)) {
str2 = sg.bigo.ads.common.utils.a.a(context, R.string.bigo_ad_title_default, new Object[0]);
}
String str8 = str2;
if (TextUtils.isEmpty(str3)) {
str3 = sg.bigo.ads.common.utils.a.a(context, R.string.bigo_ad_description_default, new Object[0]);
}
String str9 = str3;
String c2 = (TextUtils.isEmpty(null) || sg.bigo.ads.common.utils.q.a() < 4.0f) ? sg.bigo.ads.ad.a.f.c(l) : null;
String b2 = TextUtils.isEmpty(null) ? sg.bigo.ads.ad.a.f.b(l) : null;
String a2 = TextUtils.isEmpty(null) ? sg.bigo.ads.ad.a.f.a(l) : null;
try {
View a3 = sg.bigo.ads.common.utils.a.a(context, R.layout.bigo_ad_layout_interstitial_mid_page_native_view, null, false);
View findViewById2 = a3 != null ? a3.findViewById(R.id.native_view) : null;
if (findViewById2 != null) {
final AdImageView adImageView = (AdImageView) findViewById2.findViewById(R.id.iv_icon);
String str10 = a2;
TextView textView15 = (TextView) findViewById2.findViewById(R.id.tv_title);
TextView textView16 = (TextView) findViewById2.findViewById(R.id.tv_desc);
TextView textView17 = (TextView) findViewById2.findViewById(R.id.tv_desc_below);
TextView textView18 = (TextView) findViewById2.findViewById(R.id.tv_company_name);
View findViewById3 = findViewById2.findViewById(R.id.ll_start_rate);
TextView textView19 = (TextView) findViewById2.findViewById(R.id.tv_start_rate);
TextView textView20 = (TextView) findViewById2.findViewById(R.id.tv_comment);
TextView textView21 = (TextView) findViewById2.findViewById(R.id.tv_download_num);
View findViewById4 = findViewById2.findViewById(R.id.tv_download_num_desc);
TextView textView22 = (TextView) findViewById2.findViewById(R.id.tv_age);
View findViewById5 = findViewById2.findViewById(R.id.iv_age);
View findViewById6 = findViewById2.findViewById(R.id.btn_cta);
View findViewById7 = findViewById2.findViewById(R.id.btn_cta_inner);
View findViewById8 = findViewById2.findViewById(R.id.tv_gp_info_extra_about);
View findViewById9 = findViewById2.findViewById(R.id.iv_gp_info_extra_arrow);
ViewGroup viewGroup = (ViewGroup) findViewById2.findViewById(R.id.ll_media);
AutoNextLineLinearLayout autoNextLineLinearLayout = (AutoNextLineLinearLayout) findViewById2.findViewById(R.id.fbl_genre);
RoundedFrameLayout roundedFrameLayout = (RoundedFrameLayout) findViewById2.findViewById(R.id.fl_icon);
String str11 = b2;
if (roundedFrameLayout != null) {
roundedFrameLayout.setStrokeWidth(sg.bigo.ads.common.utils.e.a(context, 1));
str5 = c2;
roundedFrameLayout.setStrokeColor(sg.bigo.ads.common.utils.q.b("#05000000", -7829368));
} else {
str5 = c2;
}
int a4 = n.a(cVar, this.w.c);
if (!z || (findViewById = findViewById2.findViewById(R.id.ll_native_extra)) == null) {
i = a4;
} else {
i = a4;
findViewById.setVisibility(0);
}
if (TextUtils.isEmpty(str) || adImageView == null) {
textView = textView15;
textView2 = textView16;
textView3 = textView17;
textView4 = textView18;
textView5 = textView19;
textView6 = textView20;
textView7 = textView21;
textView8 = textView22;
view = findViewById7;
str6 = str11;
i2 = i;
view2 = findViewById2;
} else {
adImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
adImageView.setBackgroundColor(sg.bigo.ads.common.utils.q.b("#FFE1E1E6", -7829368));
adImageView.setImageDrawable(sg.bigo.ads.common.utils.a.a(context, R.drawable.bigo_ad_icon_default_only_icon));
final ArrayList arrayList = new ArrayList();
sg.bigo.ads.common.i.e eVar = new sg.bigo.ads.common.i.e() {
@Override
public final void a(int i4, @NonNull String str12, String str13) {
}
@Override
public final void a(@NonNull Bitmap bitmap, @NonNull sg.bigo.ads.common.i.d dVar) {
adImageView.setBackground(null);
}
};
adImageView.a(eVar);
arrayList.add(eVar);
a(new Runnable() {
@Override
public final void run() {
arrayList.clear();
adImageView.a();
}
});
adImageView.a(str, cVar2.ai());
textView = textView15;
textView2 = textView16;
textView3 = textView17;
textView4 = textView18;
textView5 = textView19;
textView6 = textView20;
textView7 = textView21;
textView8 = textView22;
view = findViewById7;
view2 = findViewById2;
str6 = str11;
i2 = i;
a(findViewById2, adImageView, 1, cVar, cVar);
}
if (!TextUtils.isEmpty(str8) && (textView14 = textView) != null) {
textView14.setText(str8);
a(view2, textView14, 2, cVar, cVar);
}
if (!TextUtils.isEmpty(str9)) {
TextView textView23 = textView2;
if (textView23 != null) {
textView23.setText(str9);
a(view2, textView23, 6, cVar, cVar);
}
if (z && (textView13 = textView3) != null) {
textView13.setText(str9);
a(view2, textView13, 6, cVar, cVar);
}
}
if (TextUtils.isEmpty(str4) || (textView12 = textView4) == null) {
i3 = i2;
} else {
textView12.setVisibility(0);
textView12.setText(str4);
i3 = i2;
textView12.setTextColor(i3);
a(view2, textView12, 26, cVar, cVar);
}
if (!TextUtils.isEmpty(str5) && (textView11 = textView5) != null) {
textView11.setText(str5);
a(view2, textView11, 26, cVar, cVar);
}
if (findViewById3 != null) {
a(view2, findViewById3, 26, cVar, cVar);
}
if (!TextUtils.isEmpty(str6) && (str7 = str6) != null) {
StringBuilder HKS = tSHz11.HKS(str7, " ");
HKS.append(sg.bigo.ads.common.utils.a.a(context, R.string.bigo_ad_comment_num_text, new Object[0]));
TextView textView24 = textView6;
textView24.setText(HKS.toString());
a(view2, textView24, 26, cVar, cVar);
}
if (!TextUtils.isEmpty(str10) && (textView10 = textView7) != null) {
textView10.setText(str10);
a(view2, textView10, 26, cVar, cVar);
}
if (findViewById4 != null) {
a(view2, findViewById4, 26, cVar, cVar);
}
if (!TextUtils.isEmpty("Everyone") && (textView9 = textView8) != null) {
textView9.setText("Everyone");
a(view2, textView9, 26, cVar, cVar);
}
if (findViewById5 != null) {
a(view2, findViewById5, 26, cVar, cVar);
}
if (findViewById6 != null) {
View view4 = view;
if (view4 != null) {
view4.setBackgroundColor(i3);
}
a(view2, findViewById6, 7, cVar, cVar);
}
if (z && strArr2 != null && strArr2.length > 0 && viewGroup != null) {
a(context, viewGroup, cVar, cVar2, strArr2);
}
if (z || !z2) {
view3 = view2;
} else {
view3 = view2;
RoundedFrameLayout roundedFrameLayout2 = (RoundedFrameLayout) view3.findViewById(R.id.ll_fallback_media);
boolean z3 = false;
if (roundedFrameLayout2 != null) {
roundedFrameLayout2.setVisibility(0);
}
final AdImageView adImageView2 = (AdImageView) view3.findViewById(R.id.iv_fallback_media);
if (adImageView2 != null) {
sg.bigo.ads.api.core.n nVar2 = (sg.bigo.ads.api.core.n) cVar2;
final String aK2 = nVar2.aK();
if (TextUtils.isEmpty(aK2) || !URLUtil.isNetworkUrl(aK2)) {
if (nVar2.aJ()) {
aK2 = sg.bigo.ads.common.k.b(nVar2.aD());
if (!TextUtils.isEmpty(aK2)) {
z3 = true;
}
}
aK2 = null;
}
if (!TextUtils.isEmpty(aK2)) {
final ArrayList arrayList2 = new ArrayList();
if (!z3) {
this.x.a(cVar2, 4, aK2, -1);
}
sg.bigo.ads.common.i.e eVar2 = new sg.bigo.ads.common.i.e() {
@Override
public final void a(int i4, @NonNull String str12, String str13) {
l.this.x.a(cVar2, 4, aK2, -1, i4, str12);
}
@Override
public final void a(@NonNull Bitmap bitmap, @NonNull sg.bigo.ads.common.i.d dVar) {
l.this.x.b(cVar2, 4, aK2, -1);
}
};
adImageView2.a(eVar2);
arrayList2.add(eVar2);
a(new Runnable() {
@Override
public final void run() {
arrayList2.clear();
adImageView2.a();
}
});
roundedFrameLayout2.setStrokeWidth(sg.bigo.ads.common.utils.e.a(context, 1));
roundedFrameLayout2.setStrokeColor(sg.bigo.ads.common.utils.q.b("#08000000", -7829368));
adImageView2.a(aK2, cVar2.ai());
a aVar = this.v;
a(view3, adImageView2, 5, cVar, aVar.c ? cVar : aVar.r);
}
}
}
if (strArr != null && strArr.length > 0 && autoNextLineLinearLayout != null) {
a(context, view3, cVar, autoNextLineLinearLayout, strArr);
}
if (findViewById8 != null) {
a aVar2 = this.v;
a(view3, findViewById8, 27, cVar, aVar2.b ? cVar : aVar2.r);
}
if (findViewById9 != null) {
a aVar3 = this.v;
a(view3, findViewById9, 27, cVar, aVar3.b ? cVar : aVar3.r);
}
a aVar4 = this.v;
a(view3, view3, 18, cVar, aVar4.b ? cVar : aVar4.r);
}
return a3;
} catch (Throwable unused) {
return null;
}
}
@NonNull
private FrameLayout a(@NonNull Context context, @NonNull View view, boolean z) {
int i;
FrameLayout frameLayout = new FrameLayout(context);
int i2 = this.w.b;
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, z ? -1 : -2);
if (i2 == 1) {
int a2 = sg.bigo.ads.common.utils.e.a(context, 10);
layoutParams.topMargin = a2;
layoutParams.bottomMargin = a2;
layoutParams.leftMargin = a2;
layoutParams.rightMargin = a2;
i = 17;
} else {
layoutParams.topMargin = sg.bigo.ads.common.utils.e.a(context, 40);
i = 80;
}
layoutParams.gravity = i;
frameLayout.addView(view, layoutParams);
return frameLayout;
}
@NonNull
private static LinearLayout a(Context context, View view, int i) {
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setBackgroundColor(sg.bigo.ads.common.utils.q.b("#F0F3F4", -7829368));
ImageView imageView = new ImageView(context);
imageView.setId(R.id.btn_close);
imageView.setImageDrawable(sg.bigo.ads.common.utils.a.a(context, R.drawable.bigo_ad_ic_close_gray_light));
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(context, 24), sg.bigo.ads.common.utils.e.a(context, 24), 21);
layoutParams.rightMargin = sg.bigo.ads.common.utils.e.a(context, 20);
frameLayout.addView(imageView, layoutParams);
linearLayout.addView(frameLayout, new LinearLayout.LayoutParams(-1, sg.bigo.ads.common.utils.e.a(context, 48)));
linearLayout.addView(view, new LinearLayout.LayoutParams(-1, i));
return linearLayout;
}
private void a(@NonNull Context context, View view, sg.bigo.ads.ad.a.c cVar, @NonNull AutoNextLineLinearLayout autoNextLineLinearLayout, @NonNull String[] strArr) {
for (String str : strArr) {
try {
if (!TextUtils.isEmpty(str)) {
TextView textView = new TextView(context);
textView.setText(str);
textView.setTextColor(sg.bigo.ads.common.utils.q.b("#5F6367", -7829368));
textView.setTextSize(13.0f);
textView.setPadding(sg.bigo.ads.common.utils.e.a(context, 12), sg.bigo.ads.common.utils.e.a(context, 5), sg.bigo.ads.common.utils.e.a(context, 12), sg.bigo.ads.common.utils.e.a(context, 5));
textView.setGravity(17);
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(0);
gradientDrawable.setColor(-1);
gradientDrawable.setStroke(sg.bigo.ads.common.utils.e.a(context, 1), sg.bigo.ads.common.utils.q.b("#DBDDE0", -7829368));
gradientDrawable.setCornerRadius(sg.bigo.ads.common.utils.e.a(context, 14));
textView.setBackground(gradientDrawable);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, sg.bigo.ads.common.utils.e.a(context, 28));
layoutParams.topMargin = sg.bigo.ads.common.utils.e.a(context, 12);
layoutParams.rightMargin = sg.bigo.ads.common.utils.e.a(context, 12);
a(view, textView, 27, cVar, cVar);
autoNextLineLinearLayout.addView(textView, layoutParams);
}
} catch (Exception unused) {
return;
}
}
}
private void a(@NonNull Context context, ViewGroup viewGroup, sg.bigo.ads.ad.a.c cVar, @NonNull final sg.bigo.ads.api.core.c cVar2, @NonNull String[] strArr) {
String[] strArr2;
?? r6;
String[] strArr3 = strArr;
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
final ArrayList arrayList = new ArrayList();
int i = 0;
while (i < strArr3.length) {
final String str = strArr3[i];
if (TextUtils.isEmpty(str) || !URLUtil.isNetworkUrl(str)) {
strArr2 = strArr3;
r6 = linearLayout;
} else {
final int a2 = sg.bigo.ads.common.utils.e.a(context, 200);
final RoundedFrameLayout roundedFrameLayout = new RoundedFrameLayout(context);
roundedFrameLayout.setCornerRadius(sg.bigo.ads.common.utils.e.a(context, 4));
roundedFrameLayout.setStrokeWidth(sg.bigo.ads.common.utils.e.a(context, 1));
roundedFrameLayout.setStrokeColor(sg.bigo.ads.common.utils.q.b("#08000000", -7829368));
final AdImageView adImageView = new AdImageView(context);
adImageView.setBackgroundColor(sg.bigo.ads.common.utils.q.b("#FFE1E1E6", -7829368));
adImageView.setImageDrawable(sg.bigo.ads.common.utils.a.a(context, R.drawable.bigo_ad_icon_default_only_icon));
this.x.a(cVar2, 2, str, i);
LinearLayout linearLayout2 = linearLayout;
final int i2 = i;
sg.bigo.ads.common.i.e eVar = new sg.bigo.ads.common.i.e() {
@Override
public final void a(int i3, @NonNull String str2, String str3) {
l.this.x.a(cVar2, 2, str, i2, i3, str2);
}
@Override
public final void a(@NonNull Bitmap bitmap, @NonNull sg.bigo.ads.common.i.d dVar) {
ViewGroup.LayoutParams layoutParams;
adImageView.setBackground(null);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
if (width > 0 && height > 0 && (layoutParams = roundedFrameLayout.getLayoutParams()) != null) {
layoutParams.width = (width * a2) / height;
}
adImageView.setScaleType(ImageView.ScaleType.FIT_XY);
l.this.x.b(cVar2, 2, str, i2);
}
};
adImageView.a(eVar);
arrayList.add(eVar);
a(new Runnable() {
@Override
public final void run() {
adImageView.a();
}
});
adImageView.a(str, cVar2.ai());
roundedFrameLayout.addView(adImageView, new FrameLayout.LayoutParams(-1, -1));
a aVar = this.v;
a(viewGroup, roundedFrameLayout, 5, cVar, aVar.c ? cVar : aVar.r);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(context, 100), a2);
layoutParams.leftMargin = i == 0 ? sg.bigo.ads.common.utils.e.a(context, 20) : sg.bigo.ads.common.utils.e.a(context, 12);
strArr2 = strArr;
if (i + 1 == strArr2.length) {
layoutParams.rightMargin = sg.bigo.ads.common.utils.e.a(context, 20);
}
r6 = linearLayout2;
r6.addView(roundedFrameLayout, layoutParams);
}
a(new Runnable() {
@Override
public final void run() {
arrayList.clear();
}
});
i++;
strArr3 = strArr2;
linearLayout = r6;
}
LinearLayout linearLayout3 = linearLayout;
a aVar2 = this.v;
a(viewGroup, viewGroup, 18, cVar, aVar2.d ? cVar : aVar2.r);
viewGroup.addView(linearLayout3);
}
public void a(@NonNull View view, @NonNull View view2, int i, @NonNull sg.bigo.ads.ad.a.c cVar, @Nullable sg.bigo.ads.core.adview.g gVar) {
a aVar = this.v;
aVar.a(cVar, view, view2, i, aVar.a(cVar, gVar));
}
private void a(@NonNull Runnable runnable) {
this.L.add(runnable);
}
public static void a(l lVar, final Context context, final sg.bigo.ads.ad.a.c cVar, final sg.bigo.ads.api.core.c cVar2, int i) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Notify mid page content view render failed, try next render way.");
lVar.n = i;
sg.bigo.ads.common.g.c.b(new Runnable() {
@Override
public final void run() {
l.a(l.this, context, cVar, cVar2);
}
});
}
@UiThread
private void a(sg.bigo.ads.api.core.c cVar) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "All render way failed.");
this.h = true;
sg.bigo.ads.core.c.a.a(cVar, "0", d.a(this.m, this.l), this.n);
d();
}
@NonNull
private FrameLayout b(@NonNull Context context, @NonNull View view, boolean z) {
int i = this.w.b;
RoundedFrameLayout roundedFrameLayout = new RoundedFrameLayout(context);
if (i == 1) {
roundedFrameLayout.setCornerRadius(sg.bigo.ads.common.utils.e.a(context, 12));
} else {
roundedFrameLayout.a(sg.bigo.ads.common.utils.e.a(context, 12), sg.bigo.ads.common.utils.e.a(context, 12), sg.bigo.ads.common.utils.e.a(context, 0), sg.bigo.ads.common.utils.e.a(context, 0));
}
roundedFrameLayout.addView(view, new FrameLayout.LayoutParams(-1, z ? -1 : -2));
return roundedFrameLayout;
}
public static void b(l lVar) {
lVar.r = null;
lVar.s = null;
}
@UiThread
private boolean b(@NonNull FrameLayout frameLayout) {
int i;
final View findViewById = frameLayout.findViewById(R.id.btn_close);
if (findViewById == null) {
return false;
}
findViewById.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
l.this.d();
}
});
sg.bigo.ads.api.a.k kVar = this.d;
if (kVar != null) {
i = kVar.a("mid_page.force_staying_time");
if (i < 0 || i > 5) {
i = 3;
}
} else {
i = 0;
}
if (i == 0) {
findViewById.setVisibility(0);
return true;
}
findViewById.setVisibility(4);
sg.bigo.ads.common.g.c.a(2, new Runnable() {
@Override
public final void run() {
findViewById.setVisibility(0);
}
}, i * 1000);
return true;
}
private void h() {
Runnable runnable;
if (this.u.a) {
if ((this.E || this.j) && this.F && (runnable = this.A) != null) {
runnable.run();
this.A = null;
}
}
}
private boolean i() {
return (!this.g || this.E || this.i) ? false : true;
}
public final void a() {
if (this.K != null || this.G <= 0) {
return;
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
l lVar = l.this;
lVar.h = true;
lVar.g();
}
};
this.K = runnable;
sg.bigo.ads.common.g.c.a(2, runnable, this.G);
}
public final void a(int i, boolean z) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Notify mid page content view rendered.");
this.D = true;
this.m = i;
this.l = z;
if (this.j) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Loading page is showing, turn to show mid page.");
sg.bigo.ads.common.g.c.a(2, new Runnable() {
@Override
public final void run() {
l.a(l.this);
}
});
}
}
public final void a(long j) {
Runnable runnable = this.r;
this.I = SystemClock.elapsedRealtime();
sg.bigo.ads.common.g.c.a(runnable);
sg.bigo.ads.common.g.c.a(2, runnable, j);
}
@UiThread
public final void a(@NonNull Context context, sg.bigo.ads.api.core.c cVar, @NonNull final FrameLayout frameLayout) {
boolean a2 = a(frameLayout);
if ((cVar instanceof sg.bigo.ads.api.core.n) && this.o == 0) {
long elapsedRealtime = SystemClock.elapsedRealtime();
this.o = elapsedRealtime;
((sg.bigo.ads.api.core.n) cVar).b(elapsedRealtime);
}
sg.bigo.ads.core.c.a.a(cVar, "1", d.a(this.m, this.l), this.n);
AlertDialog create = new AlertDialog.Builder(context).setCancelable(!a2).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
l lVar = l.this;
lVar.i = true;
lVar.j = false;
}
}).create();
create.requestWindowFeature(1);
create.show();
Window window = create.getWindow();
window.getDecorView().setPadding(0, 0, 0, 0);
window.setGravity(17);
window.setContentView(frameLayout);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = -1;
attributes.height = -1;
window.setAttributes(attributes);
this.B = create;
frameLayout.setVisibility(4);
frameLayout.post(new Runnable() {
@Override
public final void run() {
int i = l.this.w.b;
frameLayout.setVisibility(0);
if (i == 1) {
sg.bigo.ads.ad.interstitial.b.d(frameLayout);
} else {
sg.bigo.ads.ad.interstitial.b.a(frameLayout, 400L, new b.a());
}
}
});
Runnable runnable = this.y;
if (runnable != null) {
runnable.run();
this.y = null;
this.F = true;
}
}
public final boolean a(Context context, sg.bigo.ads.ad.a.c cVar, sg.bigo.ads.api.core.c cVar2, sg.bigo.ads.api.a.k kVar) {
String str;
if (context == null) {
str = "Invalid context.";
} else if (cVar == null) {
str = "Invalid native ad.";
} else if (cVar2 == null) {
str = "Invalid adData.";
} else if (kVar == null) {
str = "Invalid style config.";
} else {
if (!this.E) {
return true;
}
str = "Mid page has been shown.";
}
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", str);
return false;
}
@UiThread
public final boolean a(@NonNull FrameLayout frameLayout) {
final View findViewById = frameLayout.findViewById(R.id.btn_cta);
if (findViewById != null && this.v.e) {
sg.bigo.ads.ad.interstitial.b.e(findViewById);
a(new Runnable() {
@Override
public final void run() {
findViewById.clearAnimation();
}
});
}
return b(frameLayout);
}
public final void b() {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Mid page resume.");
if (this.k) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Dismiss page after click.");
sg.bigo.ads.common.g.c.a(2, new Runnable() {
@Override
public final void run() {
l.this.e();
}
});
} else if (this.J && this.q > 0 && this.r != null) {
this.J = false;
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", KHS1Kz.KtH1t1(new StringBuilder("Resume show task for "), this.q, " ms."));
a(this.q);
}
}
public final void c() {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Mid page pause.");
Runnable runnable = this.r;
if (this.J || this.q <= 0 || runnable == null) {
return;
}
this.J = true;
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Pause show task.");
sg.bigo.ads.common.g.c.a(runnable);
this.q -= SystemClock.elapsedRealtime() - this.I;
}
public final void d() {
int i = this.w.b;
final FrameLayout frameLayout = this.j ? this.f : this.e;
if (frameLayout == null) {
e();
return;
}
b.a aVar = new b.a() {
@Override
public final void onAnimationEnd(Animation animation) {
frameLayout.clearAnimation();
frameLayout.setVisibility(8);
l.this.e();
}
};
if (i != 1) {
sg.bigo.ads.ad.interstitial.b.b(frameLayout, aVar);
return;
}
AnimationSet animationSet = new AnimationSet(true);
Interpolator a2 = sg.bigo.ads.common.utils.b.a(2);
AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
alphaAnimation.setDuration(200L);
alphaAnimation.setInterpolator(a2);
animationSet.addAnimation(alphaAnimation);
ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.1f, 1.0f, 0.1f, 1, 0.5f, 1, 0.5f);
scaleAnimation.setDuration(300L);
alphaAnimation.setInterpolator(a2);
animationSet.addAnimation(scaleAnimation);
animationSet.setAnimationListener(aVar);
frameLayout.startAnimation(animationSet);
}
public final void e() {
if (this.B != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Dismiss mid page.");
this.B.dismiss();
this.B = null;
f();
h();
}
g();
}
public final void f() {
Runnable runnable;
if (!this.F || (runnable = this.z) == null) {
return;
}
runnable.run();
this.y = null;
}
public final void g() {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Mid page clean unused resource.");
Iterator<Runnable> it = this.L.iterator();
while (it.hasNext()) {
it.next().run();
}
this.L.clear();
Runnable runnable = this.r;
if (runnable != null) {
sg.bigo.ads.common.g.c.a(runnable);
}
Runnable runnable2 = this.K;
if (runnable2 != null) {
sg.bigo.ads.common.g.c.a(runnable2);
}
this.r = null;
this.s = null;
this.i = true;
this.e = null;
}
public static void a(l lVar, final Context context, final sg.bigo.ads.ad.a.c cVar, final sg.bigo.ads.api.core.c cVar2) {
int i;
String[] e;
boolean z;
String str;
sg.bigo.ads.core.g.e a2;
d dVar;
int i2 = 0;
int i3 = 0;
while (!lVar.D) {
if (i3 > 10) {
lVar.a(cVar2);
return;
}
int i4 = lVar.H;
List<Integer> list = lVar.p;
if (list == null || i4 >= list.size()) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", K1zS1t1.tzttS1SS1("Failed to retrieve render way for index: ", i4, "."));
lVar.a(cVar2);
return;
}
Integer num = list.get(i4);
lVar.H++;
int intValue = num.intValue();
View view = null;
if (intValue == 1) {
sg.bigo.ads.common.l.a.a(i2, 3, "InterstitialMidPageRenderer", "Start to render web view for mid page.");
String m = cVar2.m();
if (TextUtils.isEmpty(m) || !URLUtil.isNetworkUrl(m)) {
m = null;
}
if (TextUtils.isEmpty(m)) {
String l = cVar2.l();
if (!TextUtils.isEmpty(l)) {
str = "https://play.google.com/store/apps/details?id=".concat(String.valueOf(l));
z = 1;
if (!TextUtils.isEmpty(str) && (a2 = sg.bigo.ads.core.g.e.a(context)) != null) {
lVar.a(a2, a2, 28, cVar, cVar);
final boolean z2 = z;
a2.setWebViewClient(new sg.bigo.ads.core.g.d() {
boolean a = false;
@Override
public final void a(RenderProcessGoneDetail renderProcessGoneDetail) {
sg.bigo.ads.core.c.a.a(AuthApiStatusCodes.AUTH_API_CLIENT_ERROR, 10105, "[MidPage] The render process was gone.");
if (this.a) {
return;
}
this.a = true;
l.a(l.this, context, cVar, cVar2, 1);
l.this.x.a(cVar2, z2, -1, "onRenderProcessGone");
}
@Override
public final void onPageFinished(WebView webView, String str2) {
super.onPageFinished(webView, str2);
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onPageFinished ".concat(String.valueOf(str2)));
if (this.a) {
return;
}
this.a = true;
l.this.a(1, z2);
d dVar2 = l.this.x;
sg.bigo.ads.api.core.c cVar3 = cVar2;
boolean z3 = z2;
if (dVar2.b || dVar2.a <= 0) {
return;
}
dVar2.b = true;
sg.bigo.ads.core.c.a.a(cVar3, d.a(1, z3), 3, (String) null, SystemClock.elapsedRealtime() - dVar2.a, false, 0, (String) null);
}
@Override
public final void onPageStarted(WebView webView, String str2, Bitmap bitmap) {
super.onPageStarted(webView, str2, bitmap);
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onPageStarted ".concat(String.valueOf(str2)));
}
@Override
public final void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
d dVar2;
sg.bigo.ads.api.core.c cVar3;
int i5;
boolean z3;
super.onReceivedError(webView, webResourceRequest, webResourceError);
String str2 = "onReceivedError";
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onReceivedError");
if (this.a) {
return;
}
this.a = true;
l.a(l.this, context, cVar, cVar2, 1);
if (webResourceError == null) {
dVar2 = l.this.x;
cVar3 = cVar2;
z3 = z2;
i5 = -1;
} else {
CharSequence description = webResourceError.getDescription();
d dVar3 = l.this.x;
sg.bigo.ads.api.core.c cVar4 = cVar2;
boolean z4 = z2;
int errorCode = webResourceError.getErrorCode();
str2 = description == null ? AbstractJsonLexerKt.NULL : description.toString();
dVar2 = dVar3;
cVar3 = cVar4;
i5 = errorCode;
z3 = z4;
}
dVar2.a(cVar3, z3, i5, str2);
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str2) {
return true;
}
});
dVar = lVar.x;
if (dVar.a <= 0) {
dVar.a = SystemClock.elapsedRealtime();
sg.bigo.ads.core.c.a.a(cVar2, d.a(1, z), 1, (String) null, 0L, false, 0, (String) null);
}
a2.loadUrl(str);
view = a(context, a2, -2);
}
}
}
z = i2;
str = m;
if (!TextUtils.isEmpty(str)) {
lVar.a(a2, a2, 28, cVar, cVar);
final boolean z22 = z;
a2.setWebViewClient(new sg.bigo.ads.core.g.d() {
boolean a = false;
@Override
public final void a(RenderProcessGoneDetail renderProcessGoneDetail) {
sg.bigo.ads.core.c.a.a(AuthApiStatusCodes.AUTH_API_CLIENT_ERROR, 10105, "[MidPage] The render process was gone.");
if (this.a) {
return;
}
this.a = true;
l.a(l.this, context, cVar, cVar2, 1);
l.this.x.a(cVar2, z22, -1, "onRenderProcessGone");
}
@Override
public final void onPageFinished(WebView webView, String str2) {
super.onPageFinished(webView, str2);
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onPageFinished ".concat(String.valueOf(str2)));
if (this.a) {
return;
}
this.a = true;
l.this.a(1, z22);
d dVar2 = l.this.x;
sg.bigo.ads.api.core.c cVar3 = cVar2;
boolean z3 = z22;
if (dVar2.b || dVar2.a <= 0) {
return;
}
dVar2.b = true;
sg.bigo.ads.core.c.a.a(cVar3, d.a(1, z3), 3, (String) null, SystemClock.elapsedRealtime() - dVar2.a, false, 0, (String) null);
}
@Override
public final void onPageStarted(WebView webView, String str2, Bitmap bitmap) {
super.onPageStarted(webView, str2, bitmap);
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onPageStarted ".concat(String.valueOf(str2)));
}
@Override
public final void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
d dVar2;
sg.bigo.ads.api.core.c cVar3;
int i5;
boolean z3;
super.onReceivedError(webView, webResourceRequest, webResourceError);
String str2 = "onReceivedError";
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "onReceivedError");
if (this.a) {
return;
}
this.a = true;
l.a(l.this, context, cVar, cVar2, 1);
if (webResourceError == null) {
dVar2 = l.this.x;
cVar3 = cVar2;
z3 = z22;
i5 = -1;
} else {
CharSequence description = webResourceError.getDescription();
d dVar3 = l.this.x;
sg.bigo.ads.api.core.c cVar4 = cVar2;
boolean z4 = z22;
int errorCode = webResourceError.getErrorCode();
str2 = description == null ? AbstractJsonLexerKt.NULL : description.toString();
dVar2 = dVar3;
cVar3 = cVar4;
i5 = errorCode;
z3 = z4;
}
dVar2.a(cVar3, z3, i5, str2);
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str2) {
return true;
}
});
dVar = lVar.x;
if (dVar.a <= 0) {
}
a2.loadUrl(str);
view = a(context, a2, -2);
}
} else if (intValue == 2) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Start to render native view for mid page.");
c.d o = cVar2.o();
if (o != null && (e = o.e()) != null && e.length > 0 && (view = lVar.a(context, cVar, cVar2, true)) != null) {
lVar.a(2, false);
}
} else {
if (intValue == 3) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Start to render image view for mid page.");
final String n = cVar2.n();
if (!TextUtils.isEmpty(n) && URLUtil.isNetworkUrl(n)) {
final ImageView imageView = new ImageView(context);
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setBackgroundColor(-1);
frameLayout.addView(imageView, new FrameLayout.LayoutParams(-1, -1, 17));
RoundedFrameLayout roundedFrameLayout = new RoundedFrameLayout(context);
roundedFrameLayout.setId(R.id.btn_close);
roundedFrameLayout.setCornerRadius(sg.bigo.ads.common.utils.e.a(context, 12));
View view2 = new View(context);
view2.setBackgroundColor(sg.bigo.ads.common.utils.q.b("#33000000", -7829368));
roundedFrameLayout.addView(view2, new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(context, 24), sg.bigo.ads.common.utils.e.a(context, 24), 17));
ImageView imageView2 = new ImageView(context);
imageView2.setBackground(sg.bigo.ads.common.utils.a.a(context, R.drawable.bigo_ad_ic_close));
roundedFrameLayout.addView(imageView2, new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(context, 12), sg.bigo.ads.common.utils.e.a(context, 12), 17));
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(context, 24), sg.bigo.ads.common.utils.e.a(context, 24), 53);
layoutParams.topMargin = sg.bigo.ads.common.utils.e.a(context, 18);
layoutParams.rightMargin = sg.bigo.ads.common.utils.e.a(context, 22);
frameLayout.addView(roundedFrameLayout, layoutParams);
final FrameLayout b2 = lVar.b(context, frameLayout, true);
final FrameLayout frameLayout2 = new FrameLayout(context);
frameLayout2.addView(b2, new FrameLayout.LayoutParams(-1, -2, lVar.w.b != 1 ? 80 : 17));
lVar.x.a(cVar2, 3, n, 100);
i = i3;
sg.bigo.ads.common.i.c.a(n, cVar2.ai(), new sg.bigo.ads.common.i.e() {
@Override
public final void a(int i5, @NonNull String str2, String str3) {
l.a(l.this, context, cVar, cVar2, 2);
l.this.x.a(cVar2, 3, n, 100, i5, str2);
}
@Override
public final void a(@NonNull Bitmap bitmap, @NonNull sg.bigo.ads.common.i.d dVar2) {
final int width = bitmap.getWidth();
final int height = bitmap.getHeight();
frameLayout2.post(new Runnable() {
@Override
public final void run() {
int i5;
int i6;
int width2 = frameLayout2.getWidth();
int height2 = frameLayout2.getHeight();
ViewGroup.LayoutParams layoutParams2 = imageView.getLayoutParams();
if (width2 <= 0 || height2 <= 0 || (i5 = width) <= 0 || (i6 = height) <= 0) {
layoutParams2.width = -1;
layoutParams2.height = -1;
return;
}
if ((i5 * 1.0f) / i6 > (width2 * 1.0f) / height2) {
layoutParams2.width = width2;
layoutParams2.height = (width2 * i6) / i5;
} else {
layoutParams2.width = (i5 * height2) / i6;
layoutParams2.height = height2;
}
imageView.requestLayout();
}
});
imageView.setImageBitmap(bitmap);
l lVar2 = l.this;
FrameLayout frameLayout3 = b2;
ImageView imageView3 = imageView;
sg.bigo.ads.ad.a.c cVar3 = cVar;
a aVar = lVar2.v;
lVar2.a(frameLayout3, imageView3, 5, cVar3, aVar.c ? cVar3 : aVar.r);
l lVar3 = l.this;
FrameLayout frameLayout4 = b2;
sg.bigo.ads.ad.a.c cVar4 = cVar;
a aVar2 = lVar3.v;
lVar3.a(frameLayout4, frameLayout4, 18, cVar4, aVar2.d ? cVar4 : aVar2.r);
l.this.a(3, false);
l.this.x.b(cVar2, 3, n, 100);
}
});
view = frameLayout2;
}
} else {
i = i3;
if (intValue == 4) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Start to render fallback view for mid page.");
View a3 = lVar.a(context, cVar, cVar2, false);
if (a3 != null) {
lVar.a(4, false);
}
view = a3;
} else {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Error content view id.");
}
}
if (view == null) {
lVar.C = view;
return;
} else {
i3 = i + 1;
i2 = 0;
}
}
i = i3;
if (view == null) {
}
}
sg.bigo.ads.common.l.a.a(i2, 3, "InterstitialMidPageRenderer", "Failed to retrieve render way for already.");
}
public static boolean a(l lVar) {
String str;
final Context context = lVar.a;
final sg.bigo.ads.ad.a.c cVar = lVar.b;
final sg.bigo.ads.api.core.c cVar2 = lVar.c;
if (lVar.a(context, cVar, cVar2, lVar.d)) {
final int i = lVar.m;
final boolean z = lVar.l;
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Try show mid page.");
View view = lVar.C;
boolean z2 = lVar.D;
boolean z3 = lVar.h;
if (z2 && view != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", SHKSt1z.t1H1KH1K(new StringBuilder("Show mid page content, render way: "), i != 1 ? i != 2 ? i != 3 ? i != 4 ? i != 5 ? "UNKNOWN" : "LOADING" : "FALLBACK" : "IMAGE" : "NATIVE" : "WEB_VIEW", "."));
if (lVar.i()) {
boolean z4 = lVar.m == 3;
final FrameLayout a2 = lVar.a(context, lVar.b(context, view, z4), z4);
lVar.E = true;
if (cVar2 instanceof sg.bigo.ads.api.core.n) {
((sg.bigo.ads.api.core.n) cVar2).g(d.a(i, z));
}
sg.bigo.ads.common.g.c.b(new Runnable() {
@Override
public final void run() {
l lVar2 = l.this;
Context context2 = context;
sg.bigo.ads.api.core.c cVar3 = cVar2;
FrameLayout frameLayout = a2;
if (!lVar2.j) {
lVar2.a(context2, cVar3, frameLayout);
lVar2.e = frameLayout;
return;
}
FrameLayout frameLayout2 = lVar2.f;
if (frameLayout2 != null) {
frameLayout2.removeAllViews();
lVar2.a(frameLayout);
frameLayout2.addView(frameLayout, new FrameLayout.LayoutParams(-1, -1));
}
lVar2.e = frameLayout2;
lVar2.j = false;
if ((cVar3 instanceof sg.bigo.ads.api.core.n) && lVar2.o == 0) {
long elapsedRealtime = SystemClock.elapsedRealtime();
lVar2.o = elapsedRealtime;
((sg.bigo.ads.api.core.n) cVar3).b(elapsedRealtime);
}
sg.bigo.ads.core.c.a.a(cVar3, "1", d.a(lVar2.m, lVar2.l), lVar2.n);
}
});
}
return true;
}
if (z3) {
str = "Failed to show mid page due to unavailable.";
} else {
if (!z2 && view != null) {
sg.bigo.ads.common.l.a.a(0, 3, "InterstitialMidPageRenderer", "Show mid page loading.");
if (lVar.i()) {
final FrameLayout frameLayout = new FrameLayout(context);
View a3 = sg.bigo.ads.common.utils.a.a(context, R.layout.bigo_ad_layout_interstitial_mid_page_loading_view, null, false);
if (a3 != null) {
lVar.j = true;
FrameLayout a4 = lVar.a(context, (View) lVar.b(context, a(context, a3, -1), true), true);
frameLayout.addView(a4, new FrameLayout.LayoutParams(-1, -1));
a aVar = lVar.v;
lVar.a(a3, a3, 18, cVar, aVar.b ? cVar : aVar.r);
a aVar2 = lVar.v;
lVar.a(a4, a4, 18, cVar, aVar2.b ? cVar : aVar2.r);
lVar.f = frameLayout;
if (cVar2 instanceof sg.bigo.ads.api.core.n) {
((sg.bigo.ads.api.core.n) cVar2).g(6);
}
lVar.m = 5;
sg.bigo.ads.common.g.c.b(new Runnable() {
@Override
public final void run() {
l.this.a(context, cVar2, frameLayout);
}
});
}
}
return true;
}
str = "Failed to show mid page due to unknown reason.";
}
sg.bigo.ads.common.l.a.a(0, "InterstitialMidPageRenderer", str);
}
return false;
}
}