整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 MQBannerAdView.java 源代码,内容仅作参考
package com.moqi.sdk.view.banner;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Movie;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.FilterWord;
import com.bytedance.sdk.openadsdk.TTAdDislike;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.moqi.sdk.MQSDK;
import com.moqi.sdk.R;
import com.moqi.sdk.activity.MQWebViewActivity;
import com.moqi.sdk.callback.BannerAdCallBack;
import com.moqi.sdk.download2.a;
import com.moqi.sdk.h.b;
import com.moqi.sdk.http.c;
import com.moqi.sdk.model.KuaiShuaAd;
import com.moqi.sdk.model.MoQiAd;
import com.moqi.sdk.utils.ScreenUtils;
import com.moqi.sdk.utils.b0;
import com.moqi.sdk.utils.h0;
import com.moqi.sdk.utils.t;
import com.moqi.sdk.utils.v;
import com.moqi.sdk.utils.y;
import com.moqi.sdk.view.banner.a;
import com.qq.e.ads.banner2.UnifiedBannerADListener;
import com.qq.e.ads.banner2.UnifiedBannerView;
import com.qq.e.comm.managers.GDTAdSdk;
import com.qq.e.comm.util.AdError;
import java.io.File;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class MQBannerAdView extends RelativeLayout implements com.moqi.sdk.j.a, View.OnClickListener {
private int adtype;
private boolean autoing;
private FrameLayout bannerContainer;
private int click;
private int errorTimes;
private TextView go;
private boolean hasload;
private ImageView iv_apk_icon;
private LinearLayout ll_logo;
private LinearLayout ll_type2;
private MoQiAd mAd;
private ImageView mAdclose;
private BannerAdCallBack mBannerAdCallBack;
private Activity mContent;
private ImageView mImageView;
private KuaiShuaAd mKsAd;
private y mMoQiImageDrawable;
private TTAdNative mTTAdNative;
private String madPlcId;
private UnifiedBannerView mqGdtBannerView;
private String orderNo;
private int platId;
private b0 pollingUtil;
private RelativeLayout rl_tdbanner;
private Runnable runnable;
private int showTimes;
private TextView tv_info;
private TextView tv_name;
public class a implements Runnable {
a() {
}
@Override
public void run() {
MQBannerAdView.this.bannerContainer.removeAllViews();
if (MQBannerAdView.this.mqGdtBannerView != null) {
MQBannerAdView.this.bannerContainer.addView(MQBannerAdView.this.mqGdtBannerView, new FrameLayout.LayoutParams(MQBannerAdView.this.bannerContainer.getWidth(), Math.round(MQBannerAdView.this.bannerContainer.getWidth() / 6.4f)));
}
}
}
public class b implements TTAdNative.NativeExpressAdListener {
b() {
}
@Override
public void onError(int i, String str) {
if (MQBannerAdView.this.errorTimes == 0) {
MQBannerAdView.access$108(MQBannerAdView.this);
MQBannerAdView.this.inittt();
return;
}
MQBannerAdView.this.bannerContainer.removeAllViews();
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(i, str);
}
MQBannerAdView mQBannerAdView = MQBannerAdView.this;
mQBannerAdView.upAdStats(4, i + "-" + str + "appID-" + MQBannerAdView.this.mKsAd.appID + "posID-" + MQBannerAdView.this.mKsAd.posID);
}
@Override
public void onNativeExpressAdLoad(List<TTNativeExpressAd> list) {
if (list == null || list.size() == 0) {
return;
}
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onADReceive();
}
TTNativeExpressAd tTNativeExpressAd = list.get(0);
tTNativeExpressAd.setSlideIntervalTime(com.moqi.sdk.d.T * 1000);
MQBannerAdView.this.bindAdListener(tTNativeExpressAd);
tTNativeExpressAd.render();
}
}
public class c implements TTNativeExpressAd.ExpressAdInteractionListener {
c() {
}
@Override
public void onAdClicked(View view, int i) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdClick();
}
MQBannerAdView.this.upAdStats(2, "");
}
@Override
public void onAdShow(View view, int i) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdShow();
}
if (MQBannerAdView.this.showTimes <= 0) {
MQBannerAdView.this.upAdStats(0, "");
}
MQBannerAdView.access$008(MQBannerAdView.this);
}
@Override
public void onRenderFail(View view, String str, int i) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(i, str);
}
MQBannerAdView mQBannerAdView = MQBannerAdView.this;
mQBannerAdView.upAdStats(4, i + "-" + str);
}
@Override
public void onRenderSuccess(View view, float f, float f2) {
MQBannerAdView.this.bannerContainer.removeAllViews();
if (view != null) {
MQBannerAdView.this.bannerContainer.addView(view);
}
}
}
public class d implements a.c {
d() {
}
@Override
public void a(FilterWord filterWord) {
MQBannerAdView.this.bannerContainer.removeAllViews();
}
}
public class e implements TTAdDislike.DislikeInteractionCallback {
e() {
}
@Override
public void onCancel() {
}
@Override
public void onSelected(int i, String str, boolean z) {
MQBannerAdView.this.bannerContainer.removeAllViews();
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdClose();
}
if (MQBannerAdView.this.mKsAd == null || MQBannerAdView.this.mKsAd.adID == null) {
return;
}
MQSDK.getInstance().adStat(MQBannerAdView.this.madPlcId, MQBannerAdView.this.adtype, Integer.parseInt(MQBannerAdView.this.mKsAd.adID), 5, null, MQBannerAdView.this.platId, MQBannerAdView.this.orderNo, "", "", "");
}
@Override
public void onShow() {
}
}
public class f implements c.j {
f() {
}
@Override
public void onFail(int i, String str) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(i, str);
}
MQSDK mqsdk = MQSDK.getInstance();
String str2 = MQBannerAdView.this.madPlcId;
int i2 = MQBannerAdView.this.adtype;
mqsdk.adStat(str2, i2, 0, 4, null, 0, "", i + "-" + str, "", "");
}
@Override
public void onOtherAd(String str) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(901, str);
}
}
@Override
public void onSuccess(Object... objArr) {
try {
MQBannerAdView.this.showTimes = 0;
MQBannerAdView.this.errorTimes = 0;
JSONObject jSONObject = (JSONObject) objArr[0];
MQBannerAdView.this.platId = jSONObject.optInt("platID");
MQBannerAdView.this.orderNo = jSONObject.optString("orderNo");
MQBannerAdView.this.click = jSONObject.optInt("isAllDxClickRate");
MQBannerAdView.this.hasload = true;
if (MQBannerAdView.this.platId != 0 && MQBannerAdView.this.platId <= 10) {
MQBannerAdView.this.pollingUtil.a(MQBannerAdView.this.runnable);
MQBannerAdView.this.autoing = false;
JSONObject optJSONObject = jSONObject.optJSONObject("data");
MQBannerAdView.this.mKsAd = new KuaiShuaAd().fromJson(optJSONObject);
int i = MQBannerAdView.this.platId;
if (i == 1) {
MQBannerAdView.this.rl_tdbanner.setVisibility(8);
if (com.moqi.sdk.f.b()) {
MQBannerAdView.this.inittt();
return;
}
return;
} else if (i != 2) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(901, "未接入平台");
return;
}
return;
} else {
MQBannerAdView.this.rl_tdbanner.setVisibility(8);
if (!com.moqi.sdk.f.c() || MQBannerAdView.this.mKsAd == null) {
return;
}
MQBannerAdView.this.getTBanner().loadAD();
return;
}
}
JSONArray optJSONArray = jSONObject.optJSONArray("data");
MQBannerAdView.this.mAd = new MoQiAd().fromJson(optJSONArray.optJSONObject(0));
MQBannerAdView.this.mAd.platId = MQBannerAdView.this.platId;
MQBannerAdView.this.mAd.adPlcID = MQBannerAdView.this.madPlcId;
MQBannerAdView.this.mAd.adtype = MQBannerAdView.this.adtype;
MQBannerAdView.this.mAd.orderNo = MQBannerAdView.this.orderNo;
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onADReceive();
}
MQBannerAdView mQBannerAdView = MQBannerAdView.this;
mQBannerAdView.loadStatusWithAd(mQBannerAdView.mAd);
MQBannerAdView.this.startauto();
} catch (Exception unused) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(v.m, "加载失败");
}
MQSDK mqsdk = MQSDK.getInstance();
String str = MQBannerAdView.this.madPlcId;
int i2 = MQBannerAdView.this.adtype;
mqsdk.adStat(str, i2, 0, 4, null, 0, "", v.m + "-TD加载失败", "", "");
}
}
}
class g implements Runnable {
g() {
}
@Override
public void run() {
if (MQBannerAdView.this.rl_tdbanner == null || !MQBannerAdView.this.rl_tdbanner.getGlobalVisibleRect(new Rect())) {
return;
}
MQBannerAdView.this.loadAD();
}
}
public class h implements View.OnClickListener {
h() {
}
@Override
public void onClick(View view) {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdClose();
}
MQBannerAdView.this.destroy();
MQBannerAdView.this.rl_tdbanner.setVisibility(8);
}
}
class i implements a.b {
i() {
}
@Override
public void a(int i) {
}
@Override
public void a(File file) {
com.moqi.sdk.utils.b.a(MQBannerAdView.this.mContent, file);
}
}
public class j implements b.c<Movie> {
j() {
}
@Override
public void a(Movie movie) {
MQBannerAdView.this.mMoQiImageDrawable = new y(movie);
if (MQBannerAdView.this.mAd.banmod == 1) {
MQBannerAdView.this.mImageView.setImageDrawable(MQBannerAdView.this.mMoQiImageDrawable);
}
MQBannerAdView.this.mAdclose.setVisibility(0);
MQBannerAdView.this.ll_logo.setVisibility(0);
}
}
public class k implements b.c<Bitmap> {
k() {
}
@Override
public void a(Bitmap bitmap) {
if (MQBannerAdView.this.mAd.banmod == 1) {
MQBannerAdView.this.mImageView.setImageBitmap(bitmap);
}
MQBannerAdView.this.mAdclose.setVisibility(0);
MQBannerAdView.this.ll_logo.setVisibility(0);
}
}
public class l implements Runnable {
l() {
}
@Override
public void run() {
if (MQBannerAdView.this.mAd == null) {
return;
}
MQBannerAdView.this.performClick();
MQBannerAdView.this.mAd.upActionEvent(11, "");
}
}
public class m implements b.c<Bitmap> {
m() {
}
@Override
public void a(Bitmap bitmap) {
if (MQBannerAdView.this.mAd.banmod == 2) {
MQBannerAdView.this.iv_apk_icon.setImageBitmap(bitmap);
}
}
}
public class n implements UnifiedBannerADListener {
n() {
}
@Override
public void onADClicked() {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdClick();
}
MQBannerAdView.this.upAdStats(2, "");
}
@Override
public void onADClosed() {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdClose();
}
MQBannerAdView.this.upAdStats(5, "");
MQBannerAdView.this.destroy();
}
@Override
public void onADExposure() {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdShow();
}
if (MQBannerAdView.this.showTimes <= 0) {
MQBannerAdView.this.upAdStats(0, "");
}
MQBannerAdView.access$008(MQBannerAdView.this);
}
@Override
public void onADLeftApplication() {
}
@Override
public void onADReceive() {
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onADReceive();
}
}
@Override
public void onNoAD(AdError adError) {
if (MQBannerAdView.this.errorTimes == 0) {
MQBannerAdView.access$108(MQBannerAdView.this);
MQBannerAdView.this.getTBanner().loadAD();
return;
}
if (MQBannerAdView.this.mBannerAdCallBack != null) {
MQBannerAdView.this.mBannerAdCallBack.onAdFail(adError.getErrorCode(), adError.getErrorMsg());
}
MQBannerAdView mQBannerAdView = MQBannerAdView.this;
mQBannerAdView.upAdStats(4, adError.getErrorCode() + "-" + adError.getErrorMsg());
}
}
public MQBannerAdView(Activity activity, String str) {
super(activity);
this.adtype = 7;
this.hasload = false;
this.autoing = false;
this.platId = 0;
this.errorTimes = 0;
this.showTimes = 0;
this.pollingUtil = new b0(new Handler(Looper.getMainLooper()));
this.runnable = new g();
this.madPlcId = str;
this.mContent = activity;
init(activity, str);
}
static int access$008(MQBannerAdView mQBannerAdView) {
int i2 = mQBannerAdView.showTimes;
mQBannerAdView.showTimes = i2 + 1;
return i2;
}
static int access$108(MQBannerAdView mQBannerAdView) {
int i2 = mQBannerAdView.errorTimes;
mQBannerAdView.errorTimes = i2 + 1;
return i2;
}
public void bindAdListener(TTNativeExpressAd tTNativeExpressAd) {
tTNativeExpressAd.setExpressInteractionListener(new c());
if (TTAdSdk.getAdManager().getSDKVersion().equals("4.3.0.6")) {
bindDislike(tTNativeExpressAd, false);
}
}
private void bindDislike(TTNativeExpressAd tTNativeExpressAd, boolean z) {
if (!z) {
tTNativeExpressAd.setDislikeCallback(this.mContent, new e());
return;
}
List<FilterWord> filterWords = tTNativeExpressAd.getDislikeInfo().getFilterWords();
if (filterWords == null || filterWords.isEmpty()) {
return;
}
com.moqi.sdk.view.banner.a aVar = new com.moqi.sdk.view.banner.a(this.mContent, filterWords);
aVar.a(new d());
tTNativeExpressAd.setDislikeDialog(aVar);
}
private void getMQBannerAd() {
MQSDK.getInstance().reqBannerAd(getContext(), this.madPlcId, 1, new f());
}
public UnifiedBannerView getTBanner() {
UnifiedBannerView unifiedBannerView = this.mqGdtBannerView;
if (unifiedBannerView != null) {
this.bannerContainer.removeView(unifiedBannerView);
this.mqGdtBannerView.destroy();
}
GDTAdSdk.init(this.mContent, this.mKsAd.appID);
UnifiedBannerView unifiedBannerView2 = new UnifiedBannerView(this.mContent, this.mKsAd.posID, new n());
this.mqGdtBannerView = unifiedBannerView2;
unifiedBannerView2.setRefresh(com.moqi.sdk.d.T);
this.bannerContainer.post(new a());
return this.mqGdtBannerView;
}
private void init(Context context, String str) {
RelativeLayout.inflate(context, R.layout.mq_layout_banner, this);
this.mImageView = (ImageView) findViewById(R.id.mMqAdImageView);
this.bannerContainer = (FrameLayout) findViewById(R.id.bannerContainer);
this.ll_type2 = (LinearLayout) findViewById(R.id.ll_type2);
this.iv_apk_icon = (ImageView) findViewById(R.id.iv_apk_icon);
this.tv_name = (TextView) findViewById(R.id.tv_name);
this.tv_info = (TextView) findViewById(R.id.tv_info);
this.rl_tdbanner = (RelativeLayout) findViewById(R.id.rl_tdbanner);
this.ll_logo = (LinearLayout) findViewById(R.id.ll_logo);
this.go = (TextView) findViewById(R.id.go);
ImageView imageView = (ImageView) findViewById(R.id.mAdclose);
this.mAdclose = imageView;
imageView.setOnClickListener(new h());
this.mImageView.setOnClickListener(this);
this.ll_type2.setOnClickListener(this);
}
public void inittt() {
KuaiShuaAd kuaiShuaAd = this.mKsAd;
if (kuaiShuaAd != null) {
this.mTTAdNative = com.moqi.sdk.i.a.a(kuaiShuaAd.appID);
this.mTTAdNative.loadBannerExpressAd(new AdSlot.Builder().setCodeId(this.mKsAd.posID).setSupportDeepLink(true).setAdCount(1).setExpressViewAcceptedSize(ScreenUtils.c(this.bannerContainer.getWidth()), ScreenUtils.c(Math.round(this.bannerContainer.getWidth() / 6.4f))).setImageAcceptedSize(640, 100).build(), new b());
return;
}
BannerAdCallBack bannerAdCallBack = this.mBannerAdCallBack;
if (bannerAdCallBack != null) {
bannerAdCallBack.onAdFail(902, "mKsAd is null");
}
}
public synchronized void loadStatusWithAd(MoQiAd moQiAd) {
if (moQiAd == null) {
return;
}
this.mAd = moQiAd;
this.rl_tdbanner.setVisibility(0);
if (this.mAd.banmod == 1) {
this.mImageView.setVisibility(0);
this.ll_type2.setVisibility(8);
String str = moQiAd.imgUrl;
if (!TextUtils.isEmpty(str)) {
if (str.endsWith(".gif")) {
com.moqi.sdk.h.b.b(str, new j());
} else {
com.moqi.sdk.h.b.a(str, new k());
}
BannerAdCallBack bannerAdCallBack = this.mBannerAdCallBack;
if (bannerAdCallBack != null) {
bannerAdCallBack.onAdShow();
if (this.click == 1) {
postDelayed(new l(), 3000L);
}
MoQiAd moQiAd2 = this.mAd;
if (moQiAd2 != null && moQiAd2.platId > 10) {
com.moqi.sdk.http.c.a().a(this.mAd.reshow);
}
}
this.mAd.upActionEvent(0, "");
}
} else {
this.mImageView.setVisibility(8);
this.ll_type2.setVisibility(0);
com.moqi.sdk.h.b.a(moQiAd.logoUrl, new m());
this.tv_name.setText(moQiAd.name);
this.tv_info.setText(moQiAd.summary);
this.go.setVisibility(0);
if (TextUtils.isEmpty(moQiAd.MButName)) {
this.go.setVisibility(8);
} else {
this.go.setText(moQiAd.MButName);
this.go.setVisibility(0);
}
this.ll_logo.setVisibility(0);
this.mAdclose.setVisibility(0);
}
setClickable(true);
}
public void startauto() {
int i2;
if (this.autoing || (i2 = com.moqi.sdk.d.T) == 0 || !this.hasload) {
return;
}
this.pollingUtil.a(this.runnable, i2 * 1000, false);
this.autoing = true;
}
public void upAdStats(int i2, String str) {
KuaiShuaAd kuaiShuaAd = this.mKsAd;
if (kuaiShuaAd == null || kuaiShuaAd.adID == null) {
return;
}
MQSDK.getInstance().adStat(this.madPlcId, this.adtype, Integer.parseInt(this.mKsAd.adID), i2, null, this.platId, this.orderNo, str, "", "");
}
public void destroy() {
this.pollingUtil.a(this.runnable);
this.autoing = false;
this.mTTAdNative = null;
this.mBannerAdCallBack = null;
this.bannerContainer.removeAllViews();
UnifiedBannerView unifiedBannerView = this.mqGdtBannerView;
if (unifiedBannerView != null) {
unifiedBannerView.destroy();
this.mqGdtBannerView = null;
}
}
public void loadAD() {
this.pollingUtil.a(this.runnable);
this.autoing = false;
getMQBannerAd();
}
@Override
public void onClick(View view) {
String str;
if (this.mAd == null) {
return;
}
BannerAdCallBack bannerAdCallBack = this.mBannerAdCallBack;
if (bannerAdCallBack != null) {
bannerAdCallBack.onAdClick();
}
this.mAd.upActionEvent(2, "");
MoQiAd moQiAd = this.mAd;
if (moQiAd != null && moQiAd.platId > 10) {
com.moqi.sdk.http.c.a().a(this.mAd.reclick);
}
if (this.mAd.type.equals("3")) {
MoQiAd moQiAd2 = this.mAd;
if (moQiAd2 != null && (str = moQiAd2.clickUrl) != null) {
t.b(this.mContent, str);
}
} else if (this.mAd.type.equals("4")) {
MoQiAd moQiAd3 = this.mAd;
if (moQiAd3 != null && moQiAd3.clickUrl != null) {
h0.a(getContext(), this.mAd.clickUrl);
}
} else if (this.mAd.type.equals("1")) {
Activity activity = this.mContent;
MoQiAd moQiAd4 = this.mAd;
com.moqi.sdk.download2.a.a(activity, moQiAd4.clickUrl, moQiAd4, new i());
} else {
Context context = getContext();
MoQiAd moQiAd5 = this.mAd;
MQWebViewActivity.a(context, moQiAd5.clickUrl, moQiAd5);
}
MoQiAd moQiAd6 = this.mAd;
}
@Override
public void onResume() {
}
@Override
public void onStop() {
y yVar = this.mMoQiImageDrawable;
if (yVar != null) {
yVar.b();
}
this.pollingUtil.a(this.runnable);
}
@Override
protected void onWindowVisibilityChanged(int i2) {
super.onWindowVisibilityChanged(i2);
if (i2 == 0 && getVisibility() == 0) {
startauto();
return;
}
this.pollingUtil.a(this.runnable);
this.autoing = false;
}
public void setBannnerAdCallBack(BannerAdCallBack bannerAdCallBack) {
this.mBannerAdCallBack = bannerAdCallBack;
}
}