atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 FullscreenActivity.java 源代码,内容仅作参考
package com.appnext.ads.fullscreen;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.widget.RelativeLayout;
import com.appnext.R;
import com.appnext.core.Ad;
import com.appnext.core.AppnextActivity;
import com.appnext.core.AppnextAd;
import com.appnext.core.AppnextError;
import com.appnext.core.SettingsManager;
import com.appnext.core.callbacks.OnAdClicked;
import com.appnext.core.callbacks.OnAdClosed;
import com.appnext.core.callbacks.OnAdError;
import com.appnext.core.callbacks.OnAdOpened;
import com.appnext.core.f;
import com.appnext.core.n;
import com.appnext.core.p;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Random;
public class FullscreenActivity extends AppnextActivity implements h, i, j, f.a {
private ArrayList<AppnextAd> ads;
private SettingsManager g;
private AppnextAd i;
private AppnextAd j;
private HashMap<String, Integer> k;
private Video l;
private Handler mHandler;
private int type;
private boolean h = true;
private boolean finished = false;
private int m = 0;
Runnable n = new Runnable() {
@Override
public final void run() {
if (FullscreenActivity.this.userAction != null) {
FullscreenActivity.this.userAction.d(FullscreenActivity.this.i);
}
FullscreenActivity.this.report("impression_event", "S2");
}
};
Runnable o = new Runnable() {
@Override
public final void run() {
FullscreenActivity fullscreenActivity = FullscreenActivity.this;
fullscreenActivity.a(fullscreenActivity.i, (f.a) null);
FullscreenActivity.this.report("vta_event", "S2");
}
};
@Override
public void onCreate(Bundle bundle) {
Fragment gVar;
if (bundle != null) {
try {
this.k = (HashMap) bundle.getSerializable("templates");
this.m = bundle.getInt("state");
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$onCreate", th);
return;
}
}
if (Build.VERSION.SDK_INT >= 17) {
Configuration configuration = getResources().getConfiguration();
configuration.setLayoutDirection(new Locale("en"));
getResources().updateConfiguration(configuration, getResources().getDisplayMetrics());
}
super.onCreate(bundle);
if (Video.currentAd == null) {
onError(AppnextError.NO_ADS);
finish();
return;
}
if (Video.currentAd instanceof RewardedVideo) {
this.l = new RewardedVideo(this, (RewardedVideo) Video.currentAd);
} else {
this.l = new FullScreenVideo(this, (FullScreenVideo) Video.currentAd);
}
String orientation = b().getOrientation();
char c = 65535;
switch (orientation.hashCode()) {
case 729267099:
if (orientation.equals("portrait")) {
c = 3;
break;
}
break;
case 1430647483:
if (orientation.equals("landscape")) {
c = 2;
break;
}
break;
case 1673671211:
if (orientation.equals(Ad.ORIENTATION_AUTO)) {
c = 1;
break;
}
break;
case 2129065206:
if (orientation.equals(Ad.ORIENTATION_DEFAULT)) {
c = 0;
break;
}
break;
}
if (c == 0 || c == 1) {
if (getResources().getConfiguration().orientation == 2) {
setRequestedOrientation(6);
} else {
setRequestedOrientation(7);
}
} else if (c == 2) {
setRequestedOrientation(6);
} else if (c == 3) {
setRequestedOrientation(7);
}
this.mHandler = new Handler();
this.placementID = getIntent().getExtras().getString("id");
int i = getIntent().getExtras().getInt("type");
this.type = i;
if (i == 1) {
this.g = c.h();
} else {
this.g = f.o();
}
this.h = Boolean.parseBoolean(this.g.t("can_close"));
if (b() instanceof FullScreenVideo) {
this.h = ((FullScreenVideo) b()).isBackButtonCanClose();
}
if (bundle == null) {
ArrayList<AppnextAd> e = b.f().e(b());
this.ads = e;
if (e == null) {
onError(AppnextError.NO_ADS);
finish();
return;
}
this.i = a(e, this.placementID, "");
} else {
this.ads = (ArrayList) bundle.getSerializable("ads");
this.i = (AppnextAd) bundle.getSerializable("currentAd");
}
if (this.i == null) {
onError(AppnextError.NO_ADS);
finish();
return;
}
setContentView(R.layout.apnxt_video_activity);
if (bundle == null) {
Bundle bundle2 = new Bundle();
String mode = b() instanceof RewardedVideo ? ((RewardedVideo) b()).getMode() : "";
if (mode.equals(RewardedVideo.VIDEO_MODE_DEFAULT)) {
mode = getConfig().t("default_mode");
}
if (this.type == 2 && mode.equals(RewardedVideo.VIDEO_MODE_MULTI)) {
gVar = new e();
bundle2.putInt("time", ((RewardedVideo) b()).getMultiTimerLength());
report(RewardedVideo.VIDEO_MODE_MULTI);
} else {
if (this.type == 2) {
report(RewardedVideo.VIDEO_MODE_NORMAL);
}
gVar = new g();
bundle2.putBoolean("showCta", b().isShowCta());
this.m = 1;
}
gVar.setArguments(bundle2);
FragmentTransaction beginTransaction = getFragmentManager().beginTransaction();
beginTransaction.add(R.id.ll, gVar, "fragment");
try {
beginTransaction.commit();
} catch (Exception unused) {
finish();
return;
}
} else {
this.finished = bundle.getBoolean("finished", true);
}
this.cv = (RelativeLayout) findViewById(R.id.ll);
this.userAction = new p(this, new p.a() {
@Override
public final void report(String str) {
try {
FullscreenActivity.this.report(str);
} catch (Throwable unused2) {
}
}
@Override
public final Ad c() {
return Video.currentAd;
}
@Override
public final AppnextAd d() {
return FullscreenActivity.this.j;
}
@Override
public final SettingsManager e() {
return FullscreenActivity.this.getConfig();
}
});
}
@Override
protected final void onError(String str) {
OnAdError onAdErrorCallback;
try {
if (b() == null || (onAdErrorCallback = b().getOnAdErrorCallback()) == null) {
return;
}
onAdErrorCallback.adError(str);
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$onError", th);
}
}
@Override
protected final SettingsManager getConfig() {
if (this.g == null) {
if (this.type == 1) {
this.g = c.h();
} else {
this.g = f.o();
}
}
return this.g;
}
@Override
public final void a(AppnextAd appnextAd, f.a aVar) {
super.a(appnextAd, new f.a() {
@Override
public final void error(String str) {
}
@Override
public final void onMarket(String str) {
}
});
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
bundle.putBoolean("finished", this.finished);
bundle.putInt("type", this.type);
bundle.putSerializable("templates", this.k);
bundle.putSerializable("ads", this.ads);
bundle.putInt("state", this.m);
bundle.putSerializable("currentAd", this.i);
super.onSaveInstanceState(bundle);
}
@Override
protected void onRestoreInstanceState(Bundle bundle) {
super.onRestoreInstanceState(bundle);
this.finished = bundle.getBoolean("finished", true);
this.type = bundle.getInt("type");
this.k = (HashMap) bundle.getSerializable("templates");
}
@Override
protected void onPause() {
super.onPause();
this.mHandler.removeCallbacks(this.n);
this.mHandler.removeCallbacks(this.o);
}
@Override
protected void onResume() {
super.onResume();
try {
int systemUiVisibility = getWindow().getDecorView().getSystemUiVisibility() | 2;
if (Build.VERSION.SDK_INT >= 16) {
systemUiVisibility |= 4;
}
if (Build.VERSION.SDK_INT >= 18) {
systemUiVisibility |= 4096;
}
getWindow().getDecorView().setSystemUiVisibility(systemUiVisibility);
} catch (Throwable unused) {
}
}
@Override
public void onDestroy() {
super.onDestroy();
try {
com.appnext.core.g.a(new File(getFilesDir().getAbsolutePath() + "/data/appnext/videos/tmp/vid" + b().rnd + "/"));
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$onDestroy", th);
}
try {
if (this.mHandler != null) {
this.mHandler.removeCallbacksAndMessages(null);
}
this.mHandler = null;
this.j = null;
this.i = null;
} catch (Throwable th2) {
com.appnext.base.a.a("FullscreenActivity$onDestroy", th2);
}
}
@Override
public final void b(AppnextAd appnextAd, f.a aVar) {
OnAdClicked onAdClickedCallback;
if (appnextAd == null) {
return;
}
this.j = appnextAd;
Video b = b();
if (b != null && (onAdClickedCallback = b.getOnAdClickedCallback()) != null) {
onAdClickedCallback.adClicked();
}
if (this.finished || !(b() instanceof RewardedVideo)) {
super.b(appnextAd, aVar);
}
}
@Override
public void onMarket(String str) {
S();
this.finished = true;
Collections.shuffle(this.ads, new Random(System.nanoTime()));
this.ads.remove(this.i);
this.ads.add(0, this.i);
d dVar = new d();
this.m = 2;
FragmentTransaction beginTransaction = getFragmentManager().beginTransaction();
beginTransaction.replace(R.id.ll, dVar, "fragment");
try {
beginTransaction.commit();
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$onMarket", th);
finish();
}
}
@Override
public void error(String str) {
S();
report("error_resolve_timeout");
}
private void a() {
OnAdClosed onAdClosedCallback;
try {
b.f().a(this, this.i.getBannerID(), b());
if (b() != null && (onAdClosedCallback = b().getOnAdClosedCallback()) != null) {
onAdClosedCallback.onAdClosed();
}
Video.currentAd = null;
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$onClose", th);
}
}
@Override
public void videoStarted() {
OnAdOpened onAdOpenedCallback;
n.aa().a(new Runnable() {
@Override
public final void run() {
try {
if (FullscreenActivity.this.i == null || FullscreenActivity.this.l == null) {
return;
}
com.appnext.core.adswatched.a.l(FullscreenActivity.this).j(FullscreenActivity.this.i.getBannerID(), FullscreenActivity.this.l.getAUID());
} catch (Throwable unused) {
}
}
});
this.mHandler.postDelayed(this.n, Long.parseLong(this.g.t("postpone_impression_sec")) * 1000);
if (Boolean.parseBoolean(this.g.t("pview"))) {
this.mHandler.postDelayed(this.o, Long.parseLong(this.g.t("postpone_vta_sec")) * 1000);
}
if (b() == null || (onAdOpenedCallback = b().getOnAdOpenedCallback()) == null) {
return;
}
onAdOpenedCallback.adOpened();
}
@Override
public void videoEnded() {
this.m = 2;
this.finished = true;
if (b() != null && b().getOnVideoEndedCallback() != null) {
b().getOnVideoEndedCallback().videoEnded();
}
n.aa().a(new Runnable() {
@Override
public final void run() {
RewardedServerSidePostback rewardedServerSidePostback;
if (!(FullscreenActivity.this.b() instanceof RewardedVideo) || (rewardedServerSidePostback = ((RewardedVideo) FullscreenActivity.this.b()).getRewardedServerSidePostback()) == null) {
return;
}
HashMap<String, String> n = rewardedServerSidePostback.n();
n.put("placementId", FullscreenActivity.this.placementID);
try {
com.appnext.core.g.a(FullscreenActivity.this, "https://admin.appnext.com/adminService.asmx/SetRewards", n);
} catch (IOException unused) {
}
}
});
Collections.shuffle(this.ads, new Random(System.nanoTime()));
this.ads.remove(this.i);
this.ads.add(0, this.i);
d dVar = new d();
this.m = 2;
FragmentTransaction beginTransaction = getFragmentManager().beginTransaction();
beginTransaction.replace(R.id.ll, dVar, "fragment");
try {
beginTransaction.commit();
AppnextAd appnextAd = this.j;
if (appnextAd != null) {
super.b(appnextAd, this);
report("roll_store_opened");
return;
}
report("roll_click_cta_none");
if (Integer.parseInt(getConfig().t("clickType_b")) > new Random(System.nanoTime()).nextInt(100)) {
installClicked(getSelectedAd());
}
} catch (Exception unused) {
finish();
}
}
@Override
public void videoSelected(AppnextAd appnextAd) {
this.i = appnextAd;
g gVar = new g();
FragmentManager fragmentManager = getFragmentManager();
Bundle bundle = new Bundle();
bundle.putBoolean("showCta", b().isShowCta());
gVar.setArguments(bundle);
FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
beginTransaction.replace(R.id.ll, gVar, "fragment");
try {
beginTransaction.commit();
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$videoSelected", th);
finish();
}
}
@Override
public ArrayList<AppnextAd> getPreRollAds() {
if (this.ads == null) {
this.ads = b.f().e(b());
}
ArrayList<AppnextAd> arrayList = new ArrayList<>();
AppnextAd a = a(this.ads, this.placementID, "");
arrayList.add(a);
AppnextAd a2 = a(this.ads, this.placementID, a.getBannerID());
if (a2 != null && !a2.getBannerID().equals(arrayList.get(0).getBannerID())) {
arrayList.add(a2);
}
return arrayList;
}
@Override
public void privacyClicked() {
try {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(com.appnext.core.g.e(this.i)));
intent.setFlags(268435456);
startActivity(intent);
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$privacyClicked", th);
}
}
@Override
public void installClicked(AppnextAd appnextAd) {
if (this.m == 1 && !isRewarded()) {
a(this.cv, getResources().getDrawable(R.drawable.apnxt_loader));
}
b(appnextAd, this);
}
@Override
public void closeClicked() {
try {
if (this.m == 1 && !isRewarded() && Integer.parseInt(getConfig().t("clickType_a")) > new Random(System.nanoTime()).nextInt(100)) {
installClicked(getSelectedAd());
return;
}
a();
finish();
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$closeClicked", th);
}
}
@Override
public AppnextAd getSelectedAd() {
return this.i;
}
@Override
public boolean showClose() {
return (b() instanceof FullScreenVideo) && ((FullScreenVideo) b()).isShowClose();
}
@Override
public SettingsManager getConfigManager() {
return getConfig();
}
@Override
public int getTemplate(String str) {
if (this.k == null) {
this.k = new HashMap<>();
}
if (!this.k.containsKey(str)) {
String a = com.appnext.ads.a.a(getConfig().t(str));
Resources resources = getResources();
int identifier = resources.getIdentifier("apnxt_" + a, "layout", getPackageName());
if (identifier == 0) {
Resources resources2 = getResources();
identifier = resources2.getIdentifier("apnxt_" + str.toLowerCase() + "t1", "layout", getPackageName());
}
this.k.put(str, Integer.valueOf(identifier));
}
return this.k.get(str).intValue();
}
@Override
public boolean getMute() {
return b().getMute();
}
@Override
public void report(String str, String str2) {
a(str, getResources().getResourceEntryName(getTemplate(str2)));
}
@Override
public ArrayList<AppnextAd> getPostRollAds() {
return this.ads;
}
@Override
public boolean isRewarded() {
return b() instanceof RewardedVideo;
}
@Override
public String getLanguage() {
return this.l.getLanguage();
}
@Override
public String getCtaText() {
try {
String buttonText = new FullscreenAd(this.i).getButtonText();
String str = "existing";
if (this.i != null && buttonText.equals("")) {
if (isInstalled()) {
return com.appnext.core.a.a.n(this).a(this.l.getLanguage(), "existing", "Open");
}
return com.appnext.core.a.a.n(this).a(this.l.getLanguage(), "new", "Install");
}
com.appnext.core.a.a n = com.appnext.core.a.a.n(this);
String language = this.l.getLanguage();
if (!isInstalled()) {
str = "new";
}
return n.a(language, str, buttonText);
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$getCtaText", th);
return "";
}
}
@Override
public boolean isInstalled() {
try {
return com.appnext.core.g.b(this, this.i.getAdPackage());
} catch (Throwable unused) {
return false;
}
}
@Override
public int getCaptionTextTime() {
try {
return b().getRollCaptionTime();
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$getCaptionTextTime", th);
return 0;
}
}
@Override
public long closeDelay() {
try {
if (b() instanceof FullScreenVideo) {
return ((FullScreenVideo) b()).getCloseDelay();
}
return 0L;
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$closeDelay", th);
return 0L;
}
}
protected final AppnextAd a(ArrayList<AppnextAd> arrayList, String str, String str2) {
try {
Iterator<AppnextAd> it = arrayList.iterator();
while (it.hasNext()) {
AppnextAd next = it.next();
if (a(next)) {
next.getBannerID();
if (!next.getBannerID().equals(str2)) {
return next;
}
}
}
Iterator<AppnextAd> it2 = arrayList.iterator();
while (it2.hasNext()) {
AppnextAd next2 = it2.next();
if (a(next2)) {
next2.getBannerID();
return next2;
}
}
return null;
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$getFirst", th);
return null;
}
}
private static boolean a(AppnextAd appnextAd) {
try {
if (appnextAd.getVideoUrlHigh().equals("")) {
return !appnextAd.getVideoUrlHigh30Sec().equals("");
}
return true;
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$hasHiResVideo", th);
return false;
}
}
public void report(String str) {
try {
Resources resources = getResources();
a(str, resources.getResourceEntryName(getTemplate("S" + (this.m + 1))));
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$report", th);
}
}
private void a(String str, String str2) {
try {
com.appnext.core.g.a(this, b().getTID(), b().getVID(), b().getAUID(), this.placementID, b().getSessionId(), str, str2, this.i != null ? this.i.getBannerID() : "", this.i != null ? this.i.getCampaignID() : "");
} catch (Throwable th) {
com.appnext.base.a.a("FullscreenActivity$sendReport", th);
}
}
public Video b() {
if (Video.currentAd != null) {
return Video.currentAd;
}
return this.l;
}
@Override
public void onBackPressed() {
if (b().isBackButtonCanClose()) {
a();
super.onBackPressed();
}
}
@Override
public Uri getSelectedVideoUri() {
String str;
String videoUrl = b.getVideoUrl(this.i, b().getVideoLength());
String b = b.b(videoUrl);
if (Video.getCacheVideo()) {
str = getFilesDir().getAbsolutePath() + "/data/appnext/videos/";
} else {
str = getFilesDir().getAbsolutePath() + "/data/appnext/videos/tmp/vid" + b().rnd + "/";
}
File file = new File(str + b);
if (file.exists()) {
Uri parse = Uri.parse(str + b);
new StringBuilder("playing video ").append(parse.getPath());
return parse;
}
Uri parse2 = Uri.parse(videoUrl);
new StringBuilder("playing video from web: ").append(videoUrl);
new StringBuilder("file not found: ").append(file.getAbsolutePath());
return parse2;
}
}