package com.fyber.inneractive.sdk.player.ui; import android.content.Context; import android.graphics.Rect; import android.view.View; import android.widget.RelativeLayout; import com.fyber.inneractive.sdk.config.e0; import com.fyber.inneractive.sdk.config.enums.UnitDisplayType; import com.fyber.inneractive.sdk.config.f0; import com.fyber.inneractive.sdk.util.IAlog; import com.fyber.inneractive.sdk.util.p0; import com.fyber.inneractive.sdk.util.q0; /* loaded from: classes2.dex */ public abstract class d extends RelativeLayout implements l { public final p0 a; public final int b; public f0 c; public UnitDisplayType d; public boolean e; public boolean f; public m g; public boolean h; public class a implements Runnable { public final boolean a; public a(boolean z) { this.a = z; } @Override // java.lang.Runnable public final void run() { if (this.a == d.this.hasWindowFocus()) { d.this.e(); } } } public d(Context context) { super(context, null, 0); this.a = p0.a(); this.b = 0; this.e = false; this.f = false; this.h = false; this.b = Math.min(com.fyber.inneractive.sdk.util.o.g(), com.fyber.inneractive.sdk.util.o.f()); } public abstract void a(q0 q0Var, int i, int i2); @Override // com.fyber.inneractive.sdk.player.ui.l public boolean a() { return false; } public final String b() { return IAlog.a(this); } public void c() { this.h = true; } public void d() { this.h = false; } @Override // com.fyber.inneractive.sdk.player.ui.l public void destroy() { if (this.g != null) { this.g = null; } } public final void e() { boolean z = isShown() && hasWindowFocus() && this.f && !this.h; if (z) { z = getGlobalVisibleRect(new Rect()); } if (z == this.e || this.g == null) { return; } IAlog.a("%supdateVisibility changing to %s", IAlog.a(this), Boolean.valueOf(z)); this.e = z; this.g.a(z); } @Override // android.view.ViewGroup, android.view.View public final void onAttachedToWindow() { super.onAttachedToWindow(); IAlog.a("%sGot onAttachedToWindow: mIsAttached = %s", IAlog.a(this), Boolean.valueOf(this.f)); this.f = true; m mVar = this.g; if (mVar != null) { mVar.b(); } e(); } @Override // android.view.ViewGroup, android.view.View public final void onDetachedFromWindow() { super.onDetachedFromWindow(); IAlog.a("%sGot onDetachedFromWindow: mIsAttached = %s", IAlog.a(this), Boolean.valueOf(this.f)); this.f = false; m mVar = this.g; if (mVar != null) { mVar.d(); } e(); } @Override // android.view.View public final void onVisibilityChanged(View view, int i) { super.onVisibilityChanged(view, i); if (equals(view)) { IAlog.a("%sgot onVisibilityChanged with %d", IAlog.a(this), Integer.valueOf(i)); e(); } } @Override // android.view.View public void onWindowFocusChanged(boolean z) { super.onWindowFocusChanged(z); IAlog.a("%sgot onWindowFocusChanged with: %s", IAlog.a(this), Boolean.valueOf(z)); com.fyber.inneractive.sdk.util.p.b.postDelayed(new a(z), 500L); } public void setListener(m mVar) { this.g = mVar; } public void setUnitConfig(f0 f0Var) { this.c = f0Var; e0 e0Var = (e0) f0Var; this.d = e0Var.e == null ? e0Var.f.j : UnitDisplayType.DEFAULT; } }