正在查看: CallApp v2.226 应用的 DTBInterstitialActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CallApp v2.226 应用的 DTBInterstitialActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.amazon.device.ads;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.amazon.aps.ads.R;
import com.amazon.aps.shared.APSAnalytics;
import com.amazon.aps.shared.analytics.APSEventSeverity;
import com.amazon.aps.shared.analytics.APSEventType;
import com.amazonaws.event.ProgressEvent;
import com.iab.omid.library.amazon.adsession.FriendlyObstructionPurpose;
import java.lang.ref.WeakReference;
public class DTBInterstitialActivity extends Activity implements DTBMRAIDCloseButtonListener {
private static final String LOG_TAG = "DTBInterstitialActivity";
WeakReference<DTBAdView> adView;
private int dtbAdInterstitialID;
DTBAdInterstitial interstitial;
public void lambda$useCustomButtonUpdated$0() {
findViewById(R.id.mraid_close_indicator).setVisibility(getUseCustomClose() ? 4 : 0);
}
public void cleanAndFinishAdView(DTBAdView dTBAdView) {
if (isViewAndControllerNotNull(dTBAdView)) {
dTBAdView.evaluateJavascript(DTBAdMRAIDController.MRAID_CLOSE, null);
cleanup();
finish();
}
}
public void cleanup() {
DTBAdInterstitial.removeFromCache(this.dtbAdInterstitialID);
WeakReference<DTBAdView> weakReference = this.adView;
if (weakReference != null) {
weakReference.clear();
this.adView = null;
}
}
public DTBAdView getAdView() {
WeakReference<DTBAdView> weakReference = this.adView;
if (weakReference != null) {
return weakReference.get();
}
return null;
}
public boolean getUseCustomClose() {
if (isViewAndControllerNotNull(getAdView())) {
return getAdView().getController().useCustomClose;
}
String str = LOG_TAG;
StringBuilder sb = new StringBuilder("Failed to get use custom close , due to ");
sb.append(this.interstitial);
DtbLog.info(str, sb.toString() == null ? "null DTBInterstitial instance" : "null AdView/Controller instance");
return false;
}
public boolean isViewAndControllerNotNull(DTBAdView dTBAdView) {
return (dTBAdView == null || dTBAdView.getController() == null) ? false : true;
}
@Override
public void onBackPressed() {
try {
if (getUseCustomClose()) {
return;
}
cleanAndFinishAdView(getAdView());
} catch (RuntimeException e6) {
APSAnalytics.logEvent(APSEventSeverity.ERROR, APSEventType.EXCEPTION, "Fail to execute onBackPressed method", e6);
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
try {
requestWindowFeature(1);
getWindow().setFlags(ProgressEvent.PART_STARTED_EVENT_CODE, ProgressEvent.PART_STARTED_EVENT_CODE);
setContentView(R.layout.mdtb_interstitial_ad);
if (getIntent() != null) {
int intExtra = getIntent().getIntExtra("INTERSTITIAL_CACHE_KEY", 0);
this.dtbAdInterstitialID = intExtra;
this.interstitial = DTBAdInterstitial.getFromCache(intExtra);
}
if (this.interstitial == null) {
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.LOG, "DTBInterstitialActivity is invoked with the cache data null");
finish();
return;
}
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.inter_container);
this.adView = new WeakReference<>(this.interstitial.getAdView());
getAdView().setScrollEnabled(false);
ViewParent parent = getAdView().getParent();
if (parent != null && (parent instanceof ViewGroup)) {
((ViewGroup) parent).removeView(getAdView());
}
int i8 = R.id.mraid_close_indicator;
LinearLayout linearLayout = (LinearLayout) findViewById(i8);
relativeLayout.addView(getAdView(), -1, -1);
DTBAdMRAIDController controller = getAdView().getController();
controller.setCustomButtonListener(this);
if (controller.getDtbOmSdkSessionManager() != null) {
controller.getDtbOmSdkSessionManager().addFriendlyObstruction(linearLayout.findViewById(i8), FriendlyObstructionPurpose.CLOSE_AD);
}
linearLayout.setVisibility(getUseCustomClose() ? 4 : 0);
linearLayout.bringToFront();
linearLayout.setBackgroundColor(0);
linearLayout.setOrientation(1);
ImageView imageView = new ImageView(getAdView().getContext());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(DTBAdUtil.sizeToDevicePixels(24), DTBAdUtil.sizeToDevicePixels(24));
layoutParams.setMargins(DTBAdUtil.sizeToDevicePixels(14), DTBAdUtil.sizeToDevicePixels(14), 0, 0);
imageView.setImageDrawable(l.a.a(this, R.drawable.mraid_close));
linearLayout.addView(imageView, layoutParams);
linearLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() != 0) {
return false;
}
DTBInterstitialActivity dTBInterstitialActivity = DTBInterstitialActivity.this;
dTBInterstitialActivity.cleanAndFinishAdView(dTBInterstitialActivity.getAdView());
return true;
}
});
} catch (RuntimeException e6) {
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Fail to create DTBInterstitial Activity", e6);
finish();
}
}
@Override
public void onDestroy() {
try {
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.inter_container);
if (relativeLayout != null) {
relativeLayout.removeView(getAdView());
}
if (getAdView() != null) {
getAdView().evaluateJavascript(DTBAdMRAIDController.MRAID_CLOSE, null);
cleanup();
}
} catch (RuntimeException e6) {
APSAnalytics.logEvent(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Failed to remove DTBAdView on Activity Destroy", e6);
}
super.onDestroy();
}
@Override
public void useCustomButtonUpdated() {
new Handler(Looper.getMainLooper()).post(new m(this, 1));
try {
if (getUseCustomClose()) {
return;
}
getAdView().getController().getDtbOmSdkSessionManager().addFriendlyObstruction(findViewById(R.id.mraid_close_indicator), FriendlyObstructionPurpose.CLOSE_AD);
} catch (RuntimeException e6) {
APSAnalytics.logEvent(APSEventSeverity.ERROR, APSEventType.EXCEPTION, " OMSDK : Unable to add close icon as friendly obstruction on geometry change", e6);
}
}
}