package com.ironsource; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.webkit.WebView; import android.widget.FrameLayout; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.sdk.utils.Logger; import com.ironsource.v8; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes2.dex */ public class jf extends FrameLayout implements hg { private static final String b = "IronSourceAdContainer"; private of a; public class a implements Runnable { final /* synthetic */ String a; final /* synthetic */ String b; public a(String str, String str2) { this.a = str; this.b = str2; } @Override // java.lang.Runnable public void run() { jf jfVar = jf.this; jfVar.removeView(jfVar.a.getPresentingView()); jf.this.a.a(this.a, this.b); jf.this.a = null; } } public jf(Context context) { super(context); } public jf(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public jf(of ofVar, Context context) { super(context); setLayoutParams(new FrameLayout.LayoutParams(ofVar.d().c(), ofVar.d().a())); this.a = ofVar; addView(ofVar.getPresentingView()); } private void b() throws Exception { JSONObject jSONObject; try { jSONObject = this.a.c().a().getJSONObject(Cif.p).getJSONObject(Cif.s); } catch (Exception e) { i9.d().a(e); jSONObject = new JSONObject(); } jSONObject.put("adViewId", this.a.b()); this.a.c().a(v8.g.R, jSONObject); } public void a() throws Exception { of ofVar = this.a; if (ofVar == null || ofVar.c() == null) { throw new Exception("mAdPresenter or mAdPresenter.getAdViewLogic() are null"); } b(); } @Override // com.ironsource.hg public synchronized void a(String str, String str2) { of ofVar = this.a; if (ofVar != null && ofVar.c() != null && this.a.getPresentingView() != null) { this.a.c().e(); ve.a.d(new a(str, str2)); } } @Override // com.ironsource.hg public void a(String str, String str2, String str3) { of ofVar = this.a; if (ofVar == null) { return; } ofVar.a(str, str2, str3); } @Override // com.ironsource.hg public void a(JSONObject jSONObject, String str, String str2) { this.a.a(jSONObject, str, str2); } @Override // com.ironsource.hg public void b(JSONObject jSONObject, String str, String str2) { this.a.b(jSONObject, str, str2); } @Override // com.ironsource.hg public void c(JSONObject jSONObject, String str, String str2) throws JSONException { this.a.c(jSONObject, str, str2); } @Override // com.ironsource.hg public WebView getPresentingView() { return this.a.getPresentingView(); } public hf getSize() { of ofVar = this.a; return ofVar != null ? ofVar.d() : new hf(); } @Override // android.view.View public void onVisibilityChanged(View view, int i) { Logger.i(b, "onVisibilityChanged: " + i); of ofVar = this.a; if (ofVar == null) { return; } try { ofVar.c().a(Cif.k, i, isShown()); } catch (Exception e) { i9.d().a(e); IronLog.INTERNAL.error(e.toString()); } } @Override // android.view.View public void onWindowVisibilityChanged(int i) { Logger.i(b, "onWindowVisibilityChanged: " + i); of ofVar = this.a; if (ofVar == null) { return; } try { ofVar.c().a(Cif.l, i, isShown()); } catch (Exception e) { i9.d().a(e); IronLog.INTERNAL.error(e.toString()); } } }