导航菜单

页面标题

页面副标题

MX Player v1.97.8 - DTBAdInterstitial.java 源代码

正在查看: MX Player v1.97.8 应用的 DTBAdInterstitial.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.amazon.device.ads;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import defpackage.f80;
import defpackage.i0;
import defpackage.k0;
import defpackage.l0;
import java.util.Map;

public class DTBAdInterstitial {
    protected static final String INTERSTITIAL_CACHE_KEY = "INTERSTITIAL_CACHE_KEY";
    private static final String LOG_TAG = "DTBAdInterstitial";
    private static Map<Integer, DTBAdInterstitial> dtbAdInterstitialCache = f80.f();
    DTBAdView adView;
    private Context context;

    public DTBAdInterstitial(Context context, DTBAdInterstitialListener dTBAdInterstitialListener) {
        try {
            this.context = context;
            this.adView = new DTBAdView(context, dTBAdInterstitialListener);
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to initialize DTBAdInterstitial class");
            i0.a(k0.b, l0.b, "Fail to initialize DTBAdInterstitial class", e);
        }
    }

    public static DTBAdInterstitial getFromCache(int i) {
        if (dtbAdInterstitialCache.containsKey(Integer.valueOf(i))) {
            return dtbAdInterstitialCache.get(Integer.valueOf(i));
        }
        return null;
    }

    private DTBAdMRAIDInterstitialController getInterstitialController() {
        return (DTBAdMRAIDInterstitialController) this.adView.getController();
    }

    private DTBAdInterstitialListener getInterstitialListener() {
        return getInterstitialController().getInterstitialListener();
    }

    public static int getWidth(Context context) {
        try {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
            return displayMetrics.widthPixels;
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to execute getWidth method");
            i0.a(k0.c, l0.b, "Fail to execute getWidth method", e);
            return 0;
        }
    }

    private static int putInCache(DTBAdInterstitial dTBAdInterstitial) {
        dtbAdInterstitialCache.put(Integer.valueOf(dTBAdInterstitial.hashCode()), dTBAdInterstitial);
        return dTBAdInterstitial.hashCode();
    }

    public static void removeFromCache(int i) {
        dtbAdInterstitialCache.remove(Integer.valueOf(i));
    }

    private void startOMSDKSession() {
        try {
            DtbOmSdkSessionManager dtbOmSdkSessionManager = getInterstitialController().getDtbOmSdkSessionManager();
            if (getAdView().isVideo()) {
                dtbOmSdkSessionManager.initJavaScriptOmAdSession(getAdView(), "https://c.amazon-adsystem.com/");
            } else {
                dtbOmSdkSessionManager.initHtmlDisplayOmAdSession(getAdView(), "https://c.amazon-adsystem.com/");
            }
            dtbOmSdkSessionManager.registerAdView(getAdView());
            dtbOmSdkSessionManager.startAdSession();
            dtbOmSdkSessionManager.displayAdEventLoaded();
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Unable to start OM SDK session for Interstitial ad");
            i0.a(k0.b, l0.b, "Unable to start OM SDK session for Interstitial ad", e);
        }
    }

    public void fetchAd(Map<String, Object> map) {
        this.adView.fetchAd(map);
    }

    public DTBAdView getAdView() {
        return this.adView;
    }

    public void onAdClosed() {
        DTBAdInterstitialListener interstitialListener = getInterstitialListener();
        if (interstitialListener != null) {
            interstitialListener.onAdClosed(this.adView);
        }
    }

    public void setListener(DTBAdInterstitialListener dTBAdInterstitialListener) {
        getInterstitialController().setInterstitialListener(dTBAdInterstitialListener);
    }

    public void show() {
        l0 l0Var = l0.b;
        k0 k0Var = k0.b;
        try {
            if (getInterstitialController() == null) {
                DtbLog.error(LOG_TAG, "Fail to show the interstitial ad");
                i0.a(k0Var, l0Var, "There is no controller before showing the interstitial ad", null);
            } else {
                Intent intent = new Intent(this.context, (Class<?>) DTBInterstitialActivity.class);
                intent.putExtra(INTERSTITIAL_CACHE_KEY, putInCache(this));
                startOMSDKSession();
                this.context.startActivity(intent);
            }
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to execute show method");
            i0.a(k0Var, l0Var, "Fail to execute show method", e);
        }
    }

    public void fetchAd(Bundle bundle) {
        try {
            this.adView.fetchAd(bundle.getString(DTBAdView.BID_HTML, ""), bundle);
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with bundle argument");
            i0.a(k0.b, l0.b, "Fail to execute fetchAd method with extraData argument", e);
        }
    }

    public void fetchAd(String str) {
        try {
            this.adView.fetchAd(str);
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with bundle argument");
            i0.a(k0.b, l0.b, "Fail to execute fetchAd method with adHtml argument", e);
        }
    }

    public void fetchAd(String str, Bundle bundle) {
        try {
            this.adView.fetchAd(str, bundle);
        } catch (RuntimeException e) {
            DtbLog.error(LOG_TAG, "Fail to execute fetchAd method with adHtml and bundle argument");
            i0.a(k0.b, l0.b, "Fail to execute fetchAd method with adHtml and  bundle argument", e);
        }
    }
}