导航菜单

页面标题

页面副标题

泰剧兔 v1.5.7.0 - SdkInterstitialActivity.java 源代码

正在查看: 泰剧兔 v1.5.7.0 应用的 SdkInterstitialActivity.java JAVA 源代码文件

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


package com.meishu.sdk.activity;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.media.MediaMetadataRetriever;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.baidu.mobads.sdk.api.NativeResponse;
import com.kwad.sdk.api.KsAdVideoPlayConfig;
import com.kwad.sdk.api.KsImage;
import com.kwad.sdk.api.KsNativeAd;
import com.meishu.sdk.R;
import com.meishu.sdk.core.ad.AdType;
import com.meishu.sdk.core.ad.IAd;
import com.meishu.sdk.core.bquery.BQuery;
import com.meishu.sdk.core.bquery.BQueryCallback;
import com.meishu.sdk.core.domain.HttpResponse;
import com.meishu.sdk.core.domain.MeishuAdInfo;
import com.meishu.sdk.core.exception.ErrorCodeUtil;
import com.meishu.sdk.core.utils.ClickHandler;
import com.meishu.sdk.core.utils.ClickUtil;
import com.meishu.sdk.core.utils.DefaultHttpGetWithNoHandlerCallback;
import com.meishu.sdk.core.utils.DownloadDialogBean;
import com.meishu.sdk.core.utils.HttpGetBytesCallback;
import com.meishu.sdk.core.utils.HttpUtil;
import com.meishu.sdk.core.utils.ImageUtil;
import com.meishu.sdk.core.utils.LocalThreadPools;
import com.meishu.sdk.core.utils.LogUtil;
import com.meishu.sdk.core.utils.MemoryUtil;
import com.meishu.sdk.core.utils.SdkHandler;
import com.meishu.sdk.core.utils.UiUtil;
import com.meishu.sdk.core.view.TouchAdContainer;
import com.meishu.sdk.core.view.TouchPositionListener;
import com.meishu.sdk.core.view.gif.GifImageView;
import com.meishu.sdk.meishu_ad.interstitial.IInterstitialAdListener;
import com.meishu.sdk.meishu_ad.interstitial.InterstitialAdSlot;
import com.meishu.sdk.meishu_ad.interstitial.NativeInterstitialAd;
import com.meishu.sdk.meishu_ad.nativ.NativeAdMediaListener;
import com.meishu.sdk.meishu_ad.nativ.NormalMediaView;
import com.meishu.sdk.platform.BasePlatformLoader;
import com.meishu.sdk.platform.ms.splash.ShakeResult;
import com.meishu.sdk.platform.ms.splash.ShakeUtil;
import com.qq.e.ads.cfg.VideoOption;
import com.qq.e.ads.nativ.MediaView;
import com.qq.e.ads.nativ.NativeADEventListener;
import com.qq.e.ads.nativ.NativeADMediaListener;
import com.qq.e.ads.nativ.NativeUnifiedADAppMiitInfo;
import com.qq.e.ads.nativ.NativeUnifiedADData;
import com.qq.e.ads.nativ.widget.NativeAdContainer;
import com.qq.e.comm.util.AdError;
import com.sigmob.sdk.downloader.f;
import com.ss.android.download.api.constant.BaseConstants;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class SdkInterstitialActivity extends Activity {
    private static final String TAG = "SdkInterstitialActivity";
    private static IInterstitialAdListener adListener;
    private static BasePlatformLoader adWrapper;
    private static IAd msAd;
    private static Object sdkAd;
    private int act_type = 2;
    private ImageView adLogo;
    private LinearLayout adLogoLL;
    private TextView btn;
    private TextView cid;
    private ImageView closeImage;
    private TextView desc;
    private String downloadAppDeveloper;
    private String downloadAppIntroString;
    private String downloadAppIntroUrl;
    private String downloadAppName;
    private String downloadAppPaymentTypes;
    private List<MeishuAdInfo.PermissionBean> downloadAppPermissionList;
    private String downloadAppPermissionUrl;
    private String downloadAppPrivacyAgreement;
    private String downloadAppSize;
    private String downloadAppVersion;
    private ImageView imageBg;
    private GifImageView imageView;
    private boolean isClickToClose;
    private boolean isDownloadType;
    private boolean isShake;
    private boolean isVideoAutoPlay;
    private int layout_height;
    private int layout_type;
    private int layout_width;
    private ImageView logo;
    private RelativeLayout mediaContainer;
    private RelativeLayout rl_container;
    private RelativeLayout rootView;
    private int shakeId;
    private boolean showed;
    private GifImageView startActionShakeImage;
    private TextView title;
    private TouchAdContainer touchAdContainer;
    private View view;

    public class AnonymousClass6 implements BQueryCallback<File> {
        final InterstitialAdSlot val$adSlot;
        final NativeInterstitialAd val$sdkAd;

        public AnonymousClass6(NativeInterstitialAd nativeInterstitialAd, InterstitialAdSlot interstitialAdSlot) {
            this.val$sdkAd = nativeInterstitialAd;
            this.val$adSlot = interstitialAdSlot;
        }

        @Override
        public void onFail(int i, String str) {
        }

        @Override
        public void onSuccess(String str, File file) {
            try {
                if (file.length() >= MemoryUtil.getTraceMemory()) {
                    return;
                }
                DisplayMetrics displayMetrics = SdkInterstitialActivity.this.getResources().getDisplayMetrics();
                float f = displayMetrics.widthPixels;
                float f2 = displayMetrics.density;
                int i = (int) (f - (70.0f * f2));
                int i2 = (int) (f2 * 200.0f);
                if (SdkInterstitialActivity.this.layout_type == 2) {
                    i2 = (int) (((displayMetrics.widthPixels * 0.86d) * SdkInterstitialActivity.this.layout_height) / SdkInterstitialActivity.this.layout_width);
                    i = (int) (displayMetrics.widthPixels * 0.86d);
                }
                final NormalMediaView normalMediaView = new NormalMediaView(SdkInterstitialActivity.this);
                normalMediaView.setContainerWidth(i);
                normalMediaView.setContainerHeight(i2);
                normalMediaView.setPlayOnce(true);
                normalMediaView.mute();
                normalMediaView.setUseTransform(false);
                normalMediaView.setFromLogoVisibility(8);
                normalMediaView.setFromLogo(null);
                normalMediaView.setNativeAdMediaListener(new NativeAdMediaListener() {
                    @Override
                    public void onProgressUpdate(long j, long j2) {
                    }

                    @Override
                    public void onVideoComplete() {
                    }

                    @Override
                    public void onVideoError() {
                    }

                    @Override
                    public void onVideoLoaded() {
                        LogUtil.e(SdkInterstitialActivity.TAG, "onADLoaded");
                        AnonymousClass6.this.val$sdkAd.sendExposure();
                        AnonymousClass6 anonymousClass6 = AnonymousClass6.this;
                        SdkInterstitialActivity.this.startShake(anonymousClass6.val$adSlot);
                    }

                    @Override
                    public void onVideoMute() {
                    }

                    @Override
                    public void onVideoOneHalf() {
                    }

                    @Override
                    public void onVideoOneQuarter() {
                    }

                    @Override
                    public void onVideoPause() {
                    }

                    @Override
                    public void onVideoReplay() {
                    }

                    @Override
                    public void onVideoResume() {
                    }

                    @Override
                    public void onVideoStart() {
                    }

                    @Override
                    public void onVideoThreeQuarter() {
                    }

                    @Override
                    public void onVideoUnmute() {
                    }
                });
                SdkInterstitialActivity.this.mediaContainer.removeAllViews();
                normalMediaView.setVideoPath(file.getAbsolutePath());
                if (this.val$adSlot.getScale_type() == 9) {
                    normalMediaView.setDisplayMode(2);
                    SdkInterstitialActivity.this.mediaContainer.addView(normalMediaView, -1, -1);
                } else {
                    normalMediaView.setDisplayMode(1);
                    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
                    layoutParams.addRule(13, -1);
                    SdkInterstitialActivity.this.mediaContainer.addView(normalMediaView, layoutParams);
                }
                SdkInterstitialActivity.this.imageBg.setVisibility(0);
                LocalThreadPools.getInstance().execute(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            final Bitmap videoThumb = normalMediaView.getVideoThumb();
                            if (videoThumb != null) {
                                SdkHandler.getInstance().runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        Bitmap rsBlur;
                                        try {
                                            Bitmap bitmap = videoThumb;
                                            if (bitmap != null) {
                                                Bitmap.Config config = bitmap.getConfig();
                                                Bitmap.Config config2 = Bitmap.Config.ARGB_8888;
                                                Bitmap copy = config == config2 ? videoThumb : videoThumb.copy(config2, true);
                                                if (copy == null || (rsBlur = ImageUtil.rsBlur(SdkInterstitialActivity.this.getApplicationContext(), copy, 25)) == null) {
                                                    return;
                                                }
                                                SdkInterstitialActivity.this.imageBg.setImageBitmap(rsBlur);
                                            }
                                        } catch (Throwable th) {
                                            th.printStackTrace();
                                        }
                                    }
                                });
                            }
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
                normalMediaView.start();
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    private void fullHeightImage(Bitmap bitmap, ImageView imageView, int i, int i2, int i3) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        float f = (i2 * 1.0f) / height;
        Matrix matrix = new Matrix();
        matrix.postScale(f, f);
        Bitmap createBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, false);
        createBitmap.getHeight();
        int width2 = createBitmap.getWidth();
        if (width2 < i) {
            imageView.setScaleType(ImageView.ScaleType.CENTER);
        } else {
            int i4 = (i3 == 6 || i3 == 2 || i3 == 1) ? (width2 - i) / 2 : (i3 != 7 && i3 == 8) ? width2 - i : 0;
            imageView.setScaleType(ImageView.ScaleType.MATRIX);
            createBitmap = Bitmap.createBitmap(createBitmap, i4, 0, i, i2, (Matrix) null, false);
        }
        imageView.setImageBitmap(createBitmap);
    }

    private void fullWidthImage(Bitmap bitmap, GifImageView gifImageView, int i, int i2, int i3) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        float f = (i * 1.0f) / width;
        ImageView.ScaleType scaleType = ImageView.ScaleType.MATRIX;
        gifImageView.setScaleType(scaleType);
        Matrix matrix = new Matrix();
        matrix.postScale(f, f);
        Bitmap createBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, false);
        int height2 = createBitmap.getHeight();
        createBitmap.getWidth();
        if (height2 < i2) {
            gifImageView.setScaleType(ImageView.ScaleType.CENTER);
        } else {
            int i4 = (i3 == 3 || i3 == 2 || i3 == 1) ? (height2 - i2) / 2 : (i3 != 4 && i3 == 5) ? height2 - i2 : 0;
            gifImageView.setScaleType(scaleType);
            createBitmap = Bitmap.createBitmap(createBitmap, 0, i4, i, i2, (Matrix) null, false);
        }
        gifImageView.setImageBitmap(createBitmap);
    }

    private String getBDImageUrl(NativeResponse nativeResponse) {
        try {
            String imageUrl = nativeResponse.getImageUrl();
            if (!TextUtils.isEmpty(imageUrl)) {
                return imageUrl;
            }
            List multiPicUrls = nativeResponse.getMultiPicUrls();
            if (multiPicUrls == null || multiPicUrls.size() <= 0) {
                return "";
            }
            String str = (String) multiPicUrls.get(0);
            return !TextUtils.isEmpty(str) ? str : "";
        } catch (Throwable th) {
            th.printStackTrace();
            return "";
        }
    }

    private byte[] getImageBytes(Context context, int i) {
        try {
            InputStream openRawResource = context.getResources().openRawResource(i);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            byte[] bArr = new byte[f.a.c];
            while (true) {
                int read = openRawResource.read(bArr);
                if (-1 == read) {
                    return byteArrayOutputStream.toByteArray();
                }
                byteArrayOutputStream.write(bArr, 0, read);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    private String getImageUrl(NativeUnifiedADData nativeUnifiedADData) {
        try {
            return !TextUtils.isEmpty(nativeUnifiedADData.getImgUrl()) ? nativeUnifiedADData.getImgUrl() : (nativeUnifiedADData.getImgList() == null || nativeUnifiedADData.getImgList().size() <= 0) ? "" : nativeUnifiedADData.getImgList().get(0);
        } catch (Throwable th) {
            th.printStackTrace();
            return "";
        }
    }

    private void handleBdAd() {
        final NativeResponse nativeResponse = (NativeResponse) sdkAd;
        if (nativeResponse.getAdActionType() == 2) {
            this.isDownloadType = true;
        }
        this.downloadAppName = nativeResponse.getBrandName();
        this.downloadAppVersion = nativeResponse.getAppVersion();
        this.downloadAppSize = ((nativeResponse.getAppSize() / 1024) * 1024) + "MB";
        this.downloadAppDeveloper = nativeResponse.getPublisher();
        this.downloadAppPermissionUrl = nativeResponse.getAppPermissionLink();
        this.downloadAppPrivacyAgreement = nativeResponse.getAppPrivacyLink();
        this.downloadAppIntroString = nativeResponse.getDesc();
        this.title.setText(nativeResponse.getTitle());
        this.desc.setText(nativeResponse.getDesc());
        BQuery bQuery = new BQuery((Activity) this);
        if (!TextUtils.isEmpty(nativeResponse.getBaiduLogoUrl())) {
            ((BQuery) bQuery.id(this.adLogo)).image(nativeResponse.getBaiduLogoUrl());
        }
        if (!TextUtils.isEmpty(nativeResponse.getIconUrl())) {
            ((BQuery) bQuery.id(this.logo)).image(nativeResponse.getIconUrl());
        }
        if (nativeResponse.getAdActionType() != 2) {
            this.btn.setText("点击查看详情");
        } else {
            this.btn.setText("点击下载");
        }
        try {
            if (nativeResponse.getMaterialType().equals(NativeResponse.MaterialType.VIDEO)) {
                LocalThreadPools.getInstance().execute(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
                            mediaMetadataRetriever.setDataSource(nativeResponse.getVideoUrl());
                            final Bitmap frameAtTime = mediaMetadataRetriever.getFrameAtTime();
                            if (frameAtTime != null) {
                                SdkHandler.getInstance().runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        SdkInterstitialActivity.this.imageView.setImageBitmap(frameAtTime);
                                    }
                                });
                            }
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
            } else {
                ((BQuery) bQuery.id((View) this.imageView)).image(getBDImageUrl(nativeResponse));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        ArrayList arrayList = new ArrayList();
        arrayList.add(this.rl_container);
        nativeResponse.registerViewForInteraction(this.rl_container, arrayList, (List) null, new NativeResponse.AdInteractionListener() {
            public void onADExposed() {
                try {
                    if (SdkInterstitialActivity.this.showed) {
                        return;
                    }
                    if (SdkInterstitialActivity.adWrapper.getLoaderListener() != null) {
                        SdkInterstitialActivity.adWrapper.getLoaderListener().onAdExposure();
                    }
                    if (SdkInterstitialActivity.msAd != null && SdkInterstitialActivity.msAd.getInteractionListener() != null) {
                        SdkInterstitialActivity.msAd.getInteractionListener().onAdExposure();
                    }
                    SdkInterstitialActivity.this.showed = true;
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            public void onADExposureFailed(int i) {
            }

            public void onADStatusChanged() {
            }

            public void onAdClick() {
                try {
                    LogUtil.d(SdkInterstitialActivity.TAG, "send onAdClicked");
                    if (SdkInterstitialActivity.adWrapper != null && SdkInterstitialActivity.adWrapper.getSdkAdInfo() != null && SdkInterstitialActivity.msAd != null) {
                        HttpUtil.asyncGetWithWebViewUA(SdkInterstitialActivity.adWrapper.getContext(), ClickHandler.replaceOtherMacros(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getClk(), SdkInterstitialActivity.msAd), new DefaultHttpGetWithNoHandlerCallback());
                        UiUtil.handleClick(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getMsLoadedTime(), SdkInterstitialActivity.adWrapper.getAdLoader().getPosId());
                    }
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            public void onAdUnionClick() {
            }
        });
    }

    private void handleButton() {
        int i = this.act_type;
        if ((i & 4) == 4 || (i & 64) == 64) {
            showShakeInButton();
            if (this.isDownloadType) {
                this.btn.setText("摇一摇或点击下载三方应用");
                return;
            } else {
                this.btn.setText("摇一摇或点击查看详情");
                return;
            }
        }
        if (!ClickUtil.isTurnType(i)) {
            if (this.isDownloadType) {
                this.btn.setText("点击下载三方应用");
                return;
            } else {
                this.btn.setText("点击查看详情");
                return;
            }
        }
        showShakeInButton();
        if (this.isDownloadType) {
            this.btn.setText("扭一扭或点击下载三方应用");
        } else {
            this.btn.setText("扭一扭或点击查看详情");
        }
    }

    private void handleGDTAd() {
        NativeUnifiedADData nativeUnifiedADData = (NativeUnifiedADData) sdkAd;
        NativeUnifiedADAppMiitInfo appMiitInfo = nativeUnifiedADData.getAppMiitInfo();
        if (nativeUnifiedADData.isAppAd()) {
            this.isDownloadType = true;
        }
        if (appMiitInfo != null) {
            this.downloadAppName = appMiitInfo.getAppName();
            this.downloadAppVersion = appMiitInfo.getVersionName();
            this.downloadAppSize = ((appMiitInfo.getPackageSizeBytes() / 1024) * 1024) + "MB";
            this.downloadAppDeveloper = appMiitInfo.getAuthorName();
            this.downloadAppPermissionUrl = appMiitInfo.getPermissionsUrl();
            this.downloadAppPrivacyAgreement = appMiitInfo.getPrivacyAgreement();
        }
        nativeUnifiedADData.getPictureWidth();
        nativeUnifiedADData.getPictureHeight();
        this.title.setText(nativeUnifiedADData.getTitle());
        this.desc.setText(nativeUnifiedADData.getDesc());
        float f = getResources().getDisplayMetrics().density;
        new ArrayList().add(this.mediaContainer);
        BQuery bQuery = new BQuery((Activity) this);
        if (!TextUtils.isEmpty(nativeUnifiedADData.getIconUrl())) {
            ((BQuery) bQuery.id(this.logo)).image(nativeUnifiedADData.getIconUrl());
        }
        if (nativeUnifiedADData.isAppAd()) {
            this.btn.setText("点击下载");
        } else {
            this.btn.setText("点击查看详情");
        }
        this.adLogo.setImageResource(R.drawable.ms_gdt_logo);
        NativeAdContainer nativeAdContainer = new NativeAdContainer(this);
        ViewGroup viewGroup = (ViewGroup) this.rl_container.getParent();
        if (viewGroup != null) {
            ViewGroup.LayoutParams layoutParams = this.rl_container.getLayoutParams();
            viewGroup.removeView(this.rl_container);
            nativeAdContainer.addView(this.rl_container, new ViewGroup.LayoutParams(-1, -2));
            viewGroup.addView(nativeAdContainer, layoutParams);
        }
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(0, 0);
        ArrayList arrayList = new ArrayList();
        arrayList.add(this.rl_container);
        arrayList.add(this.btn);
        nativeUnifiedADData.setNativeAdEventListener(new NativeADEventListener() {
            @Override
            public void onADClicked() {
                try {
                    if (SdkInterstitialActivity.adWrapper != null && SdkInterstitialActivity.adWrapper.getSdkAdInfo() != null && SdkInterstitialActivity.msAd != null) {
                        LogUtil.d(SdkInterstitialActivity.TAG, "send onADClicked");
                        HttpUtil.asyncGetWithWebViewUA(SdkInterstitialActivity.this.getApplicationContext(), ClickHandler.replaceOtherMacros(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getClk(), SdkInterstitialActivity.msAd), new DefaultHttpGetWithNoHandlerCallback());
                        UiUtil.handleClick(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getMsLoadedTime(), SdkInterstitialActivity.adWrapper.getAdLoader().getPosId());
                    }
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            @Override
            public void onADError(AdError adError) {
            }

            @Override
            public void onADExposed() {
                try {
                    if (SdkInterstitialActivity.adWrapper == null || SdkInterstitialActivity.adWrapper.getLoaderListener() == null || SdkInterstitialActivity.this.showed) {
                        return;
                    }
                    SdkInterstitialActivity.this.showed = true;
                    SdkInterstitialActivity.adWrapper.getLoaderListener().onAdExposure();
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdExposure();
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            @Override
            public void onADStatusChanged() {
            }
        });
        nativeUnifiedADData.bindAdToView(this, nativeAdContainer, layoutParams2, arrayList);
        if (nativeUnifiedADData.getAdPatternType() != 2) {
            String imageUrl = getImageUrl(nativeUnifiedADData);
            if (TextUtils.isEmpty(imageUrl)) {
                return;
            }
            ((BQuery) bQuery.id((View) this.imageView)).image(imageUrl);
            return;
        }
        this.mediaContainer.removeAllViews();
        MediaView mediaView = new MediaView(this);
        ViewGroup.LayoutParams layoutParams3 = mediaView.getLayoutParams();
        if (layoutParams3 == null) {
            layoutParams3 = new ViewGroup.LayoutParams(-1, -2);
        }
        layoutParams3.width = -1;
        layoutParams3.height = -2;
        this.mediaContainer.addView(mediaView, layoutParams3);
        VideoOption.Builder builder = new VideoOption.Builder();
        builder.setAutoPlayPolicy(this.isVideoAutoPlay ? 1 : 2);
        builder.setAutoPlayMuted(true);
        builder.setNeedCoverImage(true);
        builder.setNeedProgressBar(true);
        builder.setEnableDetailPage(true);
        builder.setEnableUserControl(false);
        nativeUnifiedADData.bindMediaView(mediaView, builder.build(), new NativeADMediaListener() {
            @Override
            public void onVideoClicked() {
            }

            @Override
            public void onVideoCompleted() {
            }

            @Override
            public void onVideoError(AdError adError) {
            }

            @Override
            public void onVideoInit() {
            }

            @Override
            public void onVideoLoaded(int i) {
            }

            @Override
            public void onVideoLoading() {
            }

            @Override
            public void onVideoPause() {
            }

            @Override
            public void onVideoReady() {
            }

            @Override
            public void onVideoResume() {
            }

            @Override
            public void onVideoStart() {
            }

            @Override
            public void onVideoStop() {
            }
        });
    }

    private void handleKsAd() {
        KsNativeAd ksNativeAd = (KsNativeAd) sdkAd;
        if (ksNativeAd.getInteractionType() == 1) {
            this.isDownloadType = true;
        }
        this.downloadAppName = ksNativeAd.getAppName();
        this.downloadAppVersion = ksNativeAd.getAppVersion();
        this.downloadAppSize = ((ksNativeAd.getAppPackageSize() / 1024) * 1024) + "MB";
        this.downloadAppDeveloper = ksNativeAd.getCorporationName();
        this.downloadAppPermissionUrl = ksNativeAd.getPermissionInfoUrl();
        this.downloadAppPrivacyAgreement = ksNativeAd.getAppPrivacyUrl();
        this.downloadAppIntroString = ksNativeAd.getAdDescription();
        this.title.setVisibility(8);
        this.desc.setText(ksNativeAd.getAdDescription());
        BQuery bQuery = new BQuery((Activity) this);
        ((BQuery) bQuery.id(this.logo)).image(ksNativeAd.getAppIconUrl());
        ((BQuery) bQuery.id(this.adLogo)).image(R.drawable.ms_ksad_sdk_logo);
        if (ksNativeAd.getInteractionType() == 1) {
            this.btn.setText("点击下载");
        } else {
            this.btn.setText("点击查看详情");
        }
        ArrayList arrayList = new ArrayList();
        arrayList.add(this.rl_container);
        arrayList.add(this.btn);
        ksNativeAd.registerViewForInteraction(this.rl_container, arrayList, new KsNativeAd.AdInteractionListener() {
            public boolean handleDownloadDialog(DialogInterface.OnClickListener onClickListener) {
                return false;
            }

            public void onAdClicked(View view, KsNativeAd ksNativeAd2) {
                try {
                    LogUtil.d(SdkInterstitialActivity.TAG, "send onAdClicked");
                    if (SdkInterstitialActivity.adWrapper != null && SdkInterstitialActivity.adWrapper.getSdkAdInfo() != null && SdkInterstitialActivity.msAd != null) {
                        HttpUtil.asyncGetWithWebViewUA(SdkInterstitialActivity.adWrapper.getContext(), ClickHandler.replaceOtherMacros(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getClk(), SdkInterstitialActivity.msAd), new DefaultHttpGetWithNoHandlerCallback());
                        UiUtil.handleClick(SdkInterstitialActivity.adWrapper.getSdkAdInfo().getMsLoadedTime(), SdkInterstitialActivity.adWrapper.getAdLoader().getPosId());
                    }
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            public void onAdShow(KsNativeAd ksNativeAd2) {
                try {
                    if (SdkInterstitialActivity.this.showed) {
                        return;
                    }
                    if (SdkInterstitialActivity.adWrapper.getLoaderListener() != null) {
                        SdkInterstitialActivity.adWrapper.getLoaderListener().onAdExposure();
                    }
                    if (SdkInterstitialActivity.msAd != null && SdkInterstitialActivity.msAd.getInteractionListener() != null) {
                        SdkInterstitialActivity.msAd.getInteractionListener().onAdExposure();
                    }
                    SdkInterstitialActivity.this.showed = true;
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }

            public void onDownloadTipsDialogDismiss() {
            }

            public void onDownloadTipsDialogShow() {
            }
        });
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        float f = displayMetrics.density;
        int i = displayMetrics.widthPixels;
        int i2 = (int) (i - (70.0f * f));
        if (this.layout_type == 2) {
            i2 = (int) (i - (f * 84.0f));
        }
        int i3 = 0;
        if (ksNativeAd.getMaterialType() == 1) {
            View videoView = ksNativeAd.getVideoView(this, new KsAdVideoPlayConfig.Builder().videoSoundEnable(false).build());
            if (videoView != null) {
                this.mediaContainer.removeAllViews();
                int videoWidth = ksNativeAd.getVideoWidth();
                int videoHeight = ksNativeAd.getVideoHeight();
                if (videoWidth > 0 && videoHeight > 0) {
                    i3 = (videoHeight * i2) / videoWidth;
                }
                this.mediaContainer.addView(videoView, -1, i3);
                return;
            }
            return;
        }
        List imageList = ksNativeAd.getImageList();
        if (imageList == null || imageList.size() <= 0) {
            return;
        }
        KsImage ksImage = (KsImage) imageList.get(0);
        int width = ksImage.getWidth();
        int height = ksImage.getHeight();
        ((BQuery) bQuery.id((View) this.imageView)).image(((KsImage) imageList.get(0)).getImageUrl());
        if (width > 0 && height > 0) {
            i3 = (height * i2) / width;
        }
        ViewGroup.LayoutParams layoutParams = this.imageView.getLayoutParams();
        layoutParams.height = i3;
        layoutParams.width = -1;
        this.imageView.setLayoutParams(layoutParams);
    }

    private void handleMsAd() {
        ShakeUtil.getInstance().pauseShake();
        final NativeInterstitialAd nativeInterstitialAd = (NativeInterstitialAd) sdkAd;
        final InterstitialAdSlot adSlot = nativeInterstitialAd.getAdSlot();
        if (nativeInterstitialAd.getInteractionType() == 1) {
            this.isDownloadType = true;
        }
        this.downloadAppName = adSlot.getAppName();
        this.downloadAppVersion = adSlot.getApp_ver();
        this.downloadAppSize = adSlot.getApp_size();
        this.downloadAppDeveloper = adSlot.getDeveloper();
        this.downloadAppPermissionUrl = adSlot.getApp_permission_url();
        this.downloadAppPermissionList = adSlot.getApp_permission();
        this.downloadAppPrivacyAgreement = adSlot.getPrivacy_agreement();
        this.downloadAppIntroString = adSlot.getApp_intro();
        this.downloadAppIntroUrl = adSlot.getApp_intor_url();
        this.downloadAppPaymentTypes = adSlot.getPayment_types();
        BQuery bQuery = new BQuery((Activity) this);
        if (this.layout_type == 1) {
            if (TextUtils.isEmpty(adSlot.getTitle())) {
                this.title.setText("");
                this.title.setVisibility(8);
            } else {
                this.title.setVisibility(0);
                this.title.setText(adSlot.getTitle());
            }
            if (TextUtils.isEmpty(adSlot.getDesc())) {
                this.desc.setVisibility(8);
                this.desc.setText("");
            } else {
                this.desc.setVisibility(0);
                this.desc.setText(adSlot.getDesc());
            }
        }
        if (this.logo != null) {
            if (TextUtils.isEmpty(adSlot.getIconUrl())) {
                bQuery.id(this.logo).gone();
            } else {
                bQuery.id(this.logo).visible();
                bQuery.id(this.logo).image(adSlot.getIconUrl());
            }
        }
        this.adLogoLL.setBackground(getResources().getDrawable(R.drawable.ms_black_oval_gray));
        if (TextUtils.isEmpty(adSlot.getFromLogo())) {
            bQuery.id(this.adLogo).image(getResources().getDrawable(R.drawable.ms_ad));
        } else {
            bQuery.id(this.adLogo).image(adSlot.getFromLogo());
        }
        if (!TextUtils.isEmpty(adSlot.getCid())) {
            this.cid.setText(adSlot.getCid());
        }
        ClickUtil.checkShakeAndTurn(AdType.INTERSTITIAL.value());
        if (adSlot.getAdPatternType() == 2) {
            loadNativeVideo(bQuery, adSlot, nativeInterstitialAd);
        } else {
            HttpUtil.asyncGetFile(adSlot.getImageUrls()[0], new HttpGetBytesCallback() {
                @Override
                public void onFailure(IOException iOException) {
                    if (SdkInterstitialActivity.adListener != null) {
                        SdkInterstitialActivity.adListener.onAdRenderFail("图片加载失败", -1);
                    }
                }

                @Override
                public void onResponse(HttpResponse<byte[]> httpResponse) {
                    byte[] responseBody;
                    try {
                        if (!httpResponse.isSuccessful() || (responseBody = httpResponse.getResponseBody()) == null || responseBody.length <= 0) {
                            return;
                        }
                        if (!SdkInterstitialActivity.this.isGif(responseBody)) {
                            Bitmap decodeByteArray = BitmapFactory.decodeByteArray(responseBody, 0, responseBody.length);
                            if (decodeByteArray != null) {
                                SdkInterstitialActivity.this.setImageShowType(adSlot.getScale_type(), decodeByteArray, SdkInterstitialActivity.this.imageView);
                            } else if (SdkInterstitialActivity.adListener != null) {
                                SdkInterstitialActivity.adListener.onAdRenderFail("bitmap加载失败", ErrorCodeUtil.RES_LOAD_ERROR.intValue());
                            }
                            try {
                                Bitmap decodeByteArray2 = BitmapFactory.decodeByteArray(responseBody, 0, responseBody.length);
                                if (decodeByteArray2 != null) {
                                    SdkInterstitialActivity.this.imageBg.setImageBitmap(ImageUtil.rsBlur(SdkInterstitialActivity.this.getApplicationContext(), decodeByteArray2, 25));
                                }
                            } catch (Throwable th) {
                                th.printStackTrace();
                            }
                        } else if (SdkInterstitialActivity.this.imageView != null) {
                            SdkInterstitialActivity.this.imageView.setBytes(responseBody);
                            SdkInterstitialActivity.this.imageView.startAnimation();
                        }
                        nativeInterstitialAd.sendExposure();
                        SdkInterstitialActivity.this.startShake(adSlot);
                    } catch (Throwable th2) {
                        th2.printStackTrace();
                    }
                }
            });
        }
        nativeInterstitialAd.setAdView(this.rootView);
        this.rl_container.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (SdkInterstitialActivity.msAd != null && SdkInterstitialActivity.msAd.getInteractionListener() != null && adSlot.getCbc() == 0) {
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                }
                adSlot.setClkActType(1);
                try {
                    if (SdkInterstitialActivity.this.isClickToClose) {
                        nativeInterstitialAd.getAdSlot().setAdClosed(true);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                ClickHandler.handleClick(nativeInterstitialAd);
                if (SdkInterstitialActivity.this.isClickToClose) {
                    SdkInterstitialActivity.this.finish();
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClosed();
                }
            }
        });
        this.btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (SdkInterstitialActivity.msAd != null && SdkInterstitialActivity.msAd.getInteractionListener() != null && adSlot.getCbc() == 0) {
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                }
                adSlot.setClkActType(2);
                ClickHandler.handleClick(nativeInterstitialAd);
                if (SdkInterstitialActivity.this.isClickToClose) {
                    SdkInterstitialActivity.this.finish();
                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                        return;
                    }
                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClosed();
                }
            }
        });
    }

    private void handleSdk() {
        Object obj = sdkAd;
        if (obj != null) {
            try {
                if (obj instanceof NativeUnifiedADData) {
                    handleGDTAd();
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
            try {
                if (sdkAd instanceof KsNativeAd) {
                    handleKsAd();
                }
            } catch (Throwable th2) {
                th2.printStackTrace();
            }
            try {
                if (sdkAd instanceof NativeInterstitialAd) {
                    handleMsAd();
                }
            } catch (Throwable th3) {
                th3.printStackTrace();
            }
            try {
                if (sdkAd instanceof NativeResponse) {
                    handleBdAd();
                }
            } catch (Throwable th4) {
                th4.printStackTrace();
            }
            handleButton();
            handleDownloadView();
        }
    }

    private void initView() {
        TouchAdContainer touchAdContainer;
        this.touchAdContainer = (TouchAdContainer) findViewById(R.id.ms_activity_sdk_interstitial_touchAdContainer);
        this.startActionShakeImage = (GifImageView) findViewById(R.id.ms_action_shakeImage);
        this.mediaContainer = (RelativeLayout) findViewById(R.id.ms_activity_sdk_interstitial_mediaContainer);
        this.imageView = (GifImageView) findViewById(R.id.ms_activity_sdk_interstitial_imageview);
        this.imageBg = (ImageView) findViewById(R.id.ms_activity_sdk_interstitial_imageBg);
        this.closeImage = (ImageView) findViewById(R.id.ms_activity_sdk_interstitial_cacel);
        this.adLogo = (ImageView) findViewById(R.id.ms_activity_sdk_interstitial_adLogo);
        this.cid = (TextView) findViewById(R.id.ms_layout_native_interstitial_cid);
        this.rl_container = (RelativeLayout) findViewById(R.id.ms_activity_sdk_interstitial_rl_container);
        this.adLogoLL = (LinearLayout) findViewById(R.id.ms_activity_sdk_interstitial_adLogoLL);
        this.logo = (ImageView) findViewById(R.id.ms_activity_sdk_interstitial_logo);
        this.title = (TextView) findViewById(R.id.ms_activity_sdk_interstitial_title);
        this.desc = (TextView) findViewById(R.id.ms_activity_sdk_interstitial_desc);
        this.btn = (TextView) findViewById(R.id.ms_activity_sdk_interstitial_btn);
        IAd iAd = msAd;
        if (iAd != null && (touchAdContainer = this.touchAdContainer) != null) {
            touchAdContainer.setTouchPositionListener(new TouchPositionListener(iAd));
        }
        this.closeImage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SdkInterstitialActivity.this.finish();
                if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                    return;
                }
                SdkInterstitialActivity.msAd.getInteractionListener().onAdClosed();
            }
        });
        try {
            if (this.layout_type == 2) {
                DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
                if (this.layout_width > 0 && this.layout_height > 0) {
                    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.touchAdContainer.getLayoutParams();
                    int i = displayMetrics.widthPixels;
                    layoutParams.width = (int) (i * 0.86d);
                    layoutParams.height = (int) (((i * 0.86d) * this.layout_height) / this.layout_width);
                    int i2 = displayMetrics.heightPixels;
                    layoutParams.topMargin = (int) (i2 * 0.07d);
                    layoutParams.bottomMargin = (int) (i2 * 0.07d);
                    this.touchAdContainer.setLayoutParams(layoutParams);
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
        handleSdk();
    }

    public boolean isGif(byte[] bArr) {
        byte[] bArr2 = new byte[4];
        System.arraycopy(bArr, 0, bArr2, 0, 4);
        return new BigInteger(1, bArr2).toString(16).startsWith("47494638");
    }

    private void loadNativeVideo(BQuery bQuery, InterstitialAdSlot interstitialAdSlot, NativeInterstitialAd nativeInterstitialAd) {
        bQuery.loadVideo(interstitialAdSlot.getImageUrls()[0], BaseConstants.Time.DAY, new AnonymousClass6(nativeInterstitialAd, interstitialAdSlot));
    }

    public static void setAdListener(IInterstitialAdListener iInterstitialAdListener) {
        adListener = iInterstitialAdListener;
    }

    public static void setAdWrapper(BasePlatformLoader basePlatformLoader) {
        adWrapper = basePlatformLoader;
    }

    public void setImageShowType(int i, Bitmap bitmap, GifImageView gifImageView) {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        int i2 = displayMetrics.widthPixels;
        float f = displayMetrics.density;
        int i3 = (int) (i2 - (70.0f * f));
        int i4 = (int) (f * 200.0f);
        int i5 = (int) (f * 200.0f);
        if (this.layout_type == 2) {
            i5 = (int) (((i2 * 0.86d) * this.layout_height) / this.layout_width);
            i3 = (int) (i2 * 0.86d);
            i4 = (int) (displayMetrics.heightPixels * 0.86d);
        }
        int i6 = i3;
        int i7 = i4;
        if (i5 < i7) {
            gifImageView.setImageBitmap(bitmap);
            return;
        }
        try {
            switch (i) {
                case 1:
                    if ((bitmap.getHeight() * 1.0f) / i7 <= (bitmap.getWidth() * 1.0f) / i6) {
                        fullHeightImage(bitmap, gifImageView, i6, i7, i);
                        break;
                    } else {
                        fullWidthImage(bitmap, gifImageView, i6, i7, i);
                        break;
                    }
                case 2:
                default:
                    if ((bitmap.getWidth() * 1.0f) / i6 <= (bitmap.getHeight() * 1.0f) / i7) {
                        fullHeightImage(bitmap, gifImageView, i6, i7, i);
                        break;
                    } else {
                        fullWidthImage(bitmap, gifImageView, i6, i7, i);
                        break;
                    }
                case 3:
                case 4:
                case 5:
                    fullWidthImage(bitmap, gifImageView, i6, i7, i);
                    break;
                case 6:
                case 7:
                case 8:
                    fullHeightImage(bitmap, gifImageView, i6, i7, i);
                    break;
                case 9:
                    gifImageView.setScaleType(ImageView.ScaleType.FIT_XY);
                    gifImageView.setImageBitmap(bitmap);
                    break;
            }
        } catch (Throwable th) {
            th.printStackTrace();
            gifImageView.setScaleType(ImageView.ScaleType.FIT_XY);
            gifImageView.setImageBitmap(bitmap);
        }
    }

    public static void setMsAd(IAd iAd) {
        msAd = iAd;
    }

    public static void setSdkAd(Object obj) {
        sdkAd = obj;
    }

    private void showShakeInButton() {
        Drawable drawable = getResources().getDrawable(R.drawable.ms_rock_btn);
        drawable.setBounds(0, 0, 100, 100);
        this.btn.setPadding(20, 0, 60, 0);
        this.btn.setCompoundDrawables(drawable, null, null, null);
    }

    private void showStartShakeImage() {
        this.startActionShakeImage.setVisibility(0);
        byte[] imageBytes = getImageBytes(this, R.raw.ms_new_shake);
        if (imageBytes != null && imageBytes.length > 0) {
            this.startActionShakeImage.setBytes(imageBytes, 1);
            this.startActionShakeImage.startAnimation();
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                SdkInterstitialActivity.this.startActionShakeImage.clear();
                SdkInterstitialActivity.this.startActionShakeImage.setVisibility(8);
            }
        }, 2000L);
    }

    public void startShake(final InterstitialAdSlot interstitialAdSlot) {
        this.rootView.post(new Runnable() {
            @Override
            public void run() {
                try {
                    if (ClickUtil.isShakeOrTurn(interstitialAdSlot.getAct_type())) {
                        SdkInterstitialActivity.this.isShake = true;
                        int power_index = interstitialAdSlot.getPower_index();
                        SdkInterstitialActivity.this.shakeId = ShakeUtil.getInstance().generateRandom8Num();
                        int shakeType = ClickUtil.getShakeType(interstitialAdSlot.getAct_type());
                        final long currentTimeMillis = System.currentTimeMillis();
                        ShakeUtil.getInstance().setPid(interstitialAdSlot.getPosId(), interstitialAdSlot.getLoadedTime(), interstitialAdSlot.getDclk());
                        ShakeUtil.getInstance().init(SdkInterstitialActivity.this, power_index, shakeType, interstitialAdSlot.getPower_delay(), interstitialAdSlot.getPower_count(), SdkInterstitialActivity.this.shakeId, interstitialAdSlot.getEcpm(), new ShakeUtil.OnShakeListener() {
                            @Override
                            public void onShake(int i, boolean z, int i2, ShakeResult shakeResult) {
                                ShakeUtil.getInstance().remove(SdkInterstitialActivity.this.shakeId);
                                if (SdkInterstitialActivity.msAd != null && SdkInterstitialActivity.msAd.getInteractionListener() != null && interstitialAdSlot.getCbc() == 0) {
                                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClicked();
                                }
                                if (shakeResult != null) {
                                    shakeResult.setTotalTurnTime(System.currentTimeMillis() - currentTimeMillis);
                                }
                                NativeInterstitialAd nativeInterstitialAd = (NativeInterstitialAd) SdkInterstitialActivity.sdkAd;
                                InterstitialAdSlot adSlot = nativeInterstitialAd.getAdSlot();
                                adSlot.setClkActType(i);
                                adSlot.setClkPower(i2);
                                adSlot.setShakeResult(shakeResult);
                                try {
                                    if (SdkInterstitialActivity.this.isClickToClose) {
                                        nativeInterstitialAd.getAdSlot().setAdClosed(true);
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                                ClickHandler.handleClick(nativeInterstitialAd);
                                if (SdkInterstitialActivity.this.isClickToClose) {
                                    SdkInterstitialActivity.this.finish();
                                    if (SdkInterstitialActivity.msAd == null || SdkInterstitialActivity.msAd.getInteractionListener() == null) {
                                        return;
                                    }
                                    SdkInterstitialActivity.msAd.getInteractionListener().onAdClosed();
                                }
                            }
                        });
                        ShakeUtil.getInstance().setCanShake(true);
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    public void handleDownloadView() {
        try {
            LogUtil.d(TAG, "handleDownloadView: interactionType=" + this.isDownloadType);
            if (this.isDownloadType) {
                TextView textView = (TextView) findViewById(R.id.ms_download_layer_textview);
                textView.setVisibility(0);
                StringBuilder sb = new StringBuilder();
                if (!TextUtils.isEmpty(this.downloadAppName)) {
                    sb.append("应用名称:");
                    sb.append(this.downloadAppName);
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppVersion)) {
                    sb.append(" 应用版本:");
                    sb.append(this.downloadAppVersion);
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppSize)) {
                    sb.append(" 应用大小:");
                    sb.append(this.downloadAppSize);
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppDeveloper)) {
                    sb.append(" 开发者:");
                    sb.append(this.downloadAppDeveloper);
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppPermissionUrl) || this.downloadAppPermissionList != null) {
                    sb.append(" 权限详情>");
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppPrivacyAgreement)) {
                    sb.append(" 隐私协议 > ");
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(this.downloadAppIntroUrl) || !TextUtils.isEmpty(this.downloadAppIntroString)) {
                    sb.append(" 功能介绍>");
                }
                String sb2 = sb.toString();
                if (TextUtils.isEmpty(sb2)) {
                    textView.setVisibility(8);
                } else if (sb2.endsWith("|")) {
                    sb2 = sb2.substring(0, sb2.length() - 1);
                }
                textView.setText(sb2);
                textView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        try {
                            DownloadDialogBean downloadDialogBean = new DownloadDialogBean();
                            downloadDialogBean.setApp_name(SdkInterstitialActivity.this.downloadAppName);
                            downloadDialogBean.setApp_size(SdkInterstitialActivity.this.downloadAppSize);
                            downloadDialogBean.setDeveloper(SdkInterstitialActivity.this.downloadAppDeveloper);
                            downloadDialogBean.setPayment_types(SdkInterstitialActivity.this.downloadAppPaymentTypes);
                            downloadDialogBean.setApp_permission(SdkInterstitialActivity.this.downloadAppPermissionList);
                            downloadDialogBean.setApp_permission_url(SdkInterstitialActivity.this.downloadAppPermissionUrl);
                            downloadDialogBean.setApp_intro(SdkInterstitialActivity.this.downloadAppIntroString);
                            downloadDialogBean.setApp_intor_url(SdkInterstitialActivity.this.downloadAppIntroUrl);
                            downloadDialogBean.setApp_private_agreement(SdkInterstitialActivity.this.downloadAppPrivacyAgreement);
                            MeishuDownloadDetailActivity.startActivity(SdkInterstitialActivity.this, downloadDialogBean);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override
    public void onBackPressed() {
    }

    @Override
    public void onConfigurationChanged(@NonNull Configuration configuration) {
        initView();
        super.onConfigurationChanged(configuration);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.ms_activity_sdk_interstitial);
        try {
            getWindow().getDecorView().setSystemUiVisibility(1792);
            getWindow().setNavigationBarColor(0);
            getWindow().setStatusBarColor(0);
        } catch (Throwable th) {
            th.printStackTrace();
        }
        Intent intent = getIntent();
        this.isVideoAutoPlay = intent.getBooleanExtra("isVideoAutoPlay", true);
        this.isClickToClose = intent.getBooleanExtra("isClickToClose", false);
        this.act_type = intent.getIntExtra("act_type", 2);
        this.layout_type = intent.getIntExtra("layout_type", 1);
        this.layout_width = intent.getIntExtra("layout_width", 0);
        this.layout_height = intent.getIntExtra("layout_height", 0);
        this.rootView = (RelativeLayout) findViewById(R.id.ms_activity_sdk_interstitial_rootView);
        this.view = View.inflate(this, R.layout.ms_layout_sdk_interstitial_1, null);
        if (this.layout_type == 2) {
            this.view = View.inflate(this, R.layout.ms_layout_sdk_interstitial_2, null);
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams.addRule(13);
        this.rootView.addView(this.view, layoutParams);
        initView();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        sdkAd = null;
        adWrapper = null;
        msAd = null;
        adListener = null;
        ShakeUtil.getInstance().remove(this.shakeId);
    }

    @Override
    public void onPause() {
        super.onPause();
        if (this.isShake) {
            ShakeUtil.getInstance().pauseShake();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (this.isShake) {
            ShakeUtil.getInstance().resumeShake();
        }
    }
}