- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
312 lines
10 KiB
Java
312 lines
10 KiB
Java
package com.fyber.inneractive.sdk.flow;
|
|
|
|
import android.app.Activity;
|
|
import android.content.res.Resources;
|
|
import android.os.CountDownTimer;
|
|
import android.os.SystemClock;
|
|
import android.view.View;
|
|
import com.fyber.inneractive.sdk.external.InneractiveAdRequest;
|
|
import com.fyber.inneractive.sdk.external.InneractiveAdSpot;
|
|
import com.fyber.inneractive.sdk.external.InneractiveUnitController;
|
|
import com.fyber.inneractive.sdk.external.InneractiveUnitController.EventsListener;
|
|
import com.fyber.inneractive.sdk.flow.q;
|
|
import com.fyber.inneractive.sdk.interfaces.c;
|
|
import com.fyber.inneractive.sdk.network.s;
|
|
import com.fyber.inneractive.sdk.util.IAlog;
|
|
import com.fyber.inneractive.sdk.util.c1;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class z<AdContent extends q, EventsListener extends InneractiveUnitController.EventsListener> extends r<AdContent, EventsListener> implements com.fyber.inneractive.sdk.interfaces.c {
|
|
public c.a k;
|
|
public Runnable l;
|
|
public c1 m;
|
|
public Runnable n;
|
|
public c1 o;
|
|
public long r;
|
|
public a v;
|
|
public boolean p = false;
|
|
public boolean q = false;
|
|
public boolean s = false;
|
|
public boolean t = false;
|
|
public final com.fyber.inneractive.sdk.util.a u = new com.fyber.inneractive.sdk.util.a();
|
|
|
|
public class a extends CountDownTimer {
|
|
public a(long j) {
|
|
super(j, 1000L);
|
|
}
|
|
|
|
@Override // android.os.CountDownTimer
|
|
public final void onFinish() {
|
|
a aVar = z.this.v;
|
|
if (aVar != null) {
|
|
aVar.cancel();
|
|
}
|
|
z.this.e(false);
|
|
}
|
|
|
|
@Override // android.os.CountDownTimer
|
|
public final void onTick(long j) {
|
|
int i = ((int) j) / 1000;
|
|
c.a aVar = z.this.k;
|
|
if (aVar != null) {
|
|
aVar.updateCloseCountdown(i);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r
|
|
public final int A() {
|
|
c.a aVar = this.k;
|
|
if (aVar == null || aVar.getLayout() == null) {
|
|
return 1;
|
|
}
|
|
return this.k.getLayout().getWidth();
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r
|
|
public final void C() {
|
|
super.C();
|
|
}
|
|
|
|
public abstract boolean H();
|
|
|
|
public abstract int J();
|
|
|
|
public abstract int K();
|
|
|
|
public abstract long L();
|
|
|
|
public abstract boolean M();
|
|
|
|
public abstract long a(long j);
|
|
|
|
public abstract boolean b(AdContent adcontent);
|
|
|
|
@Override // com.fyber.inneractive.sdk.interfaces.c
|
|
public void c(boolean z) {
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r, com.fyber.inneractive.sdk.external.InneractiveAdRenderer
|
|
public final void initialize(InneractiveAdSpot inneractiveAdSpot) {
|
|
super.initialize(inneractiveAdSpot);
|
|
this.u.a = inneractiveAdSpot;
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r
|
|
public final View y() {
|
|
c.a aVar = this.k;
|
|
if (aVar != null) {
|
|
return aVar.getLayout();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r
|
|
public final int z() {
|
|
c.a aVar = this.k;
|
|
if (aVar == null || aVar.getLayout() == null) {
|
|
return 1;
|
|
}
|
|
return this.k.getLayout().getHeight();
|
|
}
|
|
|
|
public final void I() {
|
|
if (this.l == null) {
|
|
long L = L();
|
|
this.r = L;
|
|
this.l = new y(this, L);
|
|
IAlog.a("%senabling close with delay %d", IAlog.a(this), Long.valueOf(this.r));
|
|
AdContent adcontent = this.b;
|
|
boolean b = adcontent != null ? b((z<AdContent, EventsListener>) adcontent) : false;
|
|
if (b && !H()) {
|
|
if (b) {
|
|
c.a aVar = this.k;
|
|
if (aVar != null) {
|
|
aVar.showCloseCountdown();
|
|
}
|
|
a aVar2 = new a(this.r + 100);
|
|
this.v = aVar2;
|
|
aVar2.start();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (this.q) {
|
|
return;
|
|
}
|
|
this.q = true;
|
|
c1 c1Var = new c1(TimeUnit.MILLISECONDS, this.r);
|
|
this.m = c1Var;
|
|
c1Var.e = new a0(this);
|
|
c1.a aVar3 = new c1.a(c1Var);
|
|
c1Var.c = aVar3;
|
|
c1Var.d = false;
|
|
aVar3.sendEmptyMessage(1932593528);
|
|
}
|
|
}
|
|
|
|
public final void d(boolean z) {
|
|
s.a aVar;
|
|
if (this.b == null) {
|
|
aVar = new s.a(com.fyber.inneractive.sdk.network.r.MRAID_CUSTOM_CLOSE_DETECTED, (InneractiveAdRequest) null, (com.fyber.inneractive.sdk.response.e) null, (JSONArray) null);
|
|
} else {
|
|
com.fyber.inneractive.sdk.network.r rVar = com.fyber.inneractive.sdk.network.r.MRAID_CUSTOM_CLOSE_DETECTED;
|
|
AdContent adcontent = this.b;
|
|
aVar = new s.a(rVar, adcontent.a, adcontent.d(), this.b.c.c());
|
|
}
|
|
JSONObject jSONObject = new JSONObject();
|
|
Boolean valueOf = Boolean.valueOf(z);
|
|
try {
|
|
jSONObject.put("fyber_close_enabled", valueOf);
|
|
} catch (Exception unused) {
|
|
IAlog.f("Got exception adding param to json object: %s, %s", "fyber_close_enabled", valueOf);
|
|
}
|
|
aVar.f.put(jSONObject);
|
|
aVar.a((String) null);
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.flow.r, com.fyber.inneractive.sdk.external.InneractiveAdRenderer
|
|
public void destroy() {
|
|
Runnable runnable = this.l;
|
|
if (runnable != null) {
|
|
com.fyber.inneractive.sdk.util.p.b.removeCallbacks(runnable);
|
|
this.l = null;
|
|
}
|
|
Runnable runnable2 = this.n;
|
|
if (runnable2 != null) {
|
|
com.fyber.inneractive.sdk.util.p.b.removeCallbacks(runnable2);
|
|
this.n = null;
|
|
}
|
|
c.a aVar = this.k;
|
|
if (aVar != null) {
|
|
aVar.destroy();
|
|
}
|
|
this.k = null;
|
|
a aVar2 = this.v;
|
|
if (aVar2 != null) {
|
|
aVar2.cancel();
|
|
this.v = null;
|
|
}
|
|
c1 c1Var = this.o;
|
|
if (c1Var != null) {
|
|
c1Var.e = null;
|
|
this.o = null;
|
|
}
|
|
c1 c1Var2 = this.m;
|
|
if (c1Var2 != null) {
|
|
c1Var2.e = null;
|
|
this.m = null;
|
|
}
|
|
super.destroy();
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.interfaces.c
|
|
public void t() {
|
|
c1 c1Var = this.m;
|
|
if (c1Var != null) {
|
|
c1Var.d = false;
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
long uptimeMillis2 = (SystemClock.uptimeMillis() - uptimeMillis) + 50 + c1Var.f;
|
|
c1Var.f = uptimeMillis2;
|
|
if (c1Var.e == null || uptimeMillis2 <= c1Var.a.toMillis(c1Var.b)) {
|
|
c1.a aVar = c1Var.c;
|
|
if (aVar != null && c1Var.e != null) {
|
|
aVar.removeMessages(1932593528);
|
|
c1Var.c.sendEmptyMessageDelayed(1932593528, 50L);
|
|
}
|
|
} else {
|
|
c1Var.e.a();
|
|
}
|
|
}
|
|
c1 c1Var2 = this.o;
|
|
if (c1Var2 != null) {
|
|
c1Var2.d = false;
|
|
long uptimeMillis3 = SystemClock.uptimeMillis();
|
|
long uptimeMillis4 = (SystemClock.uptimeMillis() - uptimeMillis3) + 50 + c1Var2.f;
|
|
c1Var2.f = uptimeMillis4;
|
|
if (c1Var2.e != null && uptimeMillis4 > c1Var2.a.toMillis(c1Var2.b)) {
|
|
c1Var2.e.a();
|
|
return;
|
|
}
|
|
c1.a aVar2 = c1Var2.c;
|
|
if (aVar2 == null || c1Var2.e == null) {
|
|
return;
|
|
}
|
|
aVar2.removeMessages(1932593528);
|
|
c1Var2.c.sendEmptyMessageDelayed(1932593528, 50L);
|
|
}
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.interfaces.c
|
|
public void v() {
|
|
c1 c1Var = this.m;
|
|
if (c1Var != null) {
|
|
c1Var.d = true;
|
|
c1.a aVar = c1Var.c;
|
|
if (aVar != null) {
|
|
aVar.removeMessages(1932593528);
|
|
}
|
|
}
|
|
c1 c1Var2 = this.o;
|
|
if (c1Var2 != null) {
|
|
c1Var2.d = true;
|
|
c1.a aVar2 = c1Var2.c;
|
|
if (aVar2 != null) {
|
|
aVar2.removeMessages(1932593528);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void e(boolean z) {
|
|
s.a aVar;
|
|
this.p = true;
|
|
if (z) {
|
|
if (this.b == null) {
|
|
aVar = new s.a(com.fyber.inneractive.sdk.network.r.FAIL_SAFE_ACTIVATED, (InneractiveAdRequest) null, (com.fyber.inneractive.sdk.response.e) null, (JSONArray) null);
|
|
} else {
|
|
com.fyber.inneractive.sdk.network.r rVar = com.fyber.inneractive.sdk.network.r.FAIL_SAFE_ACTIVATED;
|
|
AdContent adcontent = this.b;
|
|
aVar = new s.a(rVar, adcontent.a, adcontent.d(), this.b.c.c());
|
|
}
|
|
JSONObject jSONObject = new JSONObject();
|
|
Boolean valueOf = Boolean.valueOf(M());
|
|
try {
|
|
jSONObject.put("is_endcard", valueOf);
|
|
} catch (Exception unused) {
|
|
IAlog.f("Got exception adding param to json object: %s, %s", "is_endcard", valueOf);
|
|
}
|
|
aVar.f.put(jSONObject);
|
|
aVar.a((String) null);
|
|
}
|
|
c.a aVar2 = this.k;
|
|
if (aVar2 != null) {
|
|
aVar2.showCloseButton(z, K(), J());
|
|
if (z) {
|
|
return;
|
|
}
|
|
com.fyber.inneractive.sdk.util.a aVar3 = this.u;
|
|
aVar3.d = 0L;
|
|
aVar3.e = 0L;
|
|
aVar3.f = 0L;
|
|
aVar3.b = false;
|
|
aVar3.a(false);
|
|
}
|
|
}
|
|
|
|
public void a(c.a aVar, Activity activity) throws InneractiveUnitController.AdDisplayError, Resources.NotFoundException {
|
|
if (this.a == null) {
|
|
IAlog.f("%sYou must set the spot to render before calling renderAd", IAlog.a(this));
|
|
throw new InneractiveUnitController.AdDisplayError("No spot ad to render");
|
|
}
|
|
if (aVar != null) {
|
|
this.k = aVar;
|
|
} else {
|
|
IAlog.f("%srenderAd called with a null activity!", IAlog.a(this));
|
|
throw new InneractiveUnitController.AdDisplayError("Activity is null");
|
|
}
|
|
}
|
|
}
|