package com.fyber.inneractive.sdk.mraid; import android.R; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.network.s; import com.fyber.inneractive.sdk.util.IAlog; import com.fyber.inneractive.sdk.util.p0; import com.fyber.inneractive.sdk.web.j; import java.util.LinkedHashMap; /* loaded from: classes2.dex */ public final class o extends b { public o(LinkedHashMap linkedHashMap, com.fyber.inneractive.sdk.web.j jVar, p0 p0Var) { super(linkedHashMap, jVar, p0Var); } @Override // com.fyber.inneractive.sdk.mraid.b public final void a() { com.fyber.inneractive.sdk.config.global.s sVar; int a = a("w"); int a2 = a("h"); int a3 = a("offsetX"); int a4 = a("offsetY"); boolean equals = "true".equals(this.b.get("allowOffscreen")); b("customClosePosition"); if (a <= 0) { a = this.c.a0; } if (a2 <= 0) { a2 = this.c.b0; } com.fyber.inneractive.sdk.web.j jVar = this.c; com.fyber.inneractive.sdk.web.h hVar = jVar.b; if (hVar == null) { return; } try { ViewGroup viewGroup = (ViewGroup) hVar.getRootView().findViewById(R.id.content); jVar.S = viewGroup; if (viewGroup == null) { IAlog.f("Couldn't find content in the view tree", new Object[0]); jVar.a(g.RESIZE, "Ad can be resized only if it's state is default or resized."); return; } if (jVar.P == j.d.DISABLED) { return; } b0 b0Var = jVar.O; if (b0Var != b0.DEFAULT && b0Var != b0.RESIZED) { jVar.a(g.RESIZE, "Ad can be resized only if it's state is default or resized."); return; } if (a < 0 && a2 < 0) { jVar.a(g.RESIZE, "Creative size passed to resize() was invalid."); return; } jVar.Y = false; L l = jVar.g; if (l != 0) { ((j.f) l).b(false); } j.h hVar2 = jVar.Q; if (hVar2 == j.h.ALWAYS_VISIBLE || (!jVar.Y && hVar2 != j.h.ALWAYS_HIDDEN)) { jVar.c(true); } jVar.d(false); jVar.f0 = com.fyber.inneractive.sdk.util.o.a(a2); jVar.e0 = com.fyber.inneractive.sdk.util.o.a(a); if (!equals) { int i = (a3 + a) - jVar.a0; if (i > 0) { a3 -= i; } if (a3 < 0) { a3 = 0; } int i2 = (a4 + a2) - jVar.b0; if (i2 > 0) { a4 -= i2; } if (a4 < 0) { a4 = 0; } } ViewGroup.LayoutParams layoutParams = jVar.b.getLayoutParams(); RelativeLayout relativeLayout = null; if (layoutParams instanceof RelativeLayout.LayoutParams) { RelativeLayout.LayoutParams a5 = com.fyber.inneractive.sdk.util.t.a(com.fyber.inneractive.sdk.util.o.a(a), com.fyber.inneractive.sdk.util.o.a(a2), (a3 == 0 && a4 == 0) ? new int[]{13} : null); a5.leftMargin = a3; a5.topMargin = a4; jVar.b.setLayoutParams(a5); } else if (layoutParams instanceof FrameLayout.LayoutParams) { jVar.b.setLayoutParams(new FrameLayout.LayoutParams(com.fyber.inneractive.sdk.util.o.a(a), com.fyber.inneractive.sdk.util.o.a(a2), 17)); } b0 b0Var2 = jVar.O; b0 b0Var3 = b0.RESIZED; if (b0Var2 != b0Var3) { jVar.O = b0Var3; jVar.a(new z(b0Var3)); int i3 = jVar.e0; if (i3 != -1 && jVar.f0 != -1) { jVar.a(new t(com.fyber.inneractive.sdk.util.o.b(i3), com.fyber.inneractive.sdk.util.o.b(jVar.f0))); } } g gVar = g.RESIZE; com.fyber.inneractive.sdk.network.r rVar = com.fyber.inneractive.sdk.network.r.BANNER_RESIZE_EXPAND; InneractiveAdRequest inneractiveAdRequest = jVar.r; com.fyber.inneractive.sdk.flow.q qVar = jVar.s; com.fyber.inneractive.sdk.response.e d = qVar != null ? qVar.d() : null; com.fyber.inneractive.sdk.flow.q qVar2 = jVar.s; new s.a(rVar, inneractiveAdRequest, d, (qVar2 == null || (sVar = qVar2.c) == null) ? null : sVar.c()).a("action", gVar.e()).a((String) null); ViewGroup viewGroup2 = (ViewGroup) jVar.b.getParent(); if (viewGroup2 != null) { ViewGroup viewGroup3 = (ViewGroup) viewGroup2.findViewById(com.fyber.inneractive.sdk.R.id.ia_identifier_overlay); if (viewGroup3 instanceof RelativeLayout) { relativeLayout = (RelativeLayout) viewGroup3; } } com.fyber.inneractive.sdk.web.h hVar3 = jVar.b; if (hVar3 != null && relativeLayout != null) { relativeLayout.setLayoutParams(hVar3.getLayoutParams()); } L l2 = jVar.g; if (l2 != 0) { ((j.f) l2).c(); } } catch (Exception unused) { IAlog.f("Couldn't find content in the view tree", new Object[0]); jVar.a(g.RESIZE, "Ad can be resized only if it's state is default or resized."); } } @Override // com.fyber.inneractive.sdk.mraid.b public final boolean b() { return true; } }