导航菜单

页面标题

页面副标题

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

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

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


package com.meishu.sdk.activity;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.meishu.sdk.R;
import com.meishu.sdk.core.ad.AdType;
import com.meishu.sdk.core.ad.IAd;
import com.meishu.sdk.core.ad.recycler.RecyclerAdMediaListener;
import com.meishu.sdk.core.bquery.BQuery;
import com.meishu.sdk.core.domain.HttpResponse;
import com.meishu.sdk.core.utils.ClickHandler;
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.LogUtil;
import com.meishu.sdk.core.utils.MacroUtil;
import com.meishu.sdk.core.utils.MemoryUtil;
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.MediaView;
import com.meishu.sdk.meishu_ad.nativ.NativeAdSlot;
import com.meishu.sdk.meishu_ad.nativ.NativeAdSlot.RewardBuilder;
import com.meishu.sdk.meishu_ad.nativ.NormalMediaView;
import com.meishu.sdk.meishu_ad.reward.CircleProcessBar;
import com.meishu.sdk.platform.ms.BaseFullScreenVideoAd;
import com.meishu.sdk.platform.ms.recycler.MeishuAdMediaListenerAdapter;
import com.meishu.sdk.platform.ms.splash.ShakeResult;
import com.meishu.sdk.platform.ms.splash.ShakeUtil;
import com.sigmob.sdk.downloader.f;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MeishuRewardVideoPlayerActivity extends AppCompatActivity {
    public static final String Action_text = "Action_text";
    public static final String Ad_content = "Ad_content";
    public static final String Ad_icon_url = "Ad_icon_url";
    public static final String Ad_title = "Ad_title";
    public static final String Ad_type = "Ad_type";
    public static final String Clickable_range = "Clickable_range";
    public static final String Clk_type = "clk_type";
    public static final String Close_btn = "Close_btn";
    public static final String From_logo = "From_logo";
    public static final String Image_src = "Image_src";
    public static final String Interaction_type = "Interaction_type";
    public static final String Power_count = "power_count";
    public static final String Power_delay = "power_delay";
    public static final String Power_index = "power_index";
    private static final String TAG = "MeishuRewardVideoPlayer";
    public static final String Video_complete_key = "Video_complete_key";
    public static final String Video_cover = "Video_cover";
    public static final String Video_endcover = "Video_endcover";
    public static final String Video_keep_time = "Video_keep_time";
    public static final String Video_mute_key = "Video_mute_key";
    public static final String Video_one_half_key = "Video_one_half_key";
    public static final String Video_one_quarter_key = "Video_one_quarter_key";
    public static final String Video_pause_key = "Video_pause_key";
    public static final String Video_replay_key = "Video_replay_key";
    public static final String Video_resume_key = "Video_resume_key";
    public static final String Video_start_key = "Video_start_key";
    public static final String Video_three_quarter_key = "Video_three_quarter_key";
    public static final String Video_unmute_key = "Video_unmute_key";
    private static BaseFullScreenVideoAd ad = null;
    private static DownloadDialogBean downloadBean = null;
    public static final String local_ad_id_key = "local_ad_id_key";
    public static final String orientation_key = "orientation_key";
    private String actionText;
    private int adType;
    private BQuery bQuery;
    private int clkActType;
    private int clkPower;
    private boolean hasExposed;
    private int imageHeight;
    private int imageWidth;
    private String image_src;
    private boolean isShake;
    private boolean isStarted;
    private volatile boolean keepTimeFinish;
    private String localAdId;
    private Handler mHandler;
    private int mImageCurrentTime;
    private NormalMediaView mediaView;
    private ViewGroup mediaViewContainer;
    private boolean onCompletedInvoked;
    private boolean onReward;
    private boolean oneHalfPerformed;
    private boolean oneQuarterPerformed;
    private CircleProcessBar processBar;
    private GifImageView rewardImageview;
    private int shakeId;
    private GifImageView shakeImageView;
    private ShakeResult shakeResult;
    private boolean threeQuarterPerformed;
    private TouchAdContainer touchContainer;
    private boolean videoLoaded;
    private String[] video_complete;
    private String video_cover;
    private String video_endcover;
    private long video_keep_time;
    private String[] video_mute;
    private String[] video_one_half;
    private String[] video_one_quarter;
    private String[] video_pause;
    private String[] video_replay;
    private String[] video_resume;
    private String[] video_start;
    private String[] video_three_quarter;
    private String[] video_unmute;
    private static Map<String, MediaView> rewardMediaViews = new HashMap();
    private static List<IAd> baseFullScreenVideoAdList = new ArrayList();
    private static boolean isMute = false;
    private int totalTime = 15000;
    private Runnable updateTime = new Runnable() {
        @Override
        public void run() {
            try {
                MeishuRewardVideoPlayerActivity.access$2312(MeishuRewardVideoPlayerActivity.this, 100);
                MeishuRewardVideoPlayerActivity.this.processBar.refreshProcess(MeishuRewardVideoPlayerActivity.this.mImageCurrentTime);
                if (MeishuRewardVideoPlayerActivity.this.mImageCurrentTime >= MeishuRewardVideoPlayerActivity.this.totalTime) {
                    MeishuRewardVideoPlayerActivity.this.onReward = true;
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_skip_button).gone();
                    MeishuRewardVideoPlayerActivity.this.processBar.setVisibility(8);
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_onreward, false);
                    MeishuRewardVideoPlayerActivity.this.onImageComplete();
                    MeishuRewardVideoPlayerActivity.this.mHandler.removeCallbacks(MeishuRewardVideoPlayerActivity.this.updateTime);
                    return;
                }
                int unused = MeishuRewardVideoPlayerActivity.this.totalTime;
                int unused2 = MeishuRewardVideoPlayerActivity.this.mImageCurrentTime;
                double d = (MeishuRewardVideoPlayerActivity.this.mImageCurrentTime * 1.0f) / MeishuRewardVideoPlayerActivity.this.totalTime;
                if (d < 0.25d || d >= 0.5d) {
                    if (d < 0.5d || d >= 0.75d) {
                        if (d >= 0.75d && d < 1.0d && !MeishuRewardVideoPlayerActivity.this.threeQuarterPerformed) {
                            MeishuRewardVideoPlayerActivity.this.ThreeQuarterReport();
                            MeishuRewardVideoPlayerActivity.this.threeQuarterPerformed = true;
                        }
                    } else if (!MeishuRewardVideoPlayerActivity.this.oneHalfPerformed) {
                        MeishuRewardVideoPlayerActivity.this.OneHalfReport();
                        MeishuRewardVideoPlayerActivity.this.oneHalfPerformed = true;
                    }
                } else if (!MeishuRewardVideoPlayerActivity.this.oneQuarterPerformed) {
                    MeishuRewardVideoPlayerActivity.this.OneQuarterReport();
                    MeishuRewardVideoPlayerActivity.this.oneQuarterPerformed = true;
                }
                MeishuRewardVideoPlayerActivity.this.mHandler.postDelayed(MeishuRewardVideoPlayerActivity.this.updateTime, 100L);
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    };
    private Runnable updateProcessRunnable = new Runnable() {
        @Override
        public void run() {
            if (MeishuRewardVideoPlayerActivity.this.onCompletedInvoked || MeishuRewardVideoPlayerActivity.this.mediaView == null) {
                return;
            }
            MeishuRewardVideoPlayerActivity.this.processBar.refreshProcess(MeishuRewardVideoPlayerActivity.this.mediaView.getCurrentPosition());
            MeishuRewardVideoPlayerActivity.this.mediaView.postDelayed(this, 100L);
        }
    };

    public static int access$2312(MeishuRewardVideoPlayerActivity meishuRewardVideoPlayerActivity, int i) {
        int i2 = meishuRewardVideoPlayerActivity.mImageCurrentTime + i;
        meishuRewardVideoPlayerActivity.mImageCurrentTime = i2;
        return i2;
    }

    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;
        }
    }

    public static MediaView getRewardMediaView(String str) {
        return rewardMediaViews.get(str);
    }

    private void handleDownloadView(int i) {
        if (i == 1) {
            try {
                if (downloadBean == null) {
                    return;
                }
                TextView textView = (TextView) findViewById(R.id.ms_download_layer_textview);
                textView.setVisibility(0);
                StringBuilder sb = new StringBuilder();
                if (!TextUtils.isEmpty(downloadBean.getApp_name())) {
                    sb.append("应用名称:");
                    sb.append(downloadBean.getApp_name());
                    sb.append(" | ");
                }
                if (!TextUtils.isEmpty(downloadBean.getApp_ver())) {
                    sb.append("应用版本:");
                    sb.append(downloadBean.getApp_ver());
                    sb.append(" | ");
                }
                if (!TextUtils.isEmpty(downloadBean.getApp_size())) {
                    sb.append("应用大小:");
                    sb.append(downloadBean.getApp_size());
                    sb.append(" | ");
                }
                if (!TextUtils.isEmpty(downloadBean.getDeveloper())) {
                    sb.append("开发者:");
                    sb.append(downloadBean.getDeveloper());
                    sb.append(" | ");
                }
                if (!TextUtils.isEmpty(downloadBean.getApp_permission_url()) || downloadBean.getApp_permission() != null) {
                    sb.append(" 权限详情>");
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(downloadBean.getApp_private_agreement())) {
                    sb.append(" 隐私协议 > ");
                    sb.append(" |");
                }
                if (!TextUtils.isEmpty(downloadBean.getApp_intor_url()) || !TextUtils.isEmpty(downloadBean.getApp_intro())) {
                    sb.append(" 功能介绍>");
                }
                String sb2 = sb.toString();
                if (TextUtils.isEmpty(sb2)) {
                    textView.setVisibility(8);
                } else if (sb2.endsWith("|")) {
                    sb2.substring(0, sb2.length() - 1);
                }
                textView.setText(sb2);
                textView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        try {
                            if (MeishuRewardVideoPlayerActivity.downloadBean != null) {
                                MeishuDownloadDetailActivity.startActivity(MeishuRewardVideoPlayerActivity.this, MeishuRewardVideoPlayerActivity.downloadBean);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

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

    public void jumpEndCover(String str) {
        NormalMediaView normalMediaView = this.mediaView;
        if (normalMediaView != null) {
            normalMediaView.onVideoSkiped();
        }
        this.onCompletedInvoked = true;
        this.onReward = true;
        this.bQuery.id(R.id.ms_video_playing_ad_info_container).gone();
        this.bQuery.id(R.id.ms_ad_info_container).visible();
        this.bQuery.id(R.id.ms_download_button).text(str);
        this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
        this.bQuery.id(R.id.ms_reward_skip_button).gone();
        this.bQuery.id(R.id.ms_include_ad_tag).gone();
        this.bQuery.id(R.id.ms_include_ad_tag_end).visible();
        CircleProcessBar circleProcessBar = this.processBar;
        if (circleProcessBar != null) {
            circleProcessBar.setVisibility(8);
        }
    }

    public void loadImageError() {
        sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_error, false);
        for (int i = 0; i < baseFullScreenVideoAdList.size(); i++) {
            try {
                BaseFullScreenVideoAd baseFullScreenVideoAd = (BaseFullScreenVideoAd) baseFullScreenVideoAdList.get(i);
                if (baseFullScreenVideoAd != null) {
                    baseFullScreenVideoAd.destroy();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        finish();
    }

    private void loadRewardImage() {
        try {
            this.rewardImageview = (GifImageView) findViewById(R.id.ms_reward_ad_image);
            findViewById(R.id.ms_reward_voice_button).setVisibility(8);
            HttpUtil.asyncGetFile(this.image_src, new HttpGetBytesCallback() {
                @Override
                public void onFailure(IOException iOException) {
                    MeishuRewardVideoPlayerActivity.this.loadImageError();
                }

                @Override
                public void onResponse(HttpResponse<byte[]> httpResponse) {
                    int i;
                    int i2;
                    try {
                        if (!httpResponse.isSuccessful()) {
                            MeishuRewardVideoPlayerActivity.this.loadImageError();
                            return;
                        }
                        byte[] responseBody = httpResponse.getResponseBody();
                        if (responseBody == null || responseBody.length <= 0) {
                            MeishuRewardVideoPlayerActivity.this.loadImageError();
                            return;
                        }
                        if (responseBody.length >= MemoryUtil.getTraceMemory()) {
                            MeishuRewardVideoPlayerActivity.this.loadImageError();
                            return;
                        }
                        if (!MeishuRewardVideoPlayerActivity.this.isGif(responseBody)) {
                            Bitmap decodeByteArray = BitmapFactory.decodeByteArray(responseBody, 0, responseBody.length);
                            if (decodeByteArray == null) {
                                MeishuRewardVideoPlayerActivity.this.loadImageError();
                                return;
                            }
                            int width = decodeByteArray.getWidth();
                            int height = decodeByteArray.getHeight();
                            MeishuRewardVideoPlayerActivity.this.rewardImageview.setImageBitmap(decodeByteArray);
                            i = width;
                            i2 = height;
                        } else if (MeishuRewardVideoPlayerActivity.this.rewardImageview != null) {
                            MeishuRewardVideoPlayerActivity.this.rewardImageview.setBytes(responseBody);
                            i = MeishuRewardVideoPlayerActivity.this.rewardImageview.getGifWidth();
                            i2 = MeishuRewardVideoPlayerActivity.this.rewardImageview.getGifHeight();
                            MeishuRewardVideoPlayerActivity.this.rewardImageview.startAnimation();
                        } else {
                            i = 0;
                            i2 = 0;
                        }
                        MeishuRewardVideoPlayerActivity.this.imageWidth = i;
                        MeishuRewardVideoPlayerActivity.this.imageHeight = i2;
                        DisplayMetrics displayMetrics = MeishuRewardVideoPlayerActivity.this.getResources().getDisplayMetrics();
                        ViewGroup.LayoutParams layoutParams = MeishuRewardVideoPlayerActivity.this.rewardImageview.getLayoutParams();
                        int i3 = displayMetrics.widthPixels;
                        layoutParams.width = i3;
                        if (i <= 0 || i2 <= 0) {
                            layoutParams.height = displayMetrics.heightPixels - 100;
                        } else {
                            layoutParams.height = Math.min((i3 * i2) / i, displayMetrics.heightPixels - 100);
                        }
                        MeishuRewardVideoPlayerActivity.this.rewardImageview.setLayoutParams(layoutParams);
                        long j = MeishuRewardVideoPlayerActivity.this.video_keep_time * 1000;
                        if (j > 0) {
                            MeishuRewardVideoPlayerActivity.this.totalTime = (int) j;
                        } else {
                            MeishuRewardVideoPlayerActivity.this.totalTime = 15000;
                        }
                        MeishuRewardVideoPlayerActivity.this.processBar.setmTotalTime(MeishuRewardVideoPlayerActivity.this.totalTime);
                        if (MeishuRewardVideoPlayerActivity.this.adType == AdType.REWARD.value()) {
                            MeishuRewardVideoPlayerActivity.this.processBar.setVisibility(0);
                        }
                        MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_start, false);
                        MeishuRewardVideoPlayerActivity.this.startUpdateProcess();
                    } catch (Throwable unused) {
                        MeishuRewardVideoPlayerActivity.this.loadImageError();
                    }
                }
            });
        } catch (Throwable th) {
            loadImageError();
            th.printStackTrace();
        }
    }

    private void loadRewardVideo() {
        try {
            this.mediaViewContainer = (ViewGroup) findViewById(R.id.ms_media_video);
            final MediaView mediaView = rewardMediaViews.get(this.localAdId);
            if (mediaView == null) {
                loadImageError();
                return;
            }
            NormalMediaView normalMediaView = (NormalMediaView) mediaView.getVideoView();
            this.mediaView = normalMediaView;
            normalMediaView.setActivityForLifecycle(this);
            try {
                if (this.mediaView != null) {
                    if (isMute) {
                        this.bQuery.id(R.id.ms_reward_voice_button).image(R.drawable.ms_voice_closed);
                        this.mediaView.onMute();
                    } else {
                        this.bQuery.id(R.id.ms_reward_voice_button).image(R.drawable.ms_voice_open);
                        this.mediaView.onUnmute();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            this.mediaView.post(this.updateProcessRunnable);
            this.mediaView.setVideoCover(this.video_cover);
            this.mediaView.setVideoEndCover(this.video_endcover);
            this.mediaView.showProgressLoading();
            final long j = this.video_keep_time * 1000;
            mediaView.setOnVideoKeepTimeFinishListener(new MediaView.OnVideoKeepTimeFinishListener() {
                @Override
                public void onKeepTimeFinished() {
                    if (MeishuRewardVideoPlayerActivity.this.keepTimeFinish) {
                        return;
                    }
                    MeishuRewardVideoPlayerActivity.this.keepTimeFinish = true;
                    MeishuRewardVideoPlayerActivity.this.onReward = true;
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_skip_button).gone();
                    MeishuRewardVideoPlayerActivity.this.processBar.setVisibility(8);
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_onreward, false);
                }
            }, j);
            mediaView.addOnVideoCompleteListener(new MediaView.OnVideoCompleteListener() {
                @Override
                public void onCompleted() {
                    MeishuRewardVideoPlayerActivity.this.onCompletedInvoked = true;
                    MeishuRewardVideoPlayerActivity.this.onReward = true;
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_video_playing_ad_info_container).gone();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_ad_info_container).visible();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_download_button).text(MeishuRewardVideoPlayerActivity.this.actionText);
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_skip_button).gone();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_include_ad_tag).gone();
                    MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_include_ad_tag_end).visible();
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_complete, false);
                }
            });
            this.mediaViewContainer.removeAllViews();
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams.addRule(13, -1);
            if (this.mediaView.getParent() != null && (this.mediaView.getParent() instanceof ViewGroup)) {
                ((ViewGroup) this.mediaView.getParent()).removeView(this.mediaView);
            }
            this.mediaViewContainer.addView(this.mediaView, layoutParams);
            mediaView.setNativeAdMediaListener(new MeishuAdMediaListenerAdapter(this, new NativeAdSlot().new RewardBuilder().setVideo_start(this.video_start).setVideo_one_quarter(this.video_one_quarter).setVideo_one_half(this.video_one_half).setVideo_three_quarter(this.video_three_quarter).setVideo_complete(this.video_complete).setVideo_pause(this.video_pause).setVideo_resume(this.video_resume).setVideo_mute(this.video_mute).setVideo_unmute(this.video_unmute).setVideo_replay(this.video_replay).setVideoType(2).build(), new RecyclerAdMediaListener() {
                @Override
                public void onProgressUpdate(long j2, long j3) {
                }

                @Override
                public void onVideoCompleted() {
                }

                @Override
                public void onVideoError() {
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_error, false);
                    for (int i = 0; i < MeishuRewardVideoPlayerActivity.baseFullScreenVideoAdList.size(); i++) {
                        try {
                            BaseFullScreenVideoAd baseFullScreenVideoAd = (BaseFullScreenVideoAd) MeishuRewardVideoPlayerActivity.baseFullScreenVideoAdList.get(i);
                            if (baseFullScreenVideoAd != null) {
                                baseFullScreenVideoAd.destroy();
                            }
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                    MeishuRewardVideoPlayerActivity.this.finish();
                }

                @Override
                public void onVideoLoaded() {
                    MeishuRewardVideoPlayerActivity.this.videoLoaded = true;
                    MeishuRewardVideoPlayerActivity.this.startVideo(mediaView);
                }

                @Override
                public void onVideoPause() {
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_pause, false);
                }

                @Override
                public void onVideoResume() {
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_resume, false);
                }

                @Override
                public void onVideoStart() {
                    if (MeishuRewardVideoPlayerActivity.this.mediaView == null) {
                        return;
                    }
                    long j2 = j;
                    MeishuRewardVideoPlayerActivity.this.processBar.setmTotalTime((j2 <= 0 || j2 >= ((long) MeishuRewardVideoPlayerActivity.this.mediaView.getDuration())) ? MeishuRewardVideoPlayerActivity.this.mediaView.getDuration() > 0 ? MeishuRewardVideoPlayerActivity.this.mediaView.getDuration() : 15000 : (int) j);
                    MeishuRewardVideoPlayerActivity.this.processBar.setOnSkipListener(new CircleProcessBar.OnSkipListener() {
                        @Override
                        public void onSkip() {
                            if (MeishuRewardVideoPlayerActivity.this.keepTimeFinish) {
                                return;
                            }
                            MeishuRewardVideoPlayerActivity.this.keepTimeFinish = true;
                            MeishuRewardVideoPlayerActivity.this.onReward = true;
                            MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
                            MeishuRewardVideoPlayerActivity.this.bQuery.id(R.id.ms_reward_skip_button).gone();
                            MeishuRewardVideoPlayerActivity.this.processBar.setVisibility(8);
                            MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_onreward, false);
                        }
                    });
                    MeishuRewardVideoPlayerActivity.this.sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_start, false);
                }
            }));
            if (mediaView.isPrepared()) {
                startVideo(mediaView);
                this.videoLoaded = true;
            }
        } catch (Throwable unused) {
            loadImageError();
        }
    }

    public void onClick() {
        if (this.image_src != null) {
            ClickHandler.setShowDialogActivity(this);
            sendBroadcast(BaseFullScreenVideoAd.broadcast_onclick, true);
            return;
        }
        NormalMediaView normalMediaView = this.mediaView;
        if (normalMediaView == null || !normalMediaView.isPrepared()) {
            return;
        }
        ClickHandler.setShowDialogActivity(this);
        sendBroadcast(BaseFullScreenVideoAd.broadcast_onclick, true);
    }

    public static void removeRewardMediaView(String str) {
        MediaView remove;
        if (str == null || (remove = rewardMediaViews.remove(str)) == null || !(remove instanceof NormalMediaView)) {
            return;
        }
        ((NormalMediaView) remove).destroy();
    }

    public void sendBroadcast(@NonNull String str, boolean z) {
        Intent intent = new Intent();
        intent.setAction(str);
        if (z) {
            intent.putExtra("clk_act_type", this.clkActType);
            intent.putExtra("clk_power", this.clkPower);
            ShakeResult shakeResult = this.shakeResult;
            if (shakeResult != null) {
                intent.putExtra("shake_result", shakeResult);
            }
            intent.putExtra("image_width", this.imageWidth);
            intent.putExtra("image_height", this.imageHeight);
        }
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
    }

    public static void setDownloadDialogBean(DownloadDialogBean downloadDialogBean) {
        downloadBean = downloadDialogBean;
    }

    public static void setFullScreenAd(IAd iAd) {
        baseFullScreenVideoAdList.add(iAd);
    }

    public static void setRewardMediaView(String str, MediaView mediaView) {
        MediaView mediaView2 = rewardMediaViews.get(str);
        if (mediaView2 != null) {
            ((NormalMediaView) mediaView2.getVideoView()).stop();
        }
        rewardMediaViews.put(str, mediaView);
    }

    public static void setVideoMute(boolean z) {
        isMute = z;
    }

    private void startReport() {
        try {
            LogUtil.d(TAG, "send onVideoStart");
            if (this.isStarted) {
                return;
            }
            String[] strArr = this.video_start;
            if (strArr != null) {
                for (String str : strArr) {
                    if (!TextUtils.isEmpty(str)) {
                        HttpUtil.asyncGetWithWebViewUA(this, MacroUtil.replaceExposureMacros(str), new DefaultHttpGetWithNoHandlerCallback());
                    }
                }
            }
            this.isStarted = true;
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void startUpdateProcess() {
        if (this.mHandler == null) {
            this.mHandler = new Handler();
        }
        startReport();
        this.mHandler.post(this.updateTime);
    }

    public void startVideo(MediaView mediaView) {
        ((NormalMediaView) mediaView.getVideoView()).start();
        if (this.adType == AdType.REWARD.value()) {
            this.processBar.setVisibility(0);
        }
    }

    public void OneHalfReport() {
        try {
            LogUtil.d(TAG, "send onVideoOneHalf");
            String[] strArr = this.video_one_half;
            if (strArr != null) {
                for (String str : strArr) {
                    if (!TextUtils.isEmpty(str)) {
                        HttpUtil.asyncGetWithWebViewUA(this, MacroUtil.replaceExposureMacros(str), new DefaultHttpGetWithNoHandlerCallback());
                    }
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void OneQuarterReport() {
        try {
            LogUtil.d(TAG, "send onVideoOneQuarter");
            String[] strArr = this.video_one_quarter;
            if (strArr != null) {
                for (String str : strArr) {
                    if (!TextUtils.isEmpty(str)) {
                        HttpUtil.asyncGetWithWebViewUA(this, MacroUtil.replaceExposureMacros(str), new DefaultHttpGetWithNoHandlerCallback());
                    }
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void ThreeQuarterReport() {
        try {
            LogUtil.d(TAG, "send onVideoThreeQuarter");
            String[] strArr = this.video_three_quarter;
            if (strArr != null) {
                for (String str : strArr) {
                    if (!TextUtils.isEmpty(str)) {
                        HttpUtil.asyncGetWithWebViewUA(this, MacroUtil.replaceExposureMacros(str), new DefaultHttpGetWithNoHandlerCallback());
                    }
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void onAttachedToWindow() {
        super/*android.app.Activity*/.onAttachedToWindow();
    }

    public void onBackPressed() {
    }

    public void onCreate(android.os.Bundle r27) {
        throw new UnsupportedOperationException("Method not decompiled: com.meishu.sdk.activity.MeishuRewardVideoPlayerActivity.onCreate(android.os.Bundle):void");
    }

    public void onDestroy() {
        super.onDestroy();
        GifImageView gifImageView = this.shakeImageView;
        if (gifImageView != null) {
            gifImageView.clear();
        }
        baseFullScreenVideoAdList.clear();
        rewardMediaViews.remove(this.localAdId);
        ShakeUtil.getInstance().remove(this.shakeId);
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.removeCallbacks(this.updateTime);
            this.mHandler = null;
        }
    }

    public void onImageComplete() {
        this.bQuery.id(R.id.ms_video_playing_ad_info_container).gone();
        this.bQuery.id(R.id.ms_ad_info_container).visible();
        this.bQuery.id(R.id.ms_download_button).text(this.actionText);
        this.bQuery.id(R.id.ms_reward_close_button_parent).visible();
        this.bQuery.id(R.id.ms_reward_skip_button).gone();
        this.bQuery.id(R.id.ms_include_ad_tag).gone();
        this.bQuery.id(R.id.ms_include_ad_tag_end).visible();
        sendBroadcast(BaseFullScreenVideoAd.broadcast_on_video_complete, false);
        try {
            LogUtil.d(TAG, "send onVideoComplete");
            String[] strArr = this.video_complete;
            if (strArr != null) {
                for (String str : strArr) {
                    if (!TextUtils.isEmpty(str)) {
                        HttpUtil.asyncGetWithWebViewUA(this, MacroUtil.replaceExposureMacros(str), new DefaultHttpGetWithNoHandlerCallback());
                    }
                }
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        if (this.isShake) {
            ShakeUtil.getInstance().pauseShake();
        }
    }

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        if (this.isShake) {
            ShakeUtil.getInstance().resumeShake();
        }
        for (int i = 0; i < baseFullScreenVideoAdList.size(); i++) {
            IAd iAd = baseFullScreenVideoAdList.get(i);
            if (iAd != null) {
                this.touchContainer.setTouchPositionListener(new TouchPositionListener(iAd));
            }
        }
    }
}