翰林优商.apk(点击下载) / KSRewardVideoActivityProxy.java


package com.kwad.components.ad.reward;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import com.kwad.components.ad.reward.d.e;
import com.kwad.components.ad.reward.d.h;
import com.kwad.components.ad.reward.g.c;
import com.kwad.components.ad.reward.k;
import com.kwad.components.ad.reward.p;
import com.kwad.components.ad.reward.page.BackPressHandleResult;
import com.kwad.components.ad.reward.presenter.platdetail.actionbar.RewardActionBarControl;
import com.kwad.components.core.h.b;
import com.kwad.components.core.n.d;
import com.kwad.components.core.page.AdWebViewVideoActivityProxy;
import com.kwad.components.core.video.DetailVideoView;
import com.kwad.components.core.video.i;
import com.kwad.components.core.video.j;
import com.kwad.components.core.webview.KsAdWebView;
import com.kwad.components.core.webview.jshandler.c;
import com.kwad.components.offline.api.core.adlive.IAdLiveOfflineView;
import com.kwad.components.offline.api.core.adlive.listener.AdLivePlayStateListener;
import com.kwad.components.offline.api.core.adlive.listener.AdLivePlayStateListenerAdapter;
import com.kwad.components.offline.api.core.adlive.listener.OnAdLiveResumeInterceptor;
import com.kwad.sdk.KsAdSDKImpl;
import com.kwad.sdk.R;
import com.kwad.sdk.api.KsRewardVideoAd;
import com.kwad.sdk.api.KsVideoPlayConfig;
import com.kwad.sdk.api.core.KsAdSdkDynamicImpl;
import com.kwad.sdk.api.loader.Wrapper;
import com.kwad.sdk.api.proxy.app.KSRewardLandScapeVideoActivity;
import com.kwad.sdk.api.proxy.app.KsRewardVideoActivity;
import com.kwad.sdk.core.response.model.AdInfo;
import com.kwad.sdk.core.response.model.AdTemplate;
import com.kwad.sdk.core.view.AdBaseFrameLayout;
import com.kwad.sdk.mvp.Presenter;
import com.kwad.sdk.service.ServiceProvider;
import com.kwad.sdk.utils.ah;
import com.kwad.sdk.utils.bi;
import com.kwad.sdk.utils.g;
import java.util.HashMap;

@KsAdSdkDynamicImpl(KsRewardVideoActivity.class)
public class KSRewardVideoActivityProxy extends b<k> implements c, k.b, p.a, d.b, c.a, OnAdLiveResumeInterceptor {
    public static final String KEY_REWARD_TYPE = "key_template_reward_type";
    public static final String KEY_TEMPLATE = "key_template_json";
    public static final String KEY_TEMPLATE_PLAY_AGAIN = "key_template_json_play_again";
    public static final String KEY_VIDEO_PLAY_CONFIG = "key_video_play_config";
    private static final String TAG = "RewardVideo";
    private String listenerKey;
    private AdLivePlayStateListener mAdLivePlayStateListener = new AdLivePlayStateListenerAdapter() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass7 */

