package com.ironsource; import android.text.TextUtils; import android.view.View; import android.widget.FrameLayout; import com.ironsource.environment.ContextProvider; import com.ironsource.k7; import com.ironsource.mediationsdk.IronSource; import com.ironsource.mediationsdk.IronSourceBannerLayout; import com.ironsource.mediationsdk.adunit.adapter.internal.AdapterBannerInterface; import com.ironsource.mediationsdk.adunit.adapter.internal.AdapterBindAdViewInterface; import com.ironsource.mediationsdk.adunit.adapter.internal.BaseAdAdapter; import com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdViewListener; import com.ironsource.mediationsdk.adunit.adapter.listener.BannerAdListener; import com.ironsource.mediationsdk.adunit.adapter.utility.AdData; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.mediationsdk.model.Placement; import java.util.Map; /* loaded from: classes2.dex */ public class d6 extends k7 implements BannerAdListener, w1 { public static final String t = "bannerLayout"; public static final String u = "bannerSize"; private final IronSourceBannerLayout r; private final boolean s; public class a extends yp { final /* synthetic */ View a; final /* synthetic */ FrameLayout.LayoutParams b; public a(View view, FrameLayout.LayoutParams layoutParams) { this.a = view; this.b = layoutParams; } @Override // com.ironsource.yp public void a() { d6.this.a(this.a, this.b); } } public class b extends yp { public b() { } @Override // com.ironsource.yp public void a() { d6.this.J(); } } public d6(ko koVar, i1 i1Var, BaseAdAdapter baseAdAdapter, IronSourceBannerLayout ironSourceBannerLayout, Placement placement, boolean z, f5 f5Var, o1 o1Var) { super(koVar, i1Var, baseAdAdapter, new v2(i1Var.g(), i1Var.g().getBannerSettings(), IronSource.AD_UNIT.BANNER), f5Var, o1Var); this.r = ironSourceBannerLayout; this.g = placement; this.s = z; } /* JADX INFO: Access modifiers changed from: private */ public void J() { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose(d()); if (y()) { super.onAdOpened(); return; } if (this.e == k7.h.FAILED) { return; } ironLog.error(String.format("unexpected onAdOpened for %s, state - %s", k(), this.e)); if (this.d != null) { this.d.k.o(String.format("unexpected onAdOpened, state - %s", this.e)); } } /* JADX INFO: Access modifiers changed from: private */ public void a(View view, FrameLayout.LayoutParams layoutParams) { Listener listener; super.onAdLoadSuccess(); if (!y() || (listener = this.b) == 0) { return; } ((o1) listener).a(this, view, layoutParams); } @Override // com.ironsource.k7 public void G() { Object obj = this.c; if (obj instanceof AdapterBannerInterface) { ((AdapterBannerInterface) obj).loadAd(this.k, ContextProvider.getInstance().getCurrentActiveActivity(), this.r.getSize(), this); } else { IronLog.INTERNAL.error(a("adapter not instance of AdapterBannerInterface")); } } @Override // com.ironsource.k7 public boolean O() { return false; } public void P() { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose(k()); a(k7.h.NONE); Object obj = this.c; if (obj == null) { ironLog.warning("mAdapter == null"); return; } try { if (obj instanceof AdapterBannerInterface) { ((AdapterBannerInterface) obj).destroyAd(this.k); } else { ironLog.error(a("adapter not instance of AdapterBannerInterface")); } } catch (Throwable th) { i9.d().a(th); String str = "destroyBanner - exception = " + th.getLocalizedMessage() + " state = " + this.e; IronLog.INTERNAL.error(a(str)); x1 x1Var = this.d; if (x1Var != null) { x1Var.k.f(str); } } x1 x1Var2 = this.d; if (x1Var2 != null) { x1Var2.g.a(r().intValue()); } } public void Q() { Object obj = this.c; if (obj instanceof AdapterBindAdViewInterface) { ((AdapterBindAdViewInterface) obj).onAdViewBound(this.k); } } public void R() { Object obj = this.c; if (obj instanceof AdapterBindAdViewInterface) { ((AdapterBindAdViewInterface) obj).onAdViewWillBind(this.k); } } @Override // com.ironsource.k7 public AdData a(String str, Map map) { return new AdData(str, q(), a(map)); } @Override // com.ironsource.k7, com.ironsource.w1 public Map a(u1 u1Var) { Map a2 = super.a(u1Var); IronSourceBannerLayout ironSourceBannerLayout = this.r; if (ironSourceBannerLayout != null && !ironSourceBannerLayout.isDestroyed()) { com.ironsource.mediationsdk.l.a(a2, this.r.getSize()); } if (this.g != null) { a2.put("placement", j()); } return a2; } @Override // com.ironsource.k7 public Map a(Map map) { Map a2 = super.a(map); i1 i1Var = this.a; if (i1Var != null && this.r != null && TextUtils.isEmpty(i1Var.g().getCustomNetwork())) { a2.put("bannerLayout", this.r); } return a2; } @Override // com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdViewListener public void onAdLeftApplication() { x1 x1Var; Placement placement = this.g; if (placement != null && (x1Var = this.d) != null) { x1Var.j.f(placement.getPlacementName()); } Listener listener = this.b; if (listener != 0) { ((o1) listener).d(this); } } @Override // com.ironsource.mediationsdk.adunit.adapter.listener.BannerAdListener, com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdViewListener public void onAdLoadSuccess(View view, FrameLayout.LayoutParams layoutParams) { if (u().c()) { u().a(new a(view, layoutParams)); } else { a(view, layoutParams); } } @Override // com.ironsource.k7, com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdListener public void onAdOpened() { if (u().c()) { u().a(new b()); } else { J(); } } @Override // com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdViewListener public void onAdScreenDismissed() { x1 x1Var; Placement placement = this.g; if (placement != null && (x1Var = this.d) != null) { x1Var.j.c(placement.getPlacementName()); } Listener listener = this.b; if (listener != 0) { ((o1) listener).c(this); } } @Override // com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdViewListener public void onAdScreenPresented() { x1 x1Var; Placement placement = this.g; if (placement != null && (x1Var = this.d) != null) { x1Var.j.h(placement.getPlacementName()); } Listener listener = this.b; if (listener != 0) { ((o1) listener).a(this); } } @Override // com.ironsource.k7 public boolean v() { return this.s; } }