正在查看: 凤凰之城 v1.0.3 应用的 AdViewImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 凤凰之城 v1.0.3 应用的 AdViewImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.octopus.ad.internal.view;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.MutableContextWrapper;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import com.octopus.ad.AdActivity;
import com.octopus.ad.AdLifeControl;
import com.octopus.ad.FullScreenVideoAdListener;
import com.octopus.ad.IBidding;
import com.octopus.ad.InterstitialAdListener;
import com.octopus.ad.Octopus;
import com.octopus.ad.OnSensorListener;
import com.octopus.ad.R;
import com.octopus.ad.RewardVideoAdListener;
import com.octopus.ad.SplashAdListener;
import com.octopus.ad.internal.a.h;
import com.octopus.ad.internal.activity.EndingPageActivity;
import com.octopus.ad.internal.activity.StopoverDialogActivity;
import com.octopus.ad.internal.k;
import com.octopus.ad.internal.n;
import com.octopus.ad.internal.network.ServerResponse;
import com.octopus.ad.internal.network.a;
import com.octopus.ad.internal.o;
import com.octopus.ad.internal.r;
import com.octopus.ad.internal.t;
import com.octopus.ad.internal.utilities.HTTPGet;
import com.octopus.ad.internal.utilities.HaoboLog;
import com.octopus.ad.internal.utilities.StringUtil;
import com.octopus.ad.internal.utilities.UrlUtil;
import com.octopus.ad.internal.utilities.ViewUtil;
import com.octopus.ad.internal.video.AdVideoView;
import com.octopus.ad.model.ComplianceInfo;
import com.octopus.ad.model.c;
import com.octopus.ad.utils.i;
import com.octopus.ad.utils.j;
import com.octopus.ad.utils.k;
import com.octopus.ad.utils.l;
import java.io.File;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public abstract class AdViewImpl extends FrameLayout implements ViewTreeObserver.OnGlobalLayoutListener, AdLifeControl, IBidding, com.octopus.ad.internal.a {
private RewardVideoAdListener A;
private com.octopus.ad.model.a B;
private final Handler C;
private b D;
private com.octopus.ad.internal.a.b E;
private h F;
private boolean G;
private boolean H;
private boolean I;
private boolean J;
private boolean K;
private boolean L;
private AppCompatTextView M;
private AppCompatTextView N;
private ImageView O;
private com.octopus.ad.a.a P;
private com.octopus.ad.a.a Q;
private AppCompatImageView R;
private AppCompatTextView S;
private ProgressBar T;
private FrameLayout U;
private FrameLayout V;
private LinearLayout W;
public ServerResponse a;
private String aA;
private String aB;
private String aC;
private Pair<String, Integer> aD;
private boolean aE;
private boolean aF;
private boolean aG;
private int aH;
private l aI;
private k aJ;
private j aK;
private OnSensorListener aL;
private k.a aM;
private k.a aN;
private final c aO;
private boolean aP;
private int aa;
private String ab;
private String ac;
private String ad;
private int ae;
private int af;
private int ag;
private long ah;
private long ai;
private boolean aj;
private boolean ak;
private boolean al;
private boolean am;
private boolean an;
private boolean ao;
private boolean ap;
private boolean aq;
private Boolean ar;
private boolean as;
private int at;
private AdVideoView au;
private com.octopus.ad.internal.view.a av;
private boolean aw;
private boolean ax;
private boolean ay;
private ViewGroup az;
public a b;
public com.octopus.ad.internal.view.c c;
public com.octopus.ad.internal.d d;
public a.C0008a e;
public com.octopus.ad.internal.c f;
public n g;
public boolean h;
public int i;
public int j;
public int k;
public int l;
public int m;
public int n;
public boolean o;
public boolean p;
public boolean q;
public boolean r;
public Context s;
private ViewGroup t;
private int u;
private int v;
private float w;
private SplashAdListener x;
private InterstitialAdListener y;
private FullScreenVideoAdListener z;
public static class a {
public EnumC0014a a = EnumC0014a.UNCHANGE;
public boolean b = false;
public enum EnumC0014a {
UNCHANGE,
STATE_PREPARE_CHANGE,
STATE_BACKGROUND,
FINISHCLOSE
}
public boolean a() {
return this.b;
}
public void b() {
this.a = EnumC0014a.UNCHANGE;
}
public EnumC0014a c() {
return this.a;
}
public void a(boolean z) {
this.b = z;
}
public synchronized void a(EnumC0014a enumC0014a) {
EnumC0014a enumC0014a2 = EnumC0014a.STATE_PREPARE_CHANGE;
if (enumC0014a == enumC0014a2 && this.a == EnumC0014a.UNCHANGE) {
this.a = enumC0014a2;
}
EnumC0014a enumC0014a3 = EnumC0014a.STATE_BACKGROUND;
if (enumC0014a == enumC0014a3 && this.a == enumC0014a2) {
this.a = enumC0014a3;
}
EnumC0014a enumC0014a4 = EnumC0014a.FINISHCLOSE;
if (enumC0014a == enumC0014a4 && this.a == enumC0014a3 && this.b) {
this.a = enumC0014a4;
}
}
}
public class b implements com.octopus.ad.internal.b {
private final Handler b;
private com.octopus.ad.internal.network.b c;
public b(Handler handler) {
this.b = handler;
}
@Override
public void b() {
this.b.post(new Runnable() {
@Override
public void run() {
Log.i("OctopusAd", "enter Octopus ad click");
AdViewImpl.this.b.a(a.EnumC0014a.STATE_PREPARE_CHANGE);
boolean z = Boolean.TRUE == AdViewImpl.this.ar || !(Boolean.FALSE == AdViewImpl.this.ar || AdViewImpl.this.ao || AdViewImpl.this.as || AdViewImpl.this.al);
if (AdViewImpl.this.I && z) {
if (AdViewImpl.this.x != null) {
AdViewImpl.this.x.onAdClicked();
return;
}
if (AdViewImpl.this.y != null) {
AdViewImpl.this.y.onAdClicked();
} else if (AdViewImpl.this.z != null) {
AdViewImpl.this.z.onAdClicked();
} else if (AdViewImpl.this.A != null) {
AdViewImpl.this.A.onRewardVideoAdClicked();
}
}
}
});
}
@Override
public void c() {
}
@Override
public void d() {
}
@Override
public void a(com.octopus.ad.internal.network.b bVar) {
this.c = bVar;
if (bVar.a().equals(n.NATIVE) || bVar.a().equals(n.DRAW) || bVar.a().equals(n.BANNER)) {
a(80103);
return;
}
com.octopus.ad.internal.d dVar = AdViewImpl.this.d;
if (dVar != null && dVar.j()) {
AdViewImpl.this.aq = true;
AdViewImpl.this.w();
return;
}
ServerResponse serverResponse = AdViewImpl.this.a;
if (serverResponse != null && serverResponse.n() == 1) {
a(80100);
AdViewImpl.this.v();
if (AdViewImpl.this.ap) {
return;
}
com.octopus.ad.internal.network.a.a(AdViewImpl.this.getContext(), AdViewImpl.this.a.c());
return;
}
AdViewImpl adViewImpl = AdViewImpl.this;
ServerResponse serverResponse2 = adViewImpl.a;
if (serverResponse2 == null) {
a(80100);
return;
}
adViewImpl.p = serverResponse2.K();
AdViewImpl.this.setPrice(bVar.c());
AdViewImpl.this.setTagId(bVar.d());
AdViewImpl.this.setValidTime(bVar.e());
AdViewImpl.this.k();
if (AdViewImpl.this.a.i() == n.REWARD) {
AdViewImpl adViewImpl2 = AdViewImpl.this;
adViewImpl2.a(adViewImpl2.a.s());
}
this.b.post(new Runnable() {
@Override
public void run() {
View adView = AdViewImpl.this.getAdView();
if (adView == null) {
return;
}
adView.getViewTreeObserver().addOnGlobalLayoutListener(AdViewImpl.this);
}
});
}
@Override
public void a(com.octopus.ad.internal.view.c cVar) {
AdViewImpl.this.setCreativeWidth(cVar.getCreativeWidth());
AdViewImpl.this.setCreativeHeight(cVar.getCreativeHeight());
if (AdViewImpl.this.a(cVar)) {
com.octopus.ad.utils.b.f.c("OctopusAd_Time", "Displayable");
AdViewImpl adViewImpl = AdViewImpl.this;
adViewImpl.r = true;
adViewImpl.C();
AdViewImpl.this.m();
}
}
@Override
public void a(boolean z) {
AdViewImpl.this.a(z);
AdViewImpl adViewImpl = AdViewImpl.this;
ServerResponse serverResponse = adViewImpl.a;
if (serverResponse != null) {
AdViewImpl.a(serverResponse, adViewImpl.aO);
AdViewImpl adViewImpl2 = AdViewImpl.this;
adViewImpl2.as = adViewImpl2.a.N();
AdViewImpl adViewImpl3 = AdViewImpl.this;
adViewImpl3.al = adViewImpl3.a.O();
AdViewImpl adViewImpl4 = AdViewImpl.this;
adViewImpl4.ar = adViewImpl4.a.M();
}
}
@Override
public void a(final int i) {
this.b.post(new Runnable() {
@Override
public void run() {
AdViewImpl.this.b(i);
}
});
}
@Override
public void a() {
if (AdViewImpl.this.am) {
return;
}
AdViewImpl.this.am = true;
AdViewImpl adViewImpl = AdViewImpl.this;
if (adViewImpl.a != null && !adViewImpl.K) {
AdViewImpl.this.a.U();
}
this.b.post(new Runnable() {
@Override
public void run() {
if (AdViewImpl.this.x != null) {
AdViewImpl.this.x.onAdClosed();
} else if (AdViewImpl.this.y != null) {
AdViewImpl.this.y.onAdClosed();
} else if (AdViewImpl.this.z != null) {
AdViewImpl.this.z.onAdClosed();
} else if (AdViewImpl.this.A != null) {
AdViewImpl.this.A.onRewardVideoAdClosed();
}
AdViewImpl.this.b.b();
}
});
}
@Override
public void a(final long j) {
this.b.post(new Runnable() {
@Override
public void run() {
if (AdViewImpl.this.x == null || b.this.c == null || !b.this.c.a().equals(n.SPLASH)) {
return;
}
AdViewImpl.this.x.onAdTick(j);
}
});
}
}
public interface c {
void a();
}
public AdViewImpl(Context context) {
this(context, null, 0);
}
public static int J(AdViewImpl adViewImpl) {
int i = adViewImpl.aH;
adViewImpl.aH = i - 1;
return i;
}
public View getAdView() {
AdVideoView adVideoView = this.au;
if (adVideoView != null) {
return adVideoView;
}
com.octopus.ad.internal.view.a aVar = this.av;
if (aVar != null) {
return aVar.c;
}
return null;
}
public com.octopus.ad.model.d getRandomClickPosition() {
int screenWidth;
int screenHeight;
try {
if (!this.ap && !this.aq) {
View adView = getAdView();
screenWidth = 0;
if (adView != null) {
screenWidth = adView.getWidth();
screenHeight = adView.getHeight();
} else {
screenHeight = 0;
}
if (screenWidth == 0 || screenHeight == 0) {
screenWidth = ViewUtil.getScreenWidth(getContext());
screenHeight = ViewUtil.getScreenWidth(getContext());
}
int a5 = i.a(screenWidth);
int a6 = i.a(screenHeight);
int a7 = i.a(150) + 50;
com.octopus.ad.model.d dVar = new com.octopus.ad.model.d(1);
float f = a5;
dVar.a(f);
float f4 = a6;
dVar.b(f4);
dVar.a(String.valueOf(System.currentTimeMillis()));
dVar.c(f);
dVar.d(f4);
dVar.b(String.valueOf(System.currentTimeMillis() + a7));
dVar.a(screenWidth);
dVar.b(screenHeight);
return dVar;
}
screenWidth = ViewUtil.getScreenWidth(getContext());
screenHeight = ViewUtil.getScreenHeight(getContext());
int a52 = i.a(screenWidth);
int a62 = i.a(screenHeight);
int a72 = i.a(150) + 50;
com.octopus.ad.model.d dVar2 = new com.octopus.ad.model.d(1);
float f5 = a52;
dVar2.a(f5);
float f42 = a62;
dVar2.b(f42);
dVar2.a(String.valueOf(System.currentTimeMillis()));
dVar2.c(f5);
dVar2.d(f42);
dVar2.b(String.valueOf(System.currentTimeMillis() + a72));
dVar2.a(screenWidth);
dVar2.b(screenHeight);
return dVar2;
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
return null;
}
}
public void a(Context context) {
}
public abstract boolean a(com.octopus.ad.internal.view.c cVar);
public void cancel() {
destroy();
}
public void destroy() {
HaoboLog.d(HaoboLog.baseLogTag, "called destroy() on AdView");
E();
if (this.aM != null) {
com.octopus.ad.internal.k.a().b(this.aM);
}
if (this.aN != null) {
com.octopus.ad.internal.k.a().b(this.aN);
}
ServerResponse serverResponse = this.a;
if (serverResponse != null) {
serverResponse.ac();
}
com.octopus.ad.internal.c cVar = this.f;
if (cVar != null) {
cVar.b();
this.f.a();
this.f = null;
}
com.octopus.ad.internal.view.c cVar2 = this.c;
if (cVar2 != null) {
cVar2.k();
this.c = null;
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
return super.dispatchTouchEvent(motionEvent);
}
public com.octopus.ad.internal.b getAdDispatcher() {
return this.D;
}
public com.octopus.ad.internal.d getAdParameters() {
return this.d;
}
public a.C0008a getAdRequest() {
return this.e;
}
public com.octopus.ad.b getAdSize() {
return new com.octopus.ad.b(this.u, this.v);
}
public String getAdSlotId() {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.get_placement_id, this.d.c()));
com.octopus.ad.internal.d dVar = this.d;
return dVar == null ? "" : dVar.c();
}
public String getExtraData() {
return this.ac;
}
public Map<String, Object> getMediaExtraInfo() {
ServerResponse serverResponse = this.a;
return serverResponse != null ? serverResponse.T() : Collections.emptyMap();
}
public boolean getOpensNativeBrowser() {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.get_opens_native_browser, this.d.m()));
return this.d.m();
}
public int getPrice() {
return this.aa;
}
public String getRequestId() {
com.octopus.ad.internal.d dVar = this.d;
return (dVar == null || TextUtils.isEmpty(dVar.f())) ? this.aA : this.d.f();
}
public ViewGroup getSplashParent() {
return this.t;
}
public String getTagId() {
return this.ab;
}
public String getUserId() {
return this.ad;
}
public abstract boolean j();
public void onCreateLifeCycle() {
}
public void onDestroyLifeCycle() {
com.octopus.ad.internal.c cVar = this.f;
if (cVar != null) {
cVar.a();
}
D();
G();
q();
}
@Override
public void onGlobalLayout() {
c.o F;
View adView = getAdView();
if (adView == null) {
return;
}
adView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
ServerResponse serverResponse = this.a;
if (serverResponse == null || (F = serverResponse.F()) == null) {
return;
}
c.m a5 = F.a();
if (a5 != null) {
e(a5.a() == 1);
} else if (b() || d()) {
e(false);
}
c.u c5 = F.c();
if (c5 != null && c5.a() == 1) {
a(c5);
}
c.s d = F.d();
if (d != null && d.a() == 1) {
a(d.b());
}
c.r b5 = F.b();
if (b5 != null && b5.a() == 1) {
b(b5.b());
}
if (this.au == null) {
l();
}
}
@Override
public void onLayout(boolean z, int i, int i4, int i5, int i6) {
super.onLayout(z, i, i4, i5, i6);
}
public void onPauseLifeCycle() {
}
public void onRestartLifeCycle() {
}
public void onResumeLifeCycle() {
a aVar = this.b;
a.EnumC0014a enumC0014a = a.EnumC0014a.FINISHCLOSE;
aVar.a(enumC0014a);
if (this.b.c() == enumC0014a) {
getAdDispatcher().a();
}
if (this.aw && this.an && getMediaType() == n.INTERSTITIAL) {
A();
}
}
public void onStartLifeCycle() {
}
public void onStopLifeCycle() {
this.b.a(a.EnumC0014a.STATE_BACKGROUND);
}
public abstract void q();
public abstract void r();
public abstract void s();
public void sendLossNotice(int i, String str, String str2) {
try {
this.a.a(i, str, str2);
v();
} catch (Throwable th) {
com.octopus.ad.utils.b.f.a("OctopusAd", "A Throwable Caught", th);
}
}
public void sendWinNotice(int i) {
try {
this.a.a(i);
} catch (Throwable th) {
com.octopus.ad.utils.b.f.a("OctopusAd", "A Throwable Caught", th);
}
}
public void setAdSlotId(String str) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_placement_id, str));
com.octopus.ad.internal.d dVar = this.d;
if (dVar != null) {
dVar.a(str);
}
}
public void setAdVideoView(AdVideoView adVideoView) {
this.au = adVideoView;
}
public void setAdWebView(com.octopus.ad.internal.view.a aVar) {
this.av = aVar;
}
public void setChannel(String str) {
com.octopus.ad.internal.d dVar = this.d;
if (dVar != null) {
dVar.b(str);
}
}
public void setClickBackClose(boolean z) {
this.aw = z;
}
public void setCountDownTime(int i) {
this.ag = i;
}
public void setCreativeHeight(int i) {
this.v = i;
}
public void setCreativeWidth(int i) {
this.u = i;
if (!c()) {
this.w = 1.0f;
return;
}
int i4 = this.u;
float f = i4 > 0 ? i4 / 640.0f : 1.0f;
this.w = f;
if (f > 1.0f) {
this.w = 1.0f;
}
}
public void setExtraData(String str) {
this.ac = str;
}
public void setFullScreenVideoAdListener(FullScreenVideoAdListener fullScreenVideoAdListener) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_full_screen_video_ad_listener));
this.z = fullScreenVideoAdListener;
}
public void setInterstitialAdListener(InterstitialAdListener interstitialAdListener) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_interstitial_ad_listener));
this.y = interstitialAdListener;
}
public void setIsBoost(boolean z) {
this.d.b(z);
}
public void setIsClicked(boolean z) {
this.an = z;
E();
}
public void setOnSensorListener(OnSensorListener onSensorListener) {
this.aL = onSensorListener;
}
public void setOpensNativeBrowser(boolean z) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_opens_native_browser, z));
this.d.c(z);
}
public void setPrice(int i) {
this.aa = i;
}
public void setRequestId(String str) {
com.octopus.ad.internal.d dVar = this.d;
if (dVar != null) {
dVar.c(str);
}
}
public void setRewardVideoAdListener(RewardVideoAdListener rewardVideoAdListener) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_reward_video_ad_listener));
this.A = rewardVideoAdListener;
}
public void setScrollClick(View.OnTouchListener onTouchListener) {
View adView = getAdView();
if (adView == null) {
return;
}
adView.setOnTouchListener(onTouchListener);
}
public void setSplashAdListener(SplashAdListener splashAdListener) {
HaoboLog.d(HaoboLog.publicFunctionsLogTag, HaoboLog.getString(R.string.set_splash_ad_listener));
this.x = splashAdListener;
}
public void setTagId(String str) {
this.ab = str;
}
public void setUserId(String str) {
this.ad = str;
}
public void setValidTime(long j) {
o.s = j;
this.ai = j;
}
public AdViewImpl(Context context, ViewGroup viewGroup) {
super(context, null, 0);
this.b = new a();
this.C = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
}
};
this.d = null;
this.e = null;
this.G = false;
this.J = false;
this.h = false;
this.K = false;
this.ae = 0;
this.af = 0;
this.aj = true;
this.ak = true;
this.at = 0;
this.ax = false;
this.ay = false;
this.o = false;
this.p = false;
this.q = false;
this.r = false;
this.aD = null;
this.aE = false;
this.aF = false;
this.aH = 2;
this.aO = new c() {
@Override
public void a() {
if (AdViewImpl.this.am || AdViewImpl.this.an || AdViewImpl.this.ao) {
return;
}
AdViewImpl.this.x();
}
};
this.aP = false;
this.t = viewGroup;
a(context, (AttributeSet) null);
}
public void A() {
E();
if (getAdDispatcher() != null) {
getAdDispatcher().a();
}
com.octopus.ad.a.a aVar = this.P;
if (aVar != null) {
aVar.d();
}
com.octopus.ad.internal.view.a aVar2 = this.av;
if (aVar2 != null) {
Activity b5 = b(aVar2.getView());
if (!j() || b5 == null || b5.isFinishing() || !(b5 instanceof AdActivity)) {
return;
}
b5.finish();
}
}
private void B() {
c.l f;
if (this.a == null || !o.a().e() || (f = this.a.f()) == null || TextUtils.isEmpty(f.c())) {
return;
}
o.a().d();
if (f.b() == 1) {
this.B = o.a().g.get(f.c());
}
com.octopus.ad.model.a aVar = this.B;
if (aVar == null || !aVar.j() || this.B.g() < getPrice()) {
com.octopus.ad.model.a aVar2 = new com.octopus.ad.model.a();
this.B = aVar2;
aVar2.a(getPrice());
this.B.a(this.ah);
this.B.b(this.ai);
this.B.a(getRequestId());
this.B.b(f.a());
this.B.b(f.c());
this.B.c(f.d());
this.B.a(this.a.P());
this.B.e(this.a.S());
ServerResponse serverResponse = this.a;
if (serverResponse != null && serverResponse.a() != null) {
this.B.d(this.a.Q());
this.B.a(this.a.a().s());
}
o.a().g.put(f.c(), this.B);
}
}
public void C() {
AdVideoView adVideoView = this.au;
if (adVideoView == null) {
return;
}
String videoUrl = adVideoView.getVideoUrl();
if (TextUtils.isEmpty(videoUrl)) {
b(false);
return;
}
ServerResponse serverResponse = this.a;
if (serverResponse != null && (!serverResponse.v() || "m3u8".equalsIgnoreCase(this.a.e()))) {
b(true);
return;
}
h b5 = o.a().b();
this.F = b5;
if (b5 == null) {
b(false);
return;
}
if (b5.b(videoUrl)) {
b(true);
return;
}
com.octopus.ad.internal.a.b bVar = new com.octopus.ad.internal.a.b() {
@Override
public void a(File file, String str, int i) {
if (i == 100) {
AdViewImpl.this.b(true);
}
}
};
this.E = bVar;
this.F.a(bVar, videoUrl);
ServerResponse serverResponse2 = this.a;
if (serverResponse2 != null) {
serverResponse2.a(new com.octopus.ad.internal.view.b() {
@Override
public void a() {
AdViewImpl.this.b(false);
AdViewImpl.this.ax = false;
}
});
}
}
private void D() {
com.octopus.ad.internal.a.b bVar;
h hVar = this.F;
if (hVar == null || (bVar = this.E) == null) {
return;
}
hVar.a(bVar);
}
public void E() {
com.octopus.ad.a.a aVar = this.Q;
if (aVar != null) {
aVar.d();
}
LinearLayout linearLayout = this.W;
if (linearLayout != null) {
linearLayout.setVisibility(8);
}
}
public void F() {
ServerResponse serverResponse = this.a;
if (serverResponse != null && serverResponse.H() && this.aj) {
Map<String, Object> T = this.a.T();
if (T != null && !T.isEmpty()) {
T.put("landingPageUrl", this.a.R());
Intent intent = new Intent(getContext(), (Class<?>) StopoverDialogActivity.class);
intent.setFlags(268435456);
Bundle bundle = new Bundle();
bundle.putSerializable("mapData", (Serializable) T);
intent.putExtra("bundleData", bundle);
getContext().startActivity(intent);
this.aM = new k.a() {
@Override
public void a(String str) {
if ("getReward".equals(str)) {
if (AdViewImpl.this.O != null) {
AdViewImpl.this.O.setVisibility(0);
}
AdViewImpl.this.o();
} else if ("StopoverFinish".equals(str)) {
if (AdViewImpl.this.P != null) {
AdViewImpl.this.P.c();
}
com.octopus.ad.internal.k.a().b(AdViewImpl.this.aM);
AdViewImpl.this.aM = null;
}
}
};
com.octopus.ad.internal.k.a().a(this.aM);
com.octopus.ad.a.a aVar = this.P;
if (aVar != null) {
aVar.b();
}
}
this.aj = false;
}
}
private void G() {
l lVar = this.aI;
if (lVar != null) {
lVar.a();
this.aI = null;
}
j jVar = this.aK;
if (jVar != null) {
jVar.a();
}
com.octopus.ad.utils.k kVar = this.aJ;
if (kVar != null) {
kVar.b();
}
}
private void u() {
try {
a(this.a, this.aO);
a(0, 30, 0, 0);
int i = this.ag;
if (i < 3) {
i = this.av.h();
}
a(i);
AdVideoView adVideoView = this.au;
if (adVideoView != null) {
adVideoView.h();
}
ViewGroup viewGroup = this.t;
if (viewGroup != null) {
viewGroup.removeAllViews();
this.t.addView(this, new ViewGroup.LayoutParams(-1, -1));
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void v() {
ServerResponse serverResponse;
c.w G;
c.p c5;
if (this.ap || (serverResponse = this.a) == null || (G = serverResponse.G()) == null || (c5 = G.c()) == null) {
return;
}
if (c5.a() == 1) {
this.ap = true;
this.a.b(true);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AdViewImpl.this.z();
}
}, c5.c());
if (c5.b() == 1) {
final k.a aVar = new k.a() {
@Override
public void a(String str) {
if ("AppBackground".equals(str)) {
AdViewImpl.this.L = true;
}
}
};
com.octopus.ad.internal.k.a().a(aVar);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!AdViewImpl.this.L) {
AdViewImpl.this.x();
}
com.octopus.ad.internal.k.a().b(aVar);
}
}, c5.d());
}
}
}
public void w() {
c.w G;
c.p c5;
ServerResponse serverResponse = this.a;
if (serverResponse == null || (G = serverResponse.G()) == null || (c5 = G.c()) == null) {
return;
}
if (c5.a() == 1) {
this.a.c(true);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AdViewImpl.this.z();
}
}, c5.c());
if (c5.b() == 1) {
final k.a aVar = new k.a() {
@Override
public void a(String str) {
if ("AppBackground".equals(str)) {
AdViewImpl.this.L = true;
}
}
};
com.octopus.ad.internal.k.a().a(aVar);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!AdViewImpl.this.L) {
AdViewImpl.this.x();
}
com.octopus.ad.internal.k.a().b(aVar);
}
}, c5.d());
}
}
}
public void x() {
ServerResponse serverResponse;
if (this.av == null || (serverResponse = this.a) == null) {
return;
}
if (a(serverResponse)) {
this.ao = false;
this.at = 0;
} else {
this.ao = true;
this.at = 9;
}
this.av.a(this.at, getRandomClickPosition());
}
public void y() {
if (!this.al || this.an) {
A();
return;
}
this.at = 2;
AdVideoView adVideoView = this.au;
if (adVideoView != null) {
adVideoView.setOpt(2);
} else {
com.octopus.ad.internal.view.a aVar = this.av;
if (aVar != null) {
aVar.c(2);
}
}
a(getRandomClickPosition());
}
public void z() {
ServerResponse serverResponse;
com.octopus.ad.internal.view.a aVar = this.av;
if (aVar == null || (serverResponse = aVar.b) == null) {
return;
}
serverResponse.a(g(), (com.octopus.ad.a) null);
}
public void k() {
if (this.ax) {
return;
}
this.ax = true;
this.ah = System.currentTimeMillis();
SplashAdListener splashAdListener = this.x;
if (splashAdListener != null) {
splashAdListener.onAdLoaded();
} else {
InterstitialAdListener interstitialAdListener = this.y;
if (interstitialAdListener != null) {
interstitialAdListener.onAdLoaded();
} else {
FullScreenVideoAdListener fullScreenVideoAdListener = this.z;
if (fullScreenVideoAdListener != null) {
fullScreenVideoAdListener.onAdLoaded();
} else {
RewardVideoAdListener rewardVideoAdListener = this.A;
if (rewardVideoAdListener != null) {
rewardVideoAdListener.onRewardVideoAdLoaded();
}
}
}
}
B();
}
public void l() {
if (this.aG || this.a == null) {
return;
}
if (d() || e()) {
this.aG = true;
c.y g = this.a.g();
if (g == null || g.a() != 1) {
return;
}
c(g.b());
}
}
public void m() {
if (this.q) {
if (this.g == n.SPLASH) {
a(this.az);
} else {
a(this.s);
}
}
}
public void n() {
RewardVideoAdListener rewardVideoAdListener;
if (this.aF || !this.I || (rewardVideoAdListener = this.A) == null) {
return;
}
this.aF = true;
rewardVideoAdListener.onRewardVideoAdComplete();
}
public void o() {
if (this.aE || this.aD == null) {
return;
}
this.aE = true;
AppCompatTextView appCompatTextView = this.M;
if (appCompatTextView != null) {
appCompatTextView.setText("恭喜获得奖励");
}
if (!TextUtils.isEmpty(this.aB)) {
p();
} else {
Pair<String, Integer> pair = this.aD;
a((String) pair.first, ((Integer) pair.second).intValue());
}
}
public void p() {
new r(this.aB).a(new HTTPGet.ResponseListener() {
@Override
public void getResponse(boolean z, String str) {
if (z && !TextUtils.isEmpty(str)) {
try {
if (new JSONObject(str).optBoolean("isValid") && AdViewImpl.this.aD != null) {
AdViewImpl adViewImpl = AdViewImpl.this;
adViewImpl.a((String) adViewImpl.aD.first, ((Integer) AdViewImpl.this.aD.second).intValue());
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
} else if (AdViewImpl.this.aH > 0) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AdViewImpl.this.p();
AdViewImpl.J(AdViewImpl.this);
}
}, 200L);
}
if (z || AdViewImpl.this.aH == 0) {
AdViewImpl.this.d(z);
}
}
}).execute();
}
public void t() {
ServerResponse serverResponse = this.a;
if (serverResponse == null || !serverResponse.I() || this.a.x() || !this.ak) {
return;
}
Map<String, Object> T = this.a.T();
if (T != null && !T.isEmpty()) {
Intent intent = new Intent(getContext(), (Class<?>) EndingPageActivity.class);
intent.setFlags(268435456);
Bundle bundle = new Bundle();
bundle.putSerializable("mapData", (Serializable) T);
intent.putExtra("bundleData", bundle);
getContext().startActivity(intent);
this.aN = new k.a() {
@Override
public void a(String str) {
if ("adClick".equals(str)) {
AdViewImpl adViewImpl = AdViewImpl.this;
adViewImpl.a(adViewImpl.getRandomClickPosition());
} else {
if (!"feedBackClick".equals(str) || TextUtils.isEmpty(AdViewImpl.this.aC)) {
return;
}
ViewUtil.openLocalBrowser(AdViewImpl.this.aC, 0);
}
}
};
com.octopus.ad.internal.k.a().a(this.aN);
}
this.ak = false;
}
public boolean b() {
return n.SPLASH == this.g;
}
public boolean c() {
return n.INTERSTITIAL == this.g;
}
public boolean d() {
return n.REWARD == this.g;
}
public boolean e() {
return n.FULLSCREEN == this.g;
}
public boolean f() {
return this.ax;
}
public boolean g() {
long currentTimeMillis;
long j;
com.octopus.ad.internal.d dVar = this.d;
if (dVar != null && dVar.g() > 0) {
currentTimeMillis = System.currentTimeMillis();
j = this.d.g();
} else {
currentTimeMillis = System.currentTimeMillis();
j = this.ah;
}
return currentTimeMillis - j <= this.ai;
}
public void h() {
ProgressBar progressBar = this.T;
if (progressBar != null) {
progressBar.setVisibility(8);
}
}
public boolean i() {
return this.G;
}
public Activity b(View view) {
return (Activity) a(view);
}
public void c(View view) {
try {
ViewUtil.removeChildFromParent(this.U);
ViewUtil.removeChildFromParent(this.V);
ViewParent parent = j() ? view.getParent() : this;
if (parent instanceof FrameLayout) {
if (this.U != null) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, 42, 8388691);
layoutParams.setMargins(30, 0, 0, 50);
((FrameLayout) parent).addView(this.U, layoutParams);
this.U.setVisibility(0);
}
if (this.V != null) {
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-1, 42, 8388693);
layoutParams2.setMargins(0, 0, 30, 50);
((FrameLayout) parent).addView(this.V, layoutParams2);
this.V.setVisibility(0);
}
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void d(View view) {
try {
ViewUtil.removeChildFromParent(this.N);
this.l = getMediaType() == n.INTERSTITIAL ? 10 : 30;
this.k = this.au == null ? 0 : 30;
this.aC = UrlUtil.replaceFeedBackUrl("https://www.adintl.cn/sdkFeedback.html?slotId=${SLOT_ID}&sdkVersion=${SDK_VERSION}&deviceId=${DEVICE_ID}", getAdSlotId(), Octopus.getOaid(getContext()));
this.N = ViewUtil.createFeedBackButton(getContext(), this.aC, this.k, this.l, this.w);
ViewParent parent = j() ? view.getParent() : this;
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(this.N);
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void e(View view) {
int screenWidth;
try {
AppCompatTextView appCompatTextView = this.S;
if (appCompatTextView != null) {
ViewUtil.removeChildFromParent(appCompatTextView);
ViewParent parent = j() ? view.getParent() : this;
if (parent instanceof FrameLayout) {
int i = -1;
ServerResponse serverResponse = this.a;
if (serverResponse != null) {
int l = serverResponse.l();
if (getMediaType().equals(n.INTERSTITIAL) && l > 0 && (i = (int) (l * o.a().o)) > (screenWidth = ViewUtil.getScreenWidth(getContext()))) {
i = screenWidth;
}
}
((FrameLayout) parent).addView((View) this.S, (ViewGroup.LayoutParams) new FrameLayout.LayoutParams(i, -2, 80));
}
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void b(Context context) {
try {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.OctopusAlertDialogStyle);
View inflate = LayoutInflater.from(context).inflate(R.layout.oct_dialog_close_confirm, (ViewGroup) null);
builder.setView(inflate);
TextView textView = (TextView) inflate.findViewById(R.id.tv_title);
TextView textView2 = (TextView) inflate.findViewById(R.id.tv_quit);
TextView textView3 = (TextView) inflate.findViewById(R.id.tv_wait);
textView.setText(String.format(Locale.US, "观看满 %d 秒即可获得奖励\n确认离开吗?", Integer.valueOf(this.ae)));
final AlertDialog create = builder.create();
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
create.dismiss();
AdViewImpl.this.y();
}
});
textView3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
create.dismiss();
}
});
create.show();
AdVideoView adVideoView = this.au;
if (adVideoView != null) {
adVideoView.m();
} else {
com.octopus.ad.a.a aVar = this.P;
if (aVar != null) {
aVar.b();
}
}
create.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (AdViewImpl.this.au != null) {
AdViewImpl.this.au.n();
} else if (AdViewImpl.this.P != null) {
AdViewImpl.this.P.c();
}
}
});
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(int i, int i4, int i5, int i6) {
this.k = i;
this.l = i4;
this.m = i5;
this.n = i6;
}
public void a(Context context, AttributeSet attributeSet) {
com.octopus.ad.utils.b.f.c("OctopusAd_Time", "AdViewImpl setup 开始 mRequestId : " + this.aA);
setBackgroundColor(0);
this.D = new b(this.C);
this.aA = StringUtil.createRequestId();
this.d = new com.octopus.ad.internal.d(context, this.aA);
try {
HaoboLog.setErrorContext(getContext().getApplicationContext());
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
setPadding(0, 0, 0, 0);
this.f = new com.octopus.ad.internal.c(this);
this.aI = new l(getContext());
this.aJ = new com.octopus.ad.utils.k(getContext());
this.aK = new j(getContext());
}
public void d(final boolean z) {
new Thread(new Runnable() {
@Override
public void run() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("slotId", AdViewImpl.this.getAdSlotId());
jSONObject.put("reqId", AdViewImpl.this.getRequestId());
jSONObject.put("callbackUrl", AdViewImpl.this.aB);
jSONObject.put("isSuccess", z);
String a5 = com.octopus.ad.utils.b.a.a(com.octopus.ad.utils.b.e.a(), jSONObject.toString());
if (a5 != null) {
com.octopus.ad.utils.b.d.a(o.a().n() + "/sdk/rewardUrlReport?v=2", a5.getBytes());
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
}).start();
}
private void e(boolean z) {
com.octopus.ad.utils.b.f.a("OctopusAd", "octopus clickable = " + z);
if (z) {
return;
}
a(new View.OnTouchListener() {
@Override
@SuppressLint({"ClickableViewAccessibility"})
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
}
public void c(boolean z) {
setOpensNativeBrowser(z);
}
private void c(int i) {
try {
View adView = getAdView();
if (adView == null) {
return;
}
ViewParent parent = j() ? adView.getParent() : this;
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.oct_countdown_click, (ViewGroup) null);
int i4 = R.id.rl_auto;
this.W = (LinearLayout) inflate.findViewById(i4);
final TextView textView = (TextView) inflate.findViewById(R.id.tv_auto);
TextView textView2 = (TextView) inflate.findViewById(R.id.tv_stop);
this.W.setVisibility(0);
com.octopus.ad.a.a aVar = new com.octopus.ad.a.a(i * 1000, 50L);
this.Q = aVar;
aVar.a(new com.octopus.ad.a.b() {
public void a(long j) {
int i5 = (int) ((j / 1000) + 1);
textView.setText(String.format(Locale.US, "%d秒后自动跳转详情页", Integer.valueOf(i5)));
if (i5 <= 3) {
textView.setBackgroundResource(R.drawable.oct_bg_common_orange);
}
}
public void b() {
}
public void a() {
AdViewImpl.this.at = 3;
AdViewImpl.this.ao = true;
if (AdViewImpl.this.av != null) {
AdViewImpl.this.av.a(AdViewImpl.this.at, AdViewImpl.this.getRandomClickPosition());
}
AdViewImpl.this.E();
}
});
this.Q.a();
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AdViewImpl.this.E();
}
});
inflate.findViewById(i4).setVisibility(0);
o a5 = o.a();
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2, 80);
layoutParams.setMargins(0, 0, 0, (int) TypedValue.applyDimension(1, 50.0f, a5.r()));
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(inflate, layoutParams);
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void b(int i) {
if (this.aP) {
return;
}
SplashAdListener splashAdListener = this.x;
if (splashAdListener != null) {
splashAdListener.onAdFailedToLoad(i);
} else {
InterstitialAdListener interstitialAdListener = this.y;
if (interstitialAdListener != null) {
interstitialAdListener.onAdFailedToLoad(i);
} else {
FullScreenVideoAdListener fullScreenVideoAdListener = this.z;
if (fullScreenVideoAdListener != null) {
fullScreenVideoAdListener.onAdFailedToLoad(i);
} else {
RewardVideoAdListener rewardVideoAdListener = this.A;
if (rewardVideoAdListener != null) {
rewardVideoAdListener.onRewardVideoAdFailedToLoad(i);
}
}
}
}
this.aP = true;
}
@Override
public boolean a() {
com.octopus.ad.internal.d dVar = this.d;
return (dVar == null || !dVar.o() || this.e == null) ? false : true;
}
public void a(ViewGroup viewGroup) {
try {
if ((this.p && !this.o) || !this.r) {
this.q = true;
this.az = viewGroup;
return;
}
if (this.ay) {
return;
}
this.ay = true;
ViewUtil.removeChildFromParent(this);
if (viewGroup != null) {
this.t = viewGroup;
}
this.as = this.a.N();
this.al = this.a.O();
this.ar = this.a.M();
if (this.x != null) {
Log.e("OctopusAd", "enter Octopus ad show");
this.av.b.a(g(), new com.octopus.ad.a() {
public void a(boolean z) {
AdViewImpl.this.a(z);
}
});
}
u();
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public AdViewImpl(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public AdViewImpl(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.b = new a();
this.C = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
}
};
this.d = null;
this.e = null;
this.G = false;
this.J = false;
this.h = false;
this.K = false;
this.ae = 0;
this.af = 0;
this.aj = true;
this.ak = true;
this.at = 0;
this.ax = false;
this.ay = false;
this.o = false;
this.p = false;
this.q = false;
this.r = false;
this.aD = null;
this.aE = false;
this.aF = false;
this.aH = 2;
this.aO = new c() {
@Override
public void a() {
if (AdViewImpl.this.am || AdViewImpl.this.an || AdViewImpl.this.ao) {
return;
}
AdViewImpl.this.x();
}
};
this.aP = false;
a(context, attributeSet);
}
public void b(boolean z) {
ServerResponse serverResponse;
if (this.o || (serverResponse = this.a) == null || serverResponse.n() != 0) {
return;
}
this.o = true;
SplashAdListener splashAdListener = this.x;
if (splashAdListener != null) {
splashAdListener.onAdCacheLoaded(z);
return;
}
InterstitialAdListener interstitialAdListener = this.y;
if (interstitialAdListener != null) {
interstitialAdListener.onAdCacheLoaded(z);
return;
}
FullScreenVideoAdListener fullScreenVideoAdListener = this.z;
if (fullScreenVideoAdListener != null) {
fullScreenVideoAdListener.onAdCacheLoaded(z);
return;
}
RewardVideoAdListener rewardVideoAdListener = this.A;
if (rewardVideoAdListener != null) {
rewardVideoAdListener.onRewardVideoCached(z);
}
}
public void a(boolean z) {
ServerResponse serverResponse;
if (this.H) {
return;
}
this.H = true;
this.I = z;
if (z && (serverResponse = this.a) != null) {
this.I = serverResponse.L();
}
if (this.I) {
SplashAdListener splashAdListener = this.x;
if (splashAdListener != null) {
splashAdListener.onAdShown();
} else {
InterstitialAdListener interstitialAdListener = this.y;
if (interstitialAdListener != null) {
interstitialAdListener.onAdShown();
} else {
FullScreenVideoAdListener fullScreenVideoAdListener = this.z;
if (fullScreenVideoAdListener != null) {
fullScreenVideoAdListener.onAdShown();
} else {
RewardVideoAdListener rewardVideoAdListener = this.A;
if (rewardVideoAdListener != null) {
rewardVideoAdListener.onRewardVideoAdShown();
}
}
}
}
}
if (this.B == null || !getRequestId().equals(this.B.a())) {
return;
}
o.a().g.remove(this.B.b());
}
private void b(String str) {
View adView;
View a5;
try {
if (this.aK == null || (adView = getAdView()) == null || (a5 = this.aK.a(ViewUtil.px2dip(getContext(), adView.getWidth()), ViewUtil.px2dip(getContext(), adView.getHeight()), str, true)) == null) {
return;
}
final com.octopus.ad.model.d dVar = new com.octopus.ad.model.d(1);
a5.setOnTouchListener(new View.OnTouchListener() {
@Override
@SuppressLint({"ClickableViewAccessibility"})
public boolean onTouch(View view, MotionEvent motionEvent) {
AdViewImpl adViewImpl = AdViewImpl.this;
adViewImpl.a(motionEvent, adViewImpl.as, dVar);
return true;
}
});
ViewParent parent = j() ? adView.getParent() : this;
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(a5);
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public static void a(ServerResponse serverResponse, final c cVar) {
c.w G;
c.g a5;
if (serverResponse == null || (G = serverResponse.G()) == null || (a5 = G.a()) == null) {
return;
}
if (a5.a() == 1) {
com.octopus.ad.utils.e.a(new Runnable() {
@Override
public void run() {
try {
c cVar2 = c.this;
if (cVar2 != null) {
cVar2.a();
}
} catch (Throwable th) {
com.octopus.ad.utils.b.f.a("OctopusAd", "A Throwable Caught", th);
}
}
}, a5.b());
}
}
public static boolean a(ServerResponse serverResponse) {
c.w G;
c.g a5;
return (serverResponse == null || (G = serverResponse.G()) == null || (a5 = G.a()) == null || a5.c() != 1) ? false : true;
}
public void a(com.octopus.ad.model.d dVar) {
com.octopus.ad.internal.view.a aVar = this.av;
if (aVar != null) {
aVar.a(this.at, dVar);
}
}
public boolean a(a.C0008a c0008a) {
com.octopus.ad.internal.c cVar;
this.e = c0008a;
if (!a()) {
SplashAdListener splashAdListener = this.x;
if (splashAdListener != null) {
splashAdListener.onAdFailedToLoad(80000);
} else {
InterstitialAdListener interstitialAdListener = this.y;
if (interstitialAdListener != null) {
interstitialAdListener.onAdFailedToLoad(80000);
} else {
FullScreenVideoAdListener fullScreenVideoAdListener = this.z;
if (fullScreenVideoAdListener != null) {
fullScreenVideoAdListener.onAdFailedToLoad(80000);
} else {
RewardVideoAdListener rewardVideoAdListener = this.A;
if (rewardVideoAdListener != null) {
rewardVideoAdListener.onRewardVideoAdFailedToLoad(80000);
}
}
}
}
return false;
}
if (getWindowVisibility() == 0 && (cVar = this.f) != null) {
cVar.a();
this.f.d();
this.f.c();
this.G = true;
this.i = 1;
this.j = 0;
return true;
}
com.octopus.ad.internal.c cVar2 = this.f;
if (cVar2 != null) {
cVar2.a();
this.f.d();
this.f.c();
this.G = true;
this.i = 1;
this.j = 0;
}
return false;
}
public Context a(View view) {
Context context;
if (view == null) {
return null;
}
if (view.getContext() instanceof MutableContextWrapper) {
context = ((MutableContextWrapper) view.getContext()).getBaseContext();
} else {
context = getContext();
}
if (context instanceof Activity) {
return context;
}
return null;
}
public void a(ServerResponse.AdLogoInfo adLogoInfo, ServerResponse.AdLogoInfo adLogoInfo2, int i) {
try {
ViewUtil.removeChildFromParent(this.U);
ViewUtil.removeChildFromParent(this.V);
float f = 1.0f;
float f4 = i > 0 ? i / 640.0f : 1.0f;
if (f4 <= 1.0f) {
f = f4;
}
if (!TextUtils.isEmpty(adLogoInfo.getAdurl())) {
this.U = ViewUtil.createAdImageView(new MutableContextWrapper(getContext()), adLogoInfo, 0, 8388611, f);
}
if (TextUtils.isEmpty(adLogoInfo2.getAdurl())) {
return;
}
this.V = ViewUtil.createLogoImageView(new MutableContextWrapper(getContext()), adLogoInfo2, 0, f);
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void a(ServerResponse.AdLogoInfo adLogoInfo, int i) {
try {
ViewUtil.removeChildFromParent(this.U);
ViewUtil.removeChildFromParent(this.V);
float f = 1.0f;
float f4 = i > 0 ? i / 640.0f : 1.0f;
if (f4 <= 1.0f) {
f = f4;
}
if (!TextUtils.isEmpty(adLogoInfo.getAdurl())) {
this.V = ViewUtil.createLogoImageView(new MutableContextWrapper(getContext()), adLogoInfo, 6, f);
}
ServerResponse.AdLogoInfo adLogoInfo2 = new ServerResponse.AdLogoInfo();
adLogoInfo2.setType(ServerResponse.AdLogoInfo.TYPE_TEXT);
adLogoInfo2.setAdurl("广告");
if (TextUtils.isEmpty(adLogoInfo2.getAdurl())) {
return;
}
this.U = ViewUtil.createAdImageView(new MutableContextWrapper(getContext()), adLogoInfo2, 3, 8388613, f);
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void a(final AdVideoView adVideoView, boolean z) {
try {
ViewUtil.removeChildFromParent(this.R);
AppCompatImageView createMuteButton = ViewUtil.createMuteButton(getContext(), z, this.l, this.w);
this.R = createMuteButton;
createMuteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AdVideoView adVideoView2;
if (AdViewImpl.this.R == null || (adVideoView2 = adVideoView) == null) {
return;
}
AdViewImpl.this.R.setImageResource(adVideoView2.g() ? R.drawable.oct_voice_off : R.drawable.oct_voice_on);
}
});
ViewParent parent = adVideoView.getParent();
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(this.R);
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(AdVideoView adVideoView) {
try {
ProgressBar progressBar = this.T;
if (progressBar == null) {
this.T = ViewUtil.createLoadingView(getContext(), this.w);
ViewParent parent = adVideoView.getParent();
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(this.T);
}
} else {
progressBar.setVisibility(0);
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
public void a(ComplianceInfo complianceInfo, float f) {
this.S = ViewUtil.createComplianceView(getContext(), complianceInfo, f, false);
}
public void a(int i, int i4, View view) {
try {
ViewUtil.removeChildFromParent(this.O);
ViewUtil.removeChildFromParent(this.M);
if (this.O == null) {
ImageView createImageCloseButton = ViewUtil.createImageCloseButton(getContext(), this.l, this.w);
this.O = createImageCloseButton;
createImageCloseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
AdViewImpl.this.y();
}
});
}
if (i4 > 0) {
this.ae = i4;
} else if (i > 0) {
this.ae = i;
}
if (this.ae > 0) {
this.O.setVisibility(8);
this.M = ViewUtil.createInterstitialCountDown(getContext(), this.l, this.w);
com.octopus.ad.a.a aVar = new com.octopus.ad.a.a(this.ae * 1000, 50L);
this.P = aVar;
aVar.a(new com.octopus.ad.a.b() {
public void a(long j) {
if (AdViewImpl.this.M == null) {
return;
}
AdViewImpl.this.M.setText(String.valueOf((int) ((j / 1000) + 1)));
}
public void b() {
}
public void a() {
ServerResponse serverResponse = AdViewImpl.this.a;
if (serverResponse == null || !serverResponse.x()) {
if (AdViewImpl.this.M == null || AdViewImpl.this.O == null) {
return;
}
AdViewImpl.this.M.setVisibility(8);
AdViewImpl.this.O.setVisibility(0);
return;
}
if (AdViewImpl.this.M != null) {
AdViewImpl.this.M.setText("0");
}
AdViewImpl.this.K = true;
AdViewImpl.this.A();
}
});
this.P.a();
}
ViewParent parent = j() ? view.getParent() : this;
if (parent instanceof FrameLayout) {
ImageView imageView = this.O;
if (imageView != null) {
((FrameLayout) parent).addView(imageView);
}
View view2 = this.M;
if (view2 != null) {
((FrameLayout) parent).addView(view2);
}
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(int i) {
try {
com.octopus.ad.a.a aVar = this.P;
if (aVar != null) {
aVar.d();
}
if (i <= 0) {
this.ae = 5;
} else {
this.ae = i;
}
this.M = ViewUtil.createCountDown(getContext(), this.ae, this.l, this.m, this.w);
com.octopus.ad.a.a aVar2 = new com.octopus.ad.a.a(this.ae * 1000, 50L);
this.P = aVar2;
aVar2.a(new com.octopus.ad.a.b() {
public void a(long j) {
try {
if (AdViewImpl.this.M == null) {
return;
}
AdViewImpl.this.getAdDispatcher().a(j);
AdViewImpl.this.M.setText(String.format(Locale.US, "跳过 %d", Integer.valueOf((int) ((j / 1000) + 1))));
} catch (Exception unused) {
}
}
public void b() {
}
public void a() {
try {
if (AdViewImpl.this.M != null) {
AdViewImpl.this.M.setText("跳过 0");
}
a aVar3 = AdViewImpl.this.b;
if (aVar3 != null) {
aVar3.a(true);
if (AdViewImpl.this.b.a()) {
if (AdViewImpl.this.b.c() == a.EnumC0014a.UNCHANGE || AdViewImpl.this.b.c() == a.EnumC0014a.STATE_PREPARE_CHANGE) {
AdViewImpl.this.K = true;
if (AdViewImpl.this.getAdDispatcher() != null) {
AdViewImpl.this.getAdDispatcher().a();
}
}
}
}
} catch (Exception unused) {
}
}
});
this.P.a();
ServerResponse serverResponse = this.a;
if (serverResponse != null) {
this.al = serverResponse.O();
this.a.a(this.P);
}
this.M.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AdViewImpl.this.y();
}
});
AppCompatTextView appCompatTextView = this.M;
if (appCompatTextView != null) {
ViewUtil.removeChildFromParent(appCompatTextView);
addView(this.M);
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(int i, int i4, int i5) {
try {
ViewUtil.removeChildFromParent(this.O);
ViewUtil.removeChildFromParent(this.M);
com.octopus.ad.a.a aVar = this.P;
if (aVar != null) {
aVar.d();
}
if (this.O == null) {
ImageView createImageCloseButton = ViewUtil.createImageCloseButton(getContext(), this.l, 1.0f);
this.O = createImageCloseButton;
createImageCloseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (AdViewImpl.this.aE) {
AdViewImpl.this.y();
return;
}
View adView = AdViewImpl.this.getAdView();
if (adView == null) {
return;
}
AdViewImpl.this.b(adView.getContext());
}
});
}
if (i != -1 && this.M == null) {
this.m = 30;
this.ae = Math.min(i, i5);
this.M = ViewUtil.createCountDown(getContext(), this.ae, this.l, this.m, this.w);
if (i4 > 0) {
this.O.setVisibility(8);
int i6 = this.ae;
if (i6 > i4) {
this.af = i6 - i4;
}
}
com.octopus.ad.a.a aVar2 = new com.octopus.ad.a.a(this.ae * 1000, 50L);
this.P = aVar2;
aVar2.a(new com.octopus.ad.a.b() {
public void a(long j) {
if (AdViewImpl.this.M == null || AdViewImpl.this.O == null || AdViewImpl.this.aE) {
return;
}
int i7 = (int) ((j / 1000) + 1);
AdViewImpl.this.M.setText(String.format(Locale.US, "奖励将于 %d 秒后发放", Integer.valueOf(i7)));
if (i7 <= AdViewImpl.this.af && AdViewImpl.this.O.getVisibility() == 8) {
AdViewImpl.this.O.setVisibility(0);
}
if (AdViewImpl.this.ae - i7 == 2 && AdViewImpl.this.aj) {
AdViewImpl.this.F();
}
}
public void b() {
}
public void a() {
if (AdViewImpl.this.O != null) {
AdViewImpl.this.O.setVisibility(0);
}
AdViewImpl.this.o();
AdViewImpl.this.n();
ServerResponse serverResponse = AdViewImpl.this.a;
if (serverResponse == null || !serverResponse.x()) {
if (AdViewImpl.this.au == null) {
AdViewImpl.this.t();
}
} else {
AdViewImpl.this.K = true;
AdViewImpl.this.A();
}
}
});
this.P.a();
AdVideoView adVideoView = this.au;
if (adVideoView != null) {
adVideoView.setCountDownTimer(this.P);
}
}
View adView = getAdView();
if (adView == null) {
return;
}
ViewParent parent = j() ? adView.getParent() : this;
if (parent instanceof FrameLayout) {
ImageView imageView = this.O;
if (imageView != null) {
((FrameLayout) parent).addView(imageView);
}
View view = this.M;
if (view != null) {
((FrameLayout) parent).addView(view);
}
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(HashMap hashMap) {
if (!hashMap.isEmpty() && hashMap.containsKey("REWARD_ITEM")) {
String str = (String) hashMap.get("REWARD_ITEM");
try {
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
this.aB = jSONObject.optString("callback_url");
this.aD = Pair.create(jSONObject.optString("name"), Integer.valueOf(jSONObject.optInt("amount")));
if (TextUtils.isEmpty(this.aB) || getAdParameters() == null) {
return;
}
String extraData = getExtraData();
if (!TextUtils.isEmpty(extraData)) {
this.aB += "&extra=" + extraData;
}
String userId = getUserId();
if (TextUtils.isEmpty(userId)) {
return;
}
this.aB += "&userId=" + userId;
return;
}
this.aD = Pair.create("", 0);
} catch (JSONException unused) {
HaoboLog.e(HaoboLog.jsonLogTag, "Error parse reward item: " + str);
this.aD = Pair.create("", 0);
}
}
}
public void a(String str, int i) {
RewardVideoAdListener rewardVideoAdListener;
if (!this.I || (rewardVideoAdListener = this.A) == null) {
return;
}
rewardVideoAdListener.onRewarded(new t(str, i));
}
private void a(c.u uVar) {
View adView;
try {
if (this.aI == null || uVar == null || (adView = getAdView()) == null) {
return;
}
this.aI.a(uVar);
this.aI.a(adView);
View a5 = this.aI.a(adView, adView, 10.0f, uVar.e(), getMediaType());
if (a5 != null) {
if (uVar.b() == 1) {
this.at = 7;
}
this.aI.a(new l.a() {
@Override
public void a(com.octopus.ad.model.d dVar) {
AdViewImpl.this.a(dVar);
if (AdViewImpl.this.aL != null) {
AdViewImpl.this.aL.onShakeTrigger(1, dVar.m(), dVar.n());
}
}
});
final com.octopus.ad.model.d dVar = new com.octopus.ad.model.d(1);
a5.setOnTouchListener(new View.OnTouchListener() {
@Override
@SuppressLint({"ClickableViewAccessibility"})
public boolean onTouch(View view, MotionEvent motionEvent) {
AdViewImpl adViewImpl = AdViewImpl.this;
adViewImpl.a(motionEvent, adViewImpl.as, dVar);
return true;
}
});
ViewParent parent = j() ? adView.getParent() : this;
if ((parent instanceof FrameLayout) && uVar.g() == 1) {
((FrameLayout) parent).addView(a5);
}
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
public void a(MotionEvent motionEvent, boolean z, com.octopus.ad.model.d dVar) {
try {
if (motionEvent.getAction() == 0) {
dVar.a(motionEvent.getRawX());
dVar.b(motionEvent.getRawY());
dVar.a(String.valueOf(System.currentTimeMillis()));
if (!z || this.J) {
return;
}
int a5 = i.a(150) + 50;
dVar.c(motionEvent.getRawX());
dVar.d(motionEvent.getRawY());
dVar.b(String.valueOf(System.currentTimeMillis() + a5));
View adView = getAdView();
if (adView != null) {
dVar.a(adView.getWidth());
dVar.b(adView.getHeight());
}
a(dVar);
this.J = true;
return;
}
if (motionEvent.getAction() == 1) {
dVar.c(motionEvent.getRawX());
dVar.d(motionEvent.getRawY());
dVar.b(String.valueOf(System.currentTimeMillis()));
View adView2 = getAdView();
if (adView2 != null) {
dVar.a(adView2.getWidth());
dVar.b(adView2.getHeight());
}
a(dVar);
}
} catch (Exception e) {
com.octopus.ad.utils.b.f.a("OctopusAd", "An Exception Caught", e);
}
}
private void a(String str) {
View a5;
try {
com.octopus.ad.utils.k kVar = this.aJ;
if (kVar != null) {
kVar.a();
View adView = getAdView();
if (adView == null || (a5 = this.aJ.a(ViewUtil.px2dip(getContext(), adView.getWidth()), ViewUtil.px2dip(getContext(), adView.getHeight()), str)) == null) {
return;
}
a("up", 100, new k.a() {
@Override
public void a(com.octopus.ad.model.d dVar) {
AdViewImpl.this.a(dVar);
}
});
ViewParent parent = j() ? adView.getParent() : this;
if (parent instanceof FrameLayout) {
((FrameLayout) parent).addView(a5);
}
}
} catch (Exception e) {
Log.e("OctopusAd", "An Exception Caught: " + e.getMessage());
}
}
private void a(final String str, int i, final k.a aVar) {
if (aVar != null) {
this.aJ.a(aVar);
}
final int dip2px = ViewUtil.dip2px(getContext(), i);
final com.octopus.ad.model.d dVar = new com.octopus.ad.model.d(3);
View adView = getAdView();
if (adView == null) {
return;
}
dVar.a(adView.getWidth());
dVar.b(adView.getHeight());
setScrollClick(new View.OnTouchListener() {
public float a;
public float b;
public float c;
public float d;
public float e;
public float f;
@Override
@SuppressLint({"ClickableViewAccessibility"})
public boolean onTouch(View view, MotionEvent motionEvent) {
k.a aVar2;
k.a aVar3;
k.a aVar4;
k.a aVar5;
int action = motionEvent.getAction();
if (action == 0) {
this.a = motionEvent.getX();
this.b = motionEvent.getY();
this.c = motionEvent.getX();
this.d = motionEvent.getY();
this.e = motionEvent.getRawX();
this.f = motionEvent.getRawY();
dVar.a(motionEvent.getRawX());
dVar.b(motionEvent.getRawY());
dVar.a(String.valueOf(System.currentTimeMillis()));
} else if (action == 1) {
dVar.c(motionEvent.getRawX());
dVar.d(motionEvent.getRawY());
dVar.b(String.valueOf(System.currentTimeMillis()));
float f = this.d;
float f4 = this.b;
if (f - f4 <= com.sigmob.sdk.base.blurkit.c.d || Math.abs(f - f4) <= dip2px) {
float f5 = this.d;
float f6 = this.b;
if (f5 - f6 >= com.sigmob.sdk.base.blurkit.c.d || Math.abs(f5 - f6) <= dip2px) {
float f7 = this.c;
float f8 = this.a;
if (f7 - f8 >= com.sigmob.sdk.base.blurkit.c.d || Math.abs(f7 - f8) <= dip2px) {
float f9 = this.c;
float f10 = this.a;
if (f9 - f10 < com.sigmob.sdk.base.blurkit.c.d && Math.abs(f9 - f10) > dip2px && "right".equalsIgnoreCase(str) && (aVar2 = aVar) != null) {
aVar2.a(dVar);
}
} else if ("left".equalsIgnoreCase(str) && (aVar3 = aVar) != null) {
aVar3.a(dVar);
}
} else if ("up".equalsIgnoreCase(str) && (aVar4 = aVar) != null) {
aVar4.a(dVar);
}
} else if ("down".equalsIgnoreCase(str) && (aVar5 = aVar) != null) {
aVar5.a(dVar);
}
} else if (action == 2) {
this.c = motionEvent.getX();
this.d = motionEvent.getY();
}
return true;
}
});
}
public void a(View.OnTouchListener onTouchListener) {
View adView = getAdView();
if (adView == null) {
return;
}
adView.setOnTouchListener(onTouchListener);
}
}