        @Override // com.kwad.components.offline.api.core.adlive.listener.AdLivePlayStateListener, com.kwad.components.offline.api.core.adlive.listener.AdLivePlayStateListenerAdapter
        public final void onLivePlayProgress(long j) {
            super.onLivePlayProgress(j);
            KSRewardVideoActivityProxy.this.mPlayTime = j;
        }
    };
    private com.kwad.components.ad.reward.d.a mAdOpenInteractionListener = new com.kwad.components.ad.reward.d.b() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass8 */

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void bF() {
            KsRewardVideoAd.RewardAdInteractionListener F = a.F(KSRewardVideoActivityProxy.this.getUniqueId());
            if (F != null) {
                F.onAdClicked();
            }
            ((k) KSRewardVideoActivityProxy.this.mCallerContext).oW = true;
            ((k) KSRewardVideoActivityProxy.this.mCallerContext).fM();
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void i(boolean z) {
            com.kwad.sdk.kwai.kwai.c.JG().JI();
            KSRewardVideoActivityProxy.this.notifyPageDismiss(false);
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void onRewardVerify() {
            KSRewardVideoActivityProxy.this.notifyRewardVerify();
            KSRewardVideoActivityProxy.this.notifyRewardVerifyStepByStep();
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void onVideoPlayEnd() {
            KsRewardVideoAd.RewardAdInteractionListener F = a.F(KSRewardVideoActivityProxy.this.getUniqueId());
            if (F != null) {
                F.onVideoPlayEnd();
            }
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void onVideoPlayError(int i, int i2) {
            KsRewardVideoAd.RewardAdInteractionListener F = a.F(KSRewardVideoActivityProxy.this.getUniqueId());
            if (F != null) {
                F.onVideoPlayError(i, i2);
            }
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void onVideoPlayStart() {
            KsRewardVideoAd.RewardAdInteractionListener F = a.F(KSRewardVideoActivityProxy.this.getUniqueId());
            if (F != null) {
                F.onVideoPlayStart();
            }
        }

        @Override // com.kwad.components.ad.reward.d.a, com.kwad.components.ad.reward.d.b
        public final void onVideoSkipToEnd(long j) {
            try {
                KsRewardVideoAd.RewardAdInteractionListener F = a.F(KSRewardVideoActivityProxy.this.getUniqueId());
                if (F != null) {
                    F.onVideoSkipToEnd(j);
                }
            } catch (Throwable unused) {
            }
        }
    };
    private com.kwad.components.ad.reward.d.c mAdRewardStepListener = new com.kwad.components.ad.reward.d.c() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass5 */

        @Override // com.kwad.components.ad.reward.d.c
        public final void fq() {
            KSRewardVideoActivityProxy.this.notifyRewardVerifyStepByStep();
        }
    };
    private Context mContext;
    private DetailVideoView mDetailVideoView;
    private boolean mIsBackEnable;
    private com.kwad.components.ad.reward.model.c mModel;
    private boolean mPageDismissCalled;
    private long mPageEnterTime;
    private e mPlayEndPageListener = new e() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass4 */

        @Override // com.kwad.components.ad.reward.d.e
        public final void bE() {
            KSRewardVideoActivityProxy.this.mIsBackEnable = true;
        }
    };
    private FrameLayout mPlayLayout;
    private long mPlayTime;
    private p mRewardPresenter;
    private final h mRewardVerifyListener = new h() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass1 */

        @Override // com.kwad.components.ad.reward.d.h
        public final void onRewardVerify() {
            if (KSRewardVideoActivityProxy.this.mModel.hd()) {
                KSRewardVideoActivityProxy.this.markOpenNsCompleted();
                KSRewardVideoActivityProxy.this.notifyRewardVerify();
                KSRewardVideoActivityProxy.this.notifyRewardVerifyStepByStep();
            }
        }
    };
    private AdBaseFrameLayout mRootContainer;
    private i mVideoPlayStateListener = new j() {
        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass6 */

        @Override // com.kwad.components.core.video.i, com.kwad.components.core.video.j
        public final void onVideoPlayProgress(long j, long j2) {
            KSRewardVideoActivityProxy.this.mPlayTime = j2;
        }
    };

    public static class a {
        private static final HashMap<String, a> nT = new HashMap<>();
        private com.kwad.components.ad.reward.c.c mH;
        private KsRewardVideoAd.RewardAdInteractionListener mInteractionListener;
        private KsRewardVideoAd.RewardAdInteractionListener nU;
        private KsRewardVideoAd.RewardAdInteractionListener nV;

        private static a E(String str) {
            return nT.get(str);
        }

        public static KsRewardVideoAd.RewardAdInteractionListener F(String str) {
            a E = E(str);
            if (E != null) {
                return E.nV;
            }
            return null;
        }

        /* access modifiers changed from: private */
        public static void G(String str) {
            a E = E(str);
            if (E != null) {
                E.nV = E.mInteractionListener;
            }
        }

        /* access modifiers changed from: private */
        public static void H(String str) {
            a E = E(str);
            if (E != null) {
                E.nV = E.nU;
            }
        }

        public static com.kwad.components.ad.reward.c.c I(String str) {
            a E = E(str);
            if (E != null) {
                return E.mH;
            }
            return null;
        }

        /* access modifiers changed from: private */
        public static void J(String str) {
            a E = E(str);
            if (E != null) {
                E.destroy();
                nT.put(str, null);
            }
        }

        public static void a(String str, KsRewardVideoAd.RewardAdInteractionListener rewardAdInteractionListener, KsRewardVideoAd.RewardAdInteractionListener rewardAdInteractionListener2, com.kwad.components.ad.reward.c.c cVar) {
            a aVar = new a();
            aVar.mInteractionListener = rewardAdInteractionListener;
            aVar.nU = rewardAdInteractionListener2;
            aVar.mH = cVar;
            aVar.nV = rewardAdInteractionListener;
            nT.put(str, aVar);
        }

        private void destroy() {
            this.mInteractionListener = null;
            this.nU = null;
            this.nV = null;
            com.kwad.components.ad.reward.c.c cVar = this.mH;
            if (cVar != null) {
                cVar.destroy();
                this.mH = null;
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private String getUniqueId() {
        return this.listenerKey;
    }

    private void handleNotifyVerify() {
        ((k) this.mCallerContext).mRewardVerifyCalled = true;
        this.mModel.getAdTemplate().mRewardVerifyCalled = true;
        i.fy().n(this.mModel.getAdTemplate());
        com.kwad.sdk.core.report.a.aU(this.mModel.getAdTemplate());
        if (!((k) this.mCallerContext).mAdTemplate.converted) {
            com.kwad.components.ad.reward.b.a.gH().gI().N(com.kwad.components.ad.reward.b.b.qQ);
        }
        KsRewardVideoAd.RewardAdInteractionListener F = a.F(getUniqueId());
        if (F != null) {
            F.onRewardVerify();
            com.kwad.components.ad.reward.monitor.a.a(this.mModel.getAdTemplate(), 0, -1, true);
        }
        if (com.kwad.sdk.core.response.a.a.cl(this.mModel.bC()) && !((k) this.mCallerContext).mAdTemplate.converted && !((k) this.mCallerContext).fT()) {
            k.a(getActivity(), (k) this.mCallerContext);
        }
    }

    private void initView() {
        AdBaseFrameLayout adBaseFrameLayout = (AdBaseFrameLayout) findViewById(R.id.ksad_root_container);
        this.mRootContainer = adBaseFrameLayout;
        this.mDetailVideoView = (DetailVideoView) adBaseFrameLayout.findViewById(R.id.ksad_video_player);
        this.mPlayLayout = (FrameLayout) this.mRootContainer.findViewById(R.id.ksad_reward_play_layout);
        boolean z = !ah.dh(this.mContext);
        if ((this.mModel.hc() || this.mModel.hd()) && z) {
            this.mDetailVideoView.setForce(true);
        }
        this.mDetailVideoView.setAd(true);
    }

    private void initWithModel(com.kwad.components.ad.reward.model.c cVar) {
        if (this.mModel.getAdTemplate() != null && this.mModel.getAdTemplate().mPlayAgain != null) {
            final AdTemplate adTemplate = this.mModel.getAdTemplate().mPlayAgain;
            g.execute(new Runnable() {
                /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass2 */

                public final void run() {
                    boolean a = com.kwad.components.ad.b.a.a(adTemplate, true);
                    com.kwad.sdk.core.e.b.d("RewardVideo", "cache playAgain result: " + a);
                }
            });
        }
    }

    private boolean isLaunchTaskCompleted() {
        return ((k) this.mCallerContext).oN != null && ((k) this.mCallerContext).oN.isCompleted();
    }

    public static void launch(Context context, AdTemplate adTemplate, KsVideoPlayConfig ksVideoPlayConfig, KsRewardVideoAd.RewardAdInteractionListener rewardAdInteractionListener, KsRewardVideoAd.RewardAdInteractionListener rewardAdInteractionListener2, com.kwad.components.ad.reward.c.c cVar, int i) {
        Intent intent;
        com.kwad.sdk.utils.k.cF(adTemplate);
        if (ksVideoPlayConfig.isShowLandscape()) {
            com.kwad.sdk.service.a.g(KSRewardLandScapeVideoActivity.class, KSRewardLandScapeVideoActivityProxy.class);
            intent = new Intent(context, KSRewardLandScapeVideoActivity.class);
        } else {
            com.kwad.sdk.service.a.g(KsRewardVideoActivity.class, KSRewardVideoActivityProxy.class);
            intent = new Intent(context, KsRewardVideoActivity.class);
        }
        intent.setFlags(268435456);
        intent.putExtra("key_template_json", adTemplate.toJson().toString());
        intent.putExtra("key_video_play_config", ksVideoPlayConfig);
        intent.putExtra(KEY_REWARD_TYPE, i);
        if (adTemplate.hasPlayAgain() && rewardAdInteractionListener2 != null) {
            intent.putExtra(KEY_TEMPLATE_PLAY_AGAIN, adTemplate.mPlayAgain.toJson().toString());
        }
        String uniqueId = adTemplate.getUniqueId();
        a.a(uniqueId, rewardAdInteractionListener, rewardAdInteractionListener2, cVar);
        a.G(uniqueId);
        context.startActivity(intent);
        com.kwad.sdk.kwai.kwai.c.JG().bJ(true);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void markOpenNsCompleted() {
        if (((k) this.mCallerContext).oO != null) {
            ((k) this.mCallerContext).oO.markOpenNsCompleted();
        }
    }

    private boolean needHandledOnResume() {
        return ((k) this.mCallerContext).ox || isRefluxVisible();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void notifyPageDismiss(boolean z) {
        com.kwad.components.ad.reward.model.c cVar;
        if (!this.mPageDismissCalled && this.mCallerContext != null && (cVar = this.mModel) != null) {
            this.mPageDismissCalled = true;
            com.kwad.sdk.core.report.a.p(cVar.getAdTemplate(), (int) Math.ceil((double) (((float) this.mPlayTime) / 1000.0f)));
            if (z) {
                com.kwad.sdk.core.report.a.a(this.mModel.getAdTemplate(), 1, ((k) this.mCallerContext).mReportExtData);
            } else {
                com.kwad.sdk.core.report.a.a(this.mModel.getAdTemplate(), 6, this.mModel.hg());
            }
            KsRewardVideoAd.RewardAdInteractionListener F = a.F(getUniqueId());
            if (F != null) {
                F.onPageDismiss();
            }
        }
    }

    private void notifyRewardStep(int i, int i2) {
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar != null && !com.kwad.sdk.core.response.a.d.cy(cVar.getAdTemplate()) && !((k) this.mCallerContext).oG.contains(Integer.valueOf(i2))) {
            ((k) this.mCallerContext).oG.add(Integer.valueOf(i2));
            q.a(i, i2, (k) this.mCallerContext, this.mModel);
            if (a.F(getUniqueId()) != null) {
                try {
                    a.F(getUniqueId()).onRewardStepVerify(i, i2);
                    com.kwad.components.ad.reward.monitor.a.a(this.mModel.getAdTemplate(), i, i2, false);
                } catch (Throwable th) {
                    com.kwad.sdk.core.e.b.printStackTraceOnly(th);
                }
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void notifyRewardVerify() {
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar != null && !com.kwad.sdk.core.response.a.d.cy(cVar.getAdTemplate()) && !((k) this.mCallerContext).mRewardVerifyCalled) {
            boolean z = true;
            if (this.mModel.hc()) {
                if (((k) this.mCallerContext).oN == null || !((k) this.mCallerContext).oN.isCompleted()) {
                    z = false;
                }
                if (z) {
                    handleNotifyVerify();
                }
            } else if (this.mModel.hd()) {
                if (((k) this.mCallerContext).oO == null || !((k) this.mCallerContext).oO.isCompleted()) {
                    z = false;
                }
                if (z) {
                    handleNotifyVerify();
                }
            } else {
                handleNotifyVerify();
            }
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void notifyRewardVerifyStepByStep() {
        if (this.mModel.hc()) {
            notifyRewardStep(2, 0);
            if (isLaunchTaskCompleted()) {
                notifyRewardStep(2, 2);
            }
        } else if (this.mModel.hd()) {
            boolean z = ((k) this.mCallerContext).oO != null && ((k) this.mCallerContext).oO.isCompleted();
            notifyRewardStep(1, 0);
            if (z) {
                notifyRewardStep(1, 1);
            }
        } else {
            notifyRewardStep(0, 0);
        }
    }

    public static void register() {
        com.kwad.sdk.service.a.g(KsRewardVideoActivity.class, KSRewardVideoActivityProxy.class);
    }

    @Override // com.kwad.sdk.api.proxy.IActivityProxy
    public void finish() {
        notifyPageDismiss(false);
        getActivity().finish();
    }

    @Override // com.kwad.components.core.j.a
    public String getPageName() {
        return "KSRewardLandScapeVideoActivityProxy";
    }

    @Override // com.kwad.components.offline.api.core.adlive.listener.OnAdLiveResumeInterceptor
    public boolean handledAdLiveOnResume() {
        return needHandledOnResume();
    }

    @Override // com.kwad.components.ad.reward.k.b
    public boolean interceptPlayCardResume() {
        return needHandledOnResume();
    }

    public boolean isRefluxVisible() {
        return this.mRewardPresenter.isRefluxVisible();
    }

    @Override // com.kwad.sdk.api.proxy.IActivityProxy
    public void onBackPressed() {
        BackPressHandleResult gk = this.mRewardPresenter.gk();
        if (!gk.equals(BackPressHandleResult.HANDLED)) {
            if (gk.equals(BackPressHandleResult.HANDLED_CLOSE)) {
                super.onBackPressed();
                notifyPageDismiss(false);
            } else if (this.mIsBackEnable) {
                notifyPageDismiss(false);
                super.onBackPressed();
            }
        }
    }

    @Override // com.kwad.sdk.api.proxy.IActivityProxy, com.kwad.components.core.j.a
    public void onCreate(Bundle bundle) {
        try {
            getIntent().removeExtra(AdWebViewVideoActivityProxy.KEY_TEMPLATE);
        } catch (Throwable unused) {
        }
        super.onCreate(bundle);
        getActivity().setTheme(16973838);
        com.kwad.components.ad.reward.model.c c = com.kwad.components.ad.reward.model.c.c(getIntent());
        this.mModel = c;
        if (c == null) {
            finish();
            return;
        }
        this.listenerKey = c.getAdTemplate().getUniqueId();
        this.mPageEnterTime = SystemClock.elapsedRealtime();
        com.kwad.components.ad.reward.monitor.a.a(true, this.mModel.getAdTemplate(), this.mPageEnterTime);
        com.kwad.components.ad.reward.monitor.a.b(true, this.mModel.getAdTemplate(), this.mPageEnterTime);
        d.oC().a(this);
        this.mContext = Wrapper.wrapContextIfNeed(getActivity());
        initWithModel(this.mModel);
        setContentView(R.layout.ksad_activity_reward_video);
        initView();
        onActivityCreated(this.mRootContainer);
        c.fk().a(this.mRewardVerifyListener);
    }

    /* access modifiers changed from: protected */
    @Override // com.kwad.components.core.h.b
    public k onCreateCallerContext() {
        AdTemplate adTemplate = this.mModel.getAdTemplate();
        AdInfo bC = this.mModel.bC();
        final k kVar = new k();
        kVar.Hs = this;
        kVar.mContext = this.mContext;
        kVar.mPageEnterTime = this.mPageEnterTime;
        kVar.mAdOpenInteractionListener = this.mAdOpenInteractionListener;
        kVar.mAdRewardStepListener = this.mAdRewardStepListener;
        kVar.mScreenOrientation = this.mModel.getScreenOrientation();
        kVar.mVideoPlayConfig = this.mModel.he();
        kVar.mReportExtData = this.mModel.hg();
        kVar.mRootContainer = this.mRootContainer;
        kVar.mAdTemplate = adTemplate;
        com.kwad.components.core.offline.api.kwai.a aVar = (com.kwad.components.core.offline.api.kwai.a) com.kwad.sdk.components.c.g(com.kwad.components.core.offline.api.kwai.a.class);
        com.kwad.sdk.service.kwai.a aVar2 = (com.kwad.sdk.service.kwai.a) ServiceProvider.get(com.kwad.sdk.service.kwai.a.class);
        boolean z = false;
        if (aVar != null && aVar2 != null && aVar2.Fq() && com.kwad.sdk.core.response.a.a.ce(com.kwad.sdk.core.response.a.d.cs(adTemplate))) {
            IAdLiveOfflineView view = aVar.getView(this.mContext, com.kwad.sdk.core.response.a.a.aM(bC) == 8);
            View view2 = view.getView();
            kVar.oj = view;
            this.mPlayLayout.addView(view2);
            kVar.ok = aVar.getAdLivePlayModule(view, KsAdSDKImpl.get().getAppId(), String.valueOf(com.kwad.sdk.core.response.a.a.bG(bC)));
            kVar.ok.addInterceptor(this);
            kVar.ok.registerAdLivePlayStateListener(this.mAdLivePlayStateListener);
        }
        kVar.oi = this.mDetailVideoView;
        if (this.mModel.hf() == 2) {
            z = true;
        }
        com.kwad.components.ad.reward.k.a aVar3 = new com.kwad.components.ad.reward.k.a(kVar, z);
        kVar.gx = aVar3;
        kVar.gx.a(this.mVideoPlayStateListener);
        kVar.a(aVar3);
        kVar.a((k.b) this);
        if (com.kwad.sdk.core.response.a.a.as(bC)) {
            kVar.mApkDownloadHelper = new com.kwad.components.core.c.a.c(adTemplate, this.mModel.hg());
        }
        kVar.om = new RewardActionBarControl(kVar, this.mContext, adTemplate);
        kVar.a(this.mPlayEndPageListener);
        if (com.kwad.sdk.core.response.a.b.bz(adTemplate)) {
            kVar.on = new m(kVar, this.mModel.hg(), null);
            kVar.on.a(new com.kwad.components.ad.reward.b.d() {
                /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass3 */

                @Override // com.kwad.components.ad.reward.b.d
                public final void a(com.kwad.components.ad.reward.b.b bVar) {
                    kVar.b(bVar);
                }
            });
        }
        if (com.kwad.sdk.core.response.a.b.bT(adTemplate)) {
            String bV = com.kwad.sdk.core.response.a.b.bV(adTemplate);
            if (!TextUtils.isEmpty(bV)) {
                kVar.oo = new com.kwad.components.ad.i.b(this.mModel.hg(), bV);
                kVar.oo.a(this);
            }
        }
        if (com.kwad.sdk.core.response.a.a.ad(bC)) {
            kVar.op = new com.kwad.components.ad.i.a().ab(true);
        }
        kVar.oA = true;
        if (com.kwad.sdk.core.response.a.a.bl(bC)) {
            kVar.ol = new com.kwad.components.core.playable.a((KsAdWebView) findViewById(R.id.ksad_playable_webview));
        }
        kVar.oR = 0;
        if (this.mModel.bC() != null) {
            kVar.oR = com.kwad.sdk.core.response.a.a.bl(this.mModel.bC()) ? com.kwad.sdk.core.response.a.a.ac(this.mModel.bC()) : com.kwad.sdk.core.response.a.a.ab(this.mModel.bC());
        }
        kVar.a((com.kwad.components.ad.reward.g.c) this);
        return kVar;
    }

    @Override // com.kwad.components.core.h.b
    public Presenter onCreatePresenter() {
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar == null) {
            return null;
        }
        p pVar = new p(this, this.mRootContainer, cVar, (k) this.mCallerContext);
        this.mRewardPresenter = pVar;
        pVar.a(this);
        return this.mRewardPresenter;
    }

    @Override // com.kwad.sdk.api.proxy.IActivityProxy, com.kwad.components.core.h.b, com.kwad.components.core.j.a
    public void onDestroy() {
        c.fk().b(this.mRewardVerifyListener);
        super.onDestroy();
        this.listenerKey = null;
        if (this.mCallerContext != null) {
            ((k) this.mCallerContext).gx.b(this.mVideoPlayStateListener);
            if (((k) this.mCallerContext).ok != null) {
                ((k) this.mCallerContext).ok.removeInterceptor(this);
                ((k) this.mCallerContext).ok.unRegisterAdLivePlayStateListener(this.mAdLivePlayStateListener);
            }
            a.J(getUniqueId());
        }
        notifyPageDismiss(false);
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar != null) {
            String C = com.kwad.sdk.core.response.a.a.C(cVar.bC());
            if (!TextUtils.isEmpty(C)) {
                com.kwad.sdk.core.videocache.b.a.bE(this.mContext.getApplicationContext()).dV(C);
            }
        }
        d.oC().b(this);
        i.fy().release();
        com.kwad.components.core.webview.b.c.a.qh().qi();
    }

    @Override // com.kwad.components.core.n.d.b
    public void onPageClose() {
        finish();
    }

    /* JADX WARNING: Code restructure failed: missing block: B:3:0x0005, code lost:
        r0 = r0.getAdTemplate().mPlayAgain;
     */
    @Override // com.kwad.components.core.webview.jshandler.c.a, com.kwad.components.ad.reward.g.c
    public void onPlayAgainClick() {
        final AdTemplate adTemplate;
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar != null && adTemplate != null) {
            adTemplate.inPlayAgain = true;
            this.mRewardPresenter.bz();
            this.mRewardPresenter = null;
            this.mPresenter = null;
            g.execute(new Runnable() {
                /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass9 */

                public final void run() {
                    ((k) KSRewardVideoActivityProxy.this.mCallerContext).releaseSync();
                    bi.runOnUiThread(new Runnable() {
                        /* class com.kwad.components.ad.reward.KSRewardVideoActivityProxy.AnonymousClass9.AnonymousClass1 */

                        public final void run() {
                            KSRewardVideoActivityProxy.this.mModel.z(adTemplate);
                            a.H(KSRewardVideoActivityProxy.this.getUniqueId());
                            KSRewardVideoActivityProxy.this.onActivityCreated(KSRewardVideoActivityProxy.this.mRootView);
                        }
                    });
                }
            });
        }
    }

    @Override // com.kwad.sdk.api.proxy.IActivityProxy, com.kwad.components.core.h.b, com.kwad.components.core.j.a
    public void onResume() {
        super.onResume();
        com.kwad.components.ad.reward.model.c cVar = this.mModel;
        if (cVar != null) {
            AdTemplate adTemplate = cVar.getAdTemplate();
            com.kwad.sdk.core.d.a.Mv();
            com.kwad.sdk.core.d.a.aB(adTemplate);
        }
        com.kwad.components.ad.reward.b.a.gH().N(this.mContext);
    }

    @Override // com.kwad.components.ad.reward.p.a
    public void onUnbind() {
        this.mIsBackEnable = false;
        ((k) this.mCallerContext).mRewardVerifyCalled = false;
        ((k) this.mCallerContext).oE = false;
    }
}