package com.ss.android.ugc.aweme.ttep;

import X.070;
import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.1hK;
import X.2GD;
import X.2GO;
import X.2HZ;
import X.2OR;
import X.2nK;
import X.3i8;
import X.56Y;
import X.5gd;
import X.6CS;
import X.6CT;
import X.6EB;
import X.6Hn;
import X.6J4;
import X.6Jy;
import X.6Zq;
import X.6nl;
import X.6r4;
import X.6xb;
import X.6xi;
import X.6zL;
import X.71H;
import X.78o;
import X.7he;
import X.7lW;
import X.8gF;
import X.8no;
import X.C1045MjQ;
import X.C1906MxJ;
import X.C2498NGj;
import X.C2700NOd;
import X.C2711NOo;
import X.C2719NOw;
import X.C2752NQd;
import X.C2753NQe;
import X.C2757NQi;
import X.C2762NQn;
import X.C2770NQv;
import X.C2961NYe;
import X.C3091NbK;
import X.C3179Nck;
import X.C3207NdC;
import X.C3211NdG;
import X.C3219NdO;
import X.C3220NdP;
import X.C3224NdT;
import X.C3232Ndb;
import X.C3240Ndj;
import X.C3241Ndk;
import X.C3242Ndl;
import X.C3243Ndm;
import X.C3678Nkn;
import X.C4087NrO;
import X.C4209NtM;
import X.C4220NtX;
import X.C4742O4r;
import X.C5906Ofd;
import X.C5924Ofv;
import X.CqM;
import X.Crj;
import X.FR3;
import X.FWb;
import X.FgP;
import X.Fmi;
import X.FnA;
import X.FnV;
import X.Fnq;
import X.FoK;
import X.FsG;
import X.Hy6;
import X.I12;
import X.I8D;
import X.ISm;
import X.MJK;
import X.MWE;
import X.NB5;
import X.NDV;
import X.NED;
import X.NI0;
import X.NIL;
import X.NKC;
import X.NKF;
import X.NNA;
import X.NOC;
import X.NPK;
import X.NQJ;
import X.NQV;
import X.O41;
import X.ODZ;
import X.RSB;
import X.Rc9;
import X.T93;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Looper;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.bytedance.als.ApiCenter;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ttve.monitor.TEMonitorInvoker;
import com.ss.android.ugc.aweme.commerce.tools.tcm.service.CommerceToolsTcmServiceImpl;
import com.ss.android.ugc.aweme.initializer.AVServiceProxyImpl;
import com.ss.android.ugc.aweme.internal.AVCommerceServiceImpl;
import com.ss.android.ugc.aweme.port.internal.IVideoRecordPreferences;
import com.ss.android.ugc.aweme.shortvideo.SafeHandler;
import com.ss.android.ugc.aweme.shortvideo.ShortVideoContext;
import com.ss.android.ugc.aweme.shortvideo.ShortVideoContextViewModel;
import com.ss.android.ugc.aweme.shortvideo.model.MusicModel;
import com.ss.android.ugc.aweme.shortvideo.mvtemplate.choosemedia.an;
import com.ss.android.ugc.aweme.shortvideo.ui.TimeSpeedModelExtension;
import com.ss.android.ugc.aweme.sticker.StickerWrapper;
import com.ss.android.ugc.aweme.sticker.model.FaceStickerBean;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import com.ss.android.vesdk.runtime.VEMem;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public class TTEPEffectPreviewActivity extends 6Jy implements C2752NQd, 6zL, C2753NQe, FsG, C2762NQn, NB5, 2HZ, 2GO {
    public final Crj<ApiCenter> LJ = 7he.LIZ(new C3219NdO(this));
    public C4087NrO LJFF;
    public ShortVideoContext LJI;
    public SafeHandler LJII = new SafeHandler(this);
    public C2770NQv LJIIIIZZ;
    public FrameLayout LJIIIZ;
    public SurfaceView LJIIJ;
    public FrameLayout LJIIJJI;
    public List<String> LJIIL;
    public Effect LJIILIIL;
    public boolean LJIILJJIL;
    public String LJIILL;
    public String LJIILLIIL;
    public NIL LJIIZILJ = new NIL();
    public C2757NQi LJIJ;
    public an LJIJI;
    public Effect LJIJJ;
    public FrameLayout LJIJJLI;
    public volatile boolean LJIL = true;
    public boolean LJJ;
    public boolean LJJI = false;
    public NQJ LJJIFFI;
    public String LJJII;
    public ArrayList<StickerWrapper> LJJIII = new ArrayList<>();
    public C1906MxJ LJJIIJ;
    public NQV LJJIIJZLJL;
    public C2498NGj LJJIIZ;
    public C2719NOw LJJIIZI;
    public NI0 LJJIJ;
    public List<6CT> LJJIJIIJI = new ArrayList();
    public List<6CS> LJJIJIIJIL = new ArrayList();
    public FrameLayout LJJIJIL;
    public C3243Ndm LJJIJL;
    public boolean LJJIJLIJ = false;
    public boolean LJJIL = false;
    public int LJJIZ;
    public NNA LJJJ;
    public boolean LJJJI = false;

    static {
        Covode.recordClassIndex(120474);
    }

    public final void LIZ(6CS r1) {
    }

    public final String LJIIL() {
        return "TTEPEffectPreviewActivity";
    }

    public final boolean cz_() {
        return true;
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(298, new Rc9(TTEPEffectPreviewActivity.class, "receiveToast", C3220NdP.class, ThreadMode.POSTING, 0, true));
        hashMap.put(299, new Rc9(TTEPEffectPreviewActivity.class, "onEvent", 6Hn.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity", "onWindowFocusChanged", true);
        TTEPEffectPreviewActivity.super.onWindowFocusChanged(z);
    }

    public final C4087NrO LJIIIZ() {
        return this.LJFF;
    }

    public final FrameLayout LJIIJ() {
        return this.LJJIJIL;
    }

    public final T93 LJIIZILJ() {
        return this.LJIIIIZZ;
    }

    public final void LJI() {
        an anVar = this.LJIJI;
        if (anVar != null) {
            anVar.LJJLI = false;
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.content.Context, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    public final int cA_() {
        return 070.LIZJ(this, 2131099762);
    }

    public final void LIZLLL() {
        getWindow().setFlags(0, Integer.MIN_VALUE);
    }

    public final boolean LJII() {
        an anVar = this.LJIJI;
        if (anVar != null) {
            return anVar.LJJLI;
        }
        return false;
    }

    public final FrameLayout.LayoutParams LJIIJJI() {
        SurfaceView surfaceView = this.LJIIJ;
        if (surfaceView == null) {
            return null;
        }
        return (FrameLayout.LayoutParams) surfaceView.getLayoutParams();
    }

    public final ShortVideoContextViewModel LJIJI() {
        return LIZ((1hK) this).LIZ(ShortVideoContextViewModel.class);
    }

    public final void LJIJJ() {
        NQV nqv = this.LJJIIJZLJL;
        if (nqv != null) {
            nqv.LIZIZ(false);
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.6GL, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onStart() {
        8gF.LIZ(this);
        TTEPEffectPreviewActivity.super.onStart();
        C3678Nkn.LIZ((MWE) new C3211NdG());
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [android.content.Context, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    private void LJJ() {
        IVideoRecordPreferences iVideoRecordPreferences = (IVideoRecordPreferences) new 8no((byte) 0).LIZ(this, IVideoRecordPreferences.class);
        if (iVideoRecordPreferences != null && iVideoRecordPreferences.isFirstEnterRecordPage(true)) {
            iVideoRecordPreferences.setFirstEnterRecordPage(false);
        }
    }

    public final O41 LIZ() {
        an anVar = this.LJIJI;
        if (anVar == null || anVar.LJIILIIL == null) {
            return new O41((MusicModel) null, (String) null);
        }
        return this.LJIJI.LIZ();
    }

    public final O41 LJ() {
        an anVar = this.LJIJI;
        if (anVar == null || anVar.LJIILIIL == null) {
            return new O41((MusicModel) null, (String) null);
        }
        return this.LJIJI.LJ();
    }

    public final void LJIILIIL() {
        if (!isFinishing() && getIntent().getBooleanExtra("auto_start_recording", false)) {
            this.LJJIIJZLJL.LJJI();
        }
    }

    public final NI0 LJIILLIIL() {
        if (this.LJJIJ == null) {
            this.LJJIJ = (NI0) this.LJFF.LIZIZ(NI0.class);
        }
        return this.LJJIJ;
    }

    public final NDV LJIJ() {
        return ((ApiCenter) this.LJ.getValue()).LIZIZ(NDV.class);
    }

    private void LJIJJLI() {
        this.LJJIIJ.LJJIJ().LIZ((I12) new I8D(new 71H(this.LJI.LIZJ.LJII)), this.LJI.LIZJ.LJII.LJ().getAbsolutePath());
        this.LJJIIJ.LJJIIZI();
    }

    public final void LJIIIIZZ() {
        if (this.LJI != null) {
            dN_().LIZ(this.LJIIJ, this.LJI.LIZJ.LIZJ, this.LJI.LIZJ.LIZLLL);
        }
        C2757NQi nQi = this.LJIJ;
        if (nQi != null) {
            nQi.LIZIZ();
        }
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [android.content.Context, X.Ltg, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onPause() {
        8gF.LIZJ(this);
        TTEPEffectPreviewActivity.super.onPause();
        this.LJJIL = false;
        Hy6.LIZ.LIZIZ();
        56Y.LIZ.pause(this, "record", this.LJI.LJIJI, this.LJI.LJIJ.getCreationId());
        RSB.LJIILIIL.LIZ().LIZIZ("tool_record");
        VEMem.getInstance().uploadVirtualMemSize(1);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.Ltg, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onStop() {
        8gF.LIZLLL(this);
        TTEPEffectPreviewActivity.super.onStop();
        LJIJJ();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    private void LJIL() {
        if (this.LJI.LJIJI != null) {
            String str = FaceStickerBean.sCurPropSource;
            String str2 = this.LJI.LJIJI;
            str2.hashCode();
            switch (str2.hashCode()) {
                case -1731750228:
                    if (str2.equals("single_song")) {
                        str = "single_song";
                        break;
                    }
                    break;
                case -1098262888:
                    if (str2.equals("prop_reuse")) {
                        str = "prop_reuse";
                        break;
                    }
                    break;
                case 3449699:
                    if (str2.equals("prop")) {
                        str = "homepage_prop_maker";
                        break;
                    }
                    break;
                case 3524221:
                    if (str2.equals("scan")) {
                        str = "qr_code";
                        break;
                    }
                    break;
                case 669986889:
                    if (str2.equals("direct_shoot")) {
                        str = "direct_shoot";
                        break;
                    }
                    break;
                case 1402633315:
                    if (str2.equals("challenge")) {
                        str = "challenge";
                        break;
                    }
                    break;
            }
            FaceStickerBean.sCurPropSource = str;
        }
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [X.1oX, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public final void LJIILL() {
        MethodCollector.i(4560);
        if (isFinishing()) {
            MethodCollector.o(4560);
            return;
        }
        56Y.LIZ.step("av_video_record_init", "addFragment");
        6Zq.LIZ("addFragment PlanC");
        C3243Ndm ndm = this.LJJIJL;
        if (ndm != null) {
            ndm.LIZIZ();
            this.LJJIJL = null;
            ((ViewGroup) findViewById(2131369374)).removeAllViews();
        }
        C2757NQi LIZ = LIZ(getIntent());
        this.LJIJ = LIZ;
        LIZ.LJFF = new C3179Nck(this);
        ODZ LIZ2 = C5906Ofd.LIZ((Activity) this, (Class<? extends C5924Ofv>) C2757NQi.class);
        LIZ2.LJ = false;
        LIZ2.LJFF = new C3207NdC(this);
        LIZ2.LIZIZ = false;
        LIZ2.LIZJ = false;
        LIZ2.LIZLLL = 2131369374;
        this.LJJIJL = LIZ2.LIZ();
        MethodCollector.o(4560);
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [android.content.Context, X.6Jy, java.lang.Object, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onDestroy() {
        8gF.LJ(this);
        TTEPEffectPreviewActivity.super.onDestroy();
        C1045MjQ.LIZ.LIZ();
        LJJ();
        NOC.LIZJ.LIZ();
        C4220NtX.LJI.LJIIIIZZ().LIZLLL();
        this.LJIJ = null;
        EventBus.LIZ().LIZIZ(this);
        Hy6.LIZ.LIZ();
        C4209NtM.LIZIZ();
        AVCommerceServiceImpl.LJ().LIZIZ();
        56Y.LIZ.leave(this, "record");
        5gd.LIZIZ.LIZ();
        if (!this.LJJJI) {
            6nl.LIZ().LIZLLL();
            this.LJJJI = false;
        }
        78o.LJ.LIZ(this);
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [X.6Jy, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void finish() {
        String LIZ = LIZ(getIntent(), "backurl");
        if (LIZJ(getIntent())) {
            AVServiceProxyImpl.createIAVServiceProxybyMonsterPlugin(false).getMiniAppService().LIZ(getIntent().getSerializableExtra("micro_app_info").getAppId());
        }
        TTEPEffectPreviewActivity.super.finish();
        if (this.LJIJ != null) {
            if (Looper.myLooper() == Looper.getMainLooper()) {
                LJIJJ();
            } else {
                runOnUiThread(new C3232Ndb(this));
            }
        }
        if (!TextUtils.isEmpty(LIZ) && !LIZJ(getIntent()) && !TextUtils.isEmpty(LIZ) && !TextUtils.equals("__BACKURL__", LIZ)) {
            try {
                Uri parse = Uri.parse(LIZ);
                Intent intent = new Intent();
                intent.setData(parse);
                intent.setAction("android.intent.action.VIEW");
                intent.addCategory("android.intent.category.BROWSABLE");
                intent.setComponent((ComponentName) null);
                intent.setSelector((Intent) null);
                startActivityIfNeeded(intent, -1);
                moveTaskToBack(true);
            } catch (Exception unused) {
            }
        }
        Fnq.LIZIZ(this, 3);
    }

    /* JADX WARNING: type inference failed for: r8v0, types: [android.content.Context, X.1hK, X.6GL, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity", "onResume", true);
        6Zq.LIZ("TTEPEffectPreviewActivity => onResume start");
        TTEPEffectPreviewActivity.super.onResume();
        if (this.LJI.LJJJJI) {
            CqM.LIZ(new 6EB());
        }
        RSB.LJIILIIL.LIZ().LIZ("tool_record");
        this.LJJIL = true;
        if (this.LJJIJLIJ) {
            C4220NtX.LJJIIJZLJL.LIZ(this, C4220NtX.LJJIIJZLJL.LIZ());
            this.LJJIJLIJ = false;
        }
        6J4 r7 = new 6J4();
        r7.LIZ("scene", "resume_record");
        r7.LIZ("shoot_way", this.LJI.LJIJI);
        r7.LIZ("creation_id", this.LJI.LJIJ.getCreationId());
        r7.LIZ("enter_from", this.LJI.LJJIFFI);
        r7.LIZ("dalvikPss", Hy6.LIZ.LIZJ);
        r7.LIZ("nativePss", Hy6.LIZ.LIZLLL);
        r7.LIZ("otherPss", Hy6.LIZ.LJFF);
        r7.LIZ("totalPss", Hy6.LIZ.LJ);
        2nK.LIZ("av_memory_log", r7.LIZ);
        6Zq.LIZ("TTEPEffectPreviewActivity => onResume end");
        Hy6.LIZ.LIZ(this, this.LJJIJIL);
        if (this.LJI != null) {
            this.LJJIIJ.LJJIJ().LJ(this.LJI.LIZJ.LIZ());
            this.LJJIIJ.LJJIJ().LJFF(this.LJI.LIZJ.LIZ());
        }
        boolean LIZ = FR3.LIZ();
        boolean LIZ2 = FnV.LIZ();
        if (LIZ || LIZ2) {
            Fmi.LIZ.LIZ(this, new C3240Ndj(this));
        } else {
            FnA fnA = FnA.LIZ;
            Context applicationContext = getApplicationContext();
            if (7lW.LIZJ && applicationContext == null) {
                applicationContext = 7lW.LIZ;
            }
            if (!fnA.LIZ(applicationContext, true)) {
                FoK.LIZIZ.LIZ(this, new C3241Ndk(this), new C3242Ndl(this));
            }
        }
        VEMem.getInstance().uploadVirtualMemSize(0);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity", "onResume", false);
    }

    public static Bundle LIZIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public final void LIZJ(6CS r2) {
        this.LJJIJIIJIL.remove(r2);
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ = 0By.LIZ(r2, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ, r2);
        }
        return LIZ;
    }

    private boolean LIZJ(Intent intent) {
        if (intent == null || intent.getSerializableExtra("micro_app_info") == null) {
            return false;
        }
        return true;
    }

    public final void LIZIZ(6CS r2) {
        this.LJJIJIIJIL.add(r2);
    }

    public final void LIZIZ(6CT r2) {
        this.LJJIJIIJI.remove(r2);
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [android.content.Context, X.Ltg, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    public void onSaveInstanceState(Bundle bundle) {
        TTEPEffectPreviewActivity.super.onSaveInstanceState(bundle);
        bundle.remove("android:fragments");
        this.LJJJI = true;
        bundle.putParcelable("save_state_short_video_context", this.LJI);
        78o r0 = 78o.LJ;
        getIntent();
        r0.LIZ(this, bundle);
    }

    private C2757NQi LIZ(Intent intent) {
        if (intent == null) {
            ShortVideoContext shortVideoContext = this.LJI;
            Intent intent2 = getIntent();
            this.LJJIIJ.LJJIJ();
            return new C2757NQi(shortVideoContext, intent2, this.LJFF, NKC.LIZ);
        }
        ShortVideoContext shortVideoContext2 = this.LJI;
        this.LJJIIJ.LJJIJ();
        return new C2757NQi(shortVideoContext2, intent, this.LJFF, NKF.LIZ);
    }

    public final void LIZIZ(boolean z) {
        C2757NQi nQi = this.LJIJ;
        if (nQi != null) {
            nQi.LIZIZ(z);
        }
    }

    public void onConfigurationChanged(Configuration configuration) {
        TTEPEffectPreviewActivity.super.onConfigurationChanged(configuration);
        if (this.LJJIZ != configuration.screenWidthDp) {
            this.LJJIZ = configuration.screenWidthDp;
            dN_().LIZ(this.LJIIJ, this.LJI.LIZJ.LIZJ, this.LJI.LIZJ.LIZLLL);
        }
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [android.content.Context, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    @ISm(LIZIZ = true)
    public void receiveToast(C3220NdP ndP) {
        if (TextUtils.equals(ndP.LIZ, "sticker_unlocked")) {
            this.LJJIJLIJ = true;
            this.LJIJJ = ndP.LIZIZ;
            if (this.LJJIL && !ndP.LIZLLL) {
                C4220NtX.LJJIIJZLJL.LIZ(this, C4220NtX.LJJIIJZLJL.LIZ());
                this.LJJIJLIJ = false;
            }
            EventBus.LIZ().LJFF(ndP);
        }
    }

    public final void LIZ(6CT r2) {
        this.LJJIJIIJI.add(r2);
    }

    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            C2961NYe LIZIZ = ApiCenter.LIZIZ.LIZ(this).LIZIZ(C2961NYe.class);
            if (LIZIZ != null) {
                LIZIZ.dismissSuperEntranceEvent();
            }
            C2961NYe LIZIZ2 = ApiCenter.LIZIZ.LIZ(this).LIZIZ(C2961NYe.class);
            if (LIZIZ2 != null) {
                LIZIZ2.dismissUploadPopEntranceEvent();
            }
            C2961NYe LIZIZ3 = ApiCenter.LIZIZ.LIZ(this).LIZIZ(C2961NYe.class);
            if (LIZIZ3 != null) {
                LIZIZ3.dismissLivePopupEvent();
            }
        }
        return TTEPEffectPreviewActivity.super.dispatchTouchEvent(motionEvent);
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public void onEvent(6Hn r3) {
        C2757NQi nQi;
        if (!(!MJK.LIZ() || (nQi = this.LJIJ) == null || nQi.LIZ() == null || this.LJIJ.LIZ().LIZ(C2700NOd.class) == null || this.LJIJ.LIZ().LIZ(C2711NOo.class) == null)) {
            ((C2700NOd) this.LJIJ.LIZ().LIZ(C2700NOd.class)).updateBottomTab();
            ((C2711NOo) this.LJIJ.LIZ().LIZ(C2711NOo.class)).LIZLLL();
        }
        if (r3.LIZ != null) {
            this.LJI.LJJLIIJ.LIZJ = r3.LIZ;
        }
    }

    public final void LIZ(boolean z) {
        C2757NQi nQi = this.LJIJ;
        if (nQi != null) {
            nQi.LIZ(z);
        }
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [android.content.Context, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    private void LIZ(Bundle bundle) {
        List<String> list;
        boolean z;
        boolean z2;
        if (bundle != null) {
            ShortVideoContext parcelable = bundle.getParcelable("save_state_short_video_context");
            this.LJI = parcelable;
            if (!(parcelable == null || parcelable.LJJLIIIJJIZ == null)) {
                6nl.LIZ().LJ();
            }
            StringBuilder sb = new StringBuilder("initData with outState,shortVideoContext is NULL:");
            if (this.LJI == null) {
                z2 = true;
            } else {
                z2 = false;
            }
            sb.append(z2);
            6Zq.LIZ(sb.toString());
        }
        if (this.LJI == null) {
            FWb.LIZIZ.LIZ().LJIL();
            this.LJI = 6xi.LIZ(getIntent(), this);
            StringBuilder sb2 = new StringBuilder("initData with intent,shortVideoContext is NULL:");
            if (this.LJI == null) {
                z = true;
            } else {
                z = false;
            }
            sb2.append(z);
            6Zq.LIZ(sb2.toString());
        }
        if (getIntent().getBooleanExtra("reuse_mvtheme_enter", false)) {
            this.LJI.LJIILLIIL = getIntent().getParcelableExtra("extra_mv_effect");
        }
        int intExtra = getIntent().getIntExtra("extra_ttep_enter_preview_page", 0);
        if (intExtra == 1) {
            this.LJI.LJJIFFI = "effect_qr_scan";
        } else if (intExtra == 2) {
            this.LJI.LJJIFFI = "effect_internal_moderation";
        } else {
            throw new UnsupportedOperationException("This mode is not supported:".concat(String.valueOf(intExtra)));
        }
        this.LJIILL = LIZ(getIntent(), "extra_sticker_from");
        this.LJIILLIIL = LIZ(getIntent(), "grade_key");
        LJIL();
        6nl.LIZ().LJ = this.LJI.LJIJI;
        6xb.LIZ(this.LJI.LJIJ);
        ShortVideoContextViewModel LJIJI2 = LJIJI();
        LJIJI2.LIZ = this.LJI;
        LJIJI2.LIZ(this.LJI.LJJLIIIJILLIZJL);
        this.LJIILJJIL = getIntent().getBooleanExtra("sticker_pannel_show", false);
        this.LJIIL = getIntent().getStringArrayListExtra("reuse_sticker_ids");
        this.LJIILIIL = getIntent().getParcelableExtra("first_sticker");
        this.LJJII = LIZ(getIntent(), "update_effect_id");
        this.LJJIII = getIntent().getParcelableArrayListExtra("update_effect_extra");
        if (2OR.LIZ.LIZIZ.getStickerUpdateApp().booleanValue() && "direct_shoot".equals(this.LJI.LJIJI) && this.LJIILIIL == null && ((list = this.LJIIL) == null || list.size() == 0)) {
            String LIZ = C4220NtX.LJIIZILJ.LIZ(this);
            if (!TextUtils.isEmpty(LIZ)) {
                ArrayList arrayList = new ArrayList();
                this.LJIIL = arrayList;
                arrayList.add(LIZ);
            }
        }
        if (!TextUtils.isEmpty(LIZ(getIntent(), "star_atlas_object"))) {
            this.LJI.LIZIZ.getCommerceToolsModel().getTcmModel().setOuterTcmOrder(LIZ(getIntent(), "star_atlas_object"));
            CommerceToolsTcmServiceImpl.LJFF().LIZ(this.LJI.LIZIZ.getCommerceToolsModel().getTcmModel());
        }
        String LIZ2 = LIZ(getIntent(), "music_origin");
        ShortVideoContext shortVideoContext = this.LJI;
        if (LIZ2 == null) {
            LIZ2 = "original";
        }
        shortVideoContext.LJIIJJI = LIZ2;
        6r4.LIZJ();
    }

    /* JADX WARNING: type inference failed for: r8v0, types: [android.content.Context, X.1hK, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity, android.app.Activity] */
    public void onNewIntent(Intent intent) {
        C3091NbK LIZ;
        NED LIZIZ;
        MethodCollector.i(6242);
        TTEPEffectPreviewActivity.super.onNewIntent(intent);
        6Zq.LIZ("TTEPEffectPreviewActivity onNewIntent");
        78o.LJ.LIZ(this, intent, (Bundle) null);
        if (this.LJI == null || !FgP.LIZ(this)) {
            6Zq.LIZ("close record page because of null shortVideoContext instance when invoking onNewIntent method");
            finish();
            MethodCollector.o(6242);
            return;
        }
        int intExtra = intent.getIntExtra("retake_shoot_mode", -1);
        boolean z = false;
        if (intExtra == 1) {
            6xi.LIZ(intent, this.LJI);
            LJIJJLI();
            NPK LIZIZ2 = ApiCenter.LIZIZ.LIZ(this).LIZIZ(NPK.class);
            if (LIZIZ2 != null) {
                LIZIZ2.LIZ(this.LJI.LJIIZILJ());
                LIZIZ2.LIZ(0);
            }
            if (this.LJIJ != null) {
                this.LJJIIJZLJL.LJIL();
            }
            this.LJJIIZ.LIZ(true);
        } else if (intExtra == 2) {
            6xi.LIZIZ(intent, this.LJI);
            LJIJJLI();
            if (this.LJIJ != null) {
                if (!this.LJI.LIZJ() || this.LJI.LJJIJIIJI.LIZIZ == null) {
                    LIZ = C3091NbK.LIZ((List<TimeSpeedModelExtension>) this.LJI.LIZJ.LIZLLL(), this.LJI.LIZJ.LJIIIIZZ(), false);
                } else {
                    LIZ = C3091NbK.LIZ((List<TimeSpeedModelExtension>) this.LJI.LIZJ.LIZLLL(), this.LJI.LIZJ.LJIIIIZZ(), this.LJI.LJJIJIIJI.LIZIZ);
                }
                this.LJJIIJZLJL.LIZ(LIZ);
                NED LIZIZ3 = ((ApiCenter) this.LJ.getValue()).LIZIZ(NED.class);
                if (LIZIZ3 != null) {
                    LIZIZ3.changeMusicUi();
                }
            }
            this.LJJIIZ.LIZ(false);
        }
        if (this.LJI.LIZJ.LJFF() == null && (LIZIZ = ApiCenter.LIZIZ.LIZ(this).LIZIZ(NED.class)) != null) {
            LIZIZ.handleCancelMusicResultEvent();
        }
        LJJ();
        boolean booleanExtra = intent.getBooleanExtra("recreate_record_and_clear", false);
        this.LJIILJJIL = intent.getBooleanExtra("sticker_pannel_show", false);
        boolean booleanExtra2 = intent.getBooleanExtra("enter_record_from_other_platform", false);
        if (booleanExtra) {
            6Zq.LIZ("TTEPEffectPreviewActivity isClear");
            setIntent(intent);
            if (getIntent().getIntExtra("translation_type", 0) == 3) {
                Fnq.LIZ(this, 3);
            }
            C1906MxJ mxJ = this.LJJIIJ;
            if (mxJ != null) {
                mxJ.LIZ(C4742O4r.NORMAL);
            }
            this.LJJIIJZLJL.LIZLLL(true);
            TEMonitorInvoker.nativeReset();
            if (LJIILLIIL() != null) {
                LJIILLIIL().LJIILJJIL();
            }
            C4220NtX.LJJII.LJIJI().LIZJ().LIZ();
            LIZ((Bundle) null);
            LJIILL();
        } else if (this.LJI == null) {
            LIZ((Bundle) null);
        }
        ShortVideoContext shortVideoContext = this.LJI;
        if (booleanExtra2 || shortVideoContext.LJJLJ != null) {
            z = true;
        }
        shortVideoContext.LJJLJLI = z;
        if (this.LJIILJJIL && LJIJ() != null) {
            LJIJ().LIZ(true);
        }
        MethodCollector.o(6242);
    }

    /* JADX WARNING: type inference failed for: r0v1, types: [android.content.Context, X.0CH, X.6Jy, X.1hK, X.Ltg, X.1oX, java.lang.Object, X.19u, android.app.Activity, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* JADX WARNING: Unknown variable types count: 1 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void onCreate(android.os.Bundle r27) {
        /*
            r26 = this;
            r0 = r26
            r0 = r0
            r14 = 4137(0x1029, float:5.797E-42)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r14)
            r13 = r27
            X.8gF.LIZ(r0, r13)
            java.lang.String r12 = "com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity"
            java.lang.String r11 = "onCreate"
            r10 = 1
            com.bytedance.apm.agent.v2.instrumentation.ActivityAgent.onTrace(r12, r11, r10)
            X.6nl r1 = X.6nl.LIZ()
            r1.LIZLLL()
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r1 = "record"
            r2.enter(r0, r1)
            X.78o r2 = X.78o.LJ
            android.content.Intent r1 = r0.getIntent()
            r2.LIZ(r0, r1, r13)
            r0.LIZ((android.os.Bundle) r13)
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r9 = "av_video_record_init"
            java.lang.String r1 = "init recorderModule start"
            r2.step((java.lang.String) r9, (java.lang.String) r1)
            X.78B r1 = X.78B.LJFF
            r1.LIZ(r0)
            X.6nl r1 = X.6nl.LIZ()
            X.OZG r3 = r1.LIZ
            if (r3 == 0) goto L_0x0053
            int r1 = r3.getDuration()
            if (r1 <= 0) goto L_0x0053
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r2 = r0.LJI
            int r1 = r3.getDuration()
            r2.LJIIJ = r1
        L_0x0053:
            X.C4220NtX.LIZLLL()
            X.M12.LIZ(r0)
            X.NDt r1 = new X.NDt
            r1.<init>(r0)
            X.0PH.LIZ(r0, r1)
            X.0PC r1 = new X.0PC
            com.bytedance.als.AlsLogicContainer r2 = X.0PD.LIZIZ(r0)
            r1.<init>(r2)
            X.0P9 r20 = X.0P9.IMMEDIATE
            X.0PE r2 = new X.0PE
            r2.<init>()
            com.bytedance.als.AlsLogicContainer r15 = r1.LIZ
            java.lang.Class<X.MxJ> r6 = X.C1906MxJ.class
            java.lang.Class<X.NeP> r4 = X.C3282NeP.class
            X.NBZ r5 = r15.LJI
            X.Nd8 r3 = new X.Nd8
            r3.<init>(r2, r0)
            r2 = 0
            r5.LIZ(r4, (java.lang.String) r2, r3)
            r15.LIZ(r6, r4)
            r17 = 0
            r18 = 0
            r19 = 0
            r16 = r4
            r15.LIZ(r16, r17, r18, r19, r20)
            X.0P9 r25 = X.0P9.IMMEDIATE
            X.0PE r8 = new X.0PE
            r8.<init>()
            com.bytedance.als.AlsLogicContainer r5 = r1.LIZ
            java.lang.Class<X.NQ0> r7 = X.NQ0.class
            java.lang.Class<X.NRW> r4 = X.NRW.class
            X.NBZ r6 = r5.LJI
            X.NRa r3 = new X.NRa
            r3.<init>(r8, r0)
            r6.LIZ(r4, (java.lang.String) r2, r3)
            r5.LIZ(r7, r4)
            r22 = 0
            r23 = 0
            r24 = 0
            r20 = r5
            r21 = r4
            r20.LIZ(r21, r22, r23, r24, r25)
            X.0P9 r20 = X.0P9.IMMEDIATE
            X.0PE r7 = new X.0PE
            r7.<init>()
            com.bytedance.als.AlsLogicContainer r15 = r1.LIZ
            java.lang.Class<X.Mjs> r6 = X.C1073Mjs.class
            java.lang.Class<X.Mjo> r5 = X.C1069Mjo.class
            X.NBZ r4 = r15.LJI
            X.MkC r3 = new X.MkC
            r3.<init>(r7)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r15.LIZ(r6, r5)
            r16 = r5
            r15.LIZ(r16, r17, r18, r19, r20)
            X.0P9 r25 = X.0P9.IMMEDIATE
            X.0PE r8 = new X.0PE
            r8.<init>()
            com.bytedance.als.AlsLogicContainer r7 = r1.LIZ
            java.lang.Class<X.N38> r6 = X.N38.class
            java.lang.Class<X.MnS> r5 = X.C1295MnS.class
            X.NBZ r4 = r7.LJI
            X.MnY r3 = new X.MnY
            r3.<init>(r8)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r7.LIZ(r6, r5)
            r20 = r7
            r21 = r5
            r20.LIZ(r21, r22, r23, r24, r25)
            X.0P9 r20 = X.0P9.IMMEDIATE
            X.0PE r7 = new X.0PE
            r7.<init>()
            com.bytedance.als.AlsLogicContainer r15 = r1.LIZ
            java.lang.Class<X.NOw> r6 = X.C2719NOw.class
            java.lang.Class<X.NjA> r5 = X.C3577NjA.class
            X.NBZ r4 = r15.LJI
            X.Mu1 r3 = new X.Mu1
            r3.<init>(r7)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r15.LIZ(r6, r5)
            r16 = r5
            r15.LIZ(r16, r17, r18, r19, r20)
            X.0P9 r25 = X.0P9.IMMEDIATE
            X.0PE r8 = new X.0PE
            r8.<init>()
            com.bytedance.als.AlsLogicContainer r7 = r1.LIZ
            java.lang.Class<X.NI0> r6 = X.NI0.class
            java.lang.Class<X.NFd> r5 = X.C2466NFd.class
            X.NBZ r4 = r7.LJI
            X.N3b r3 = new X.N3b
            r3.<init>(r8)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r7.LIZ(r6, r5)
            r20 = r7
            r21 = r5
            r20.LIZ(r21, r22, r23, r24, r25)
            X.0P9 r20 = X.0P9.IMMEDIATE
            X.0PE r7 = new X.0PE
            r7.<init>()
            com.bytedance.als.AlsLogicContainer r15 = r1.LIZ
            java.lang.Class<X.N00> r6 = X.N00.class
            java.lang.Class<X.Mzx> r5 = X.C2070Mzx.class
            X.NBZ r4 = r15.LJI
            X.N1p r3 = new X.N1p
            r3.<init>(r7)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r15.LIZ(r6, r5)
            r16 = r5
            r15.LIZ(r16, r17, r18, r19, r20)
            X.0P9 r25 = X.0P9.IMMEDIATE
            X.0PE r8 = new X.0PE
            r8.<init>()
            com.bytedance.als.AlsLogicContainer r7 = r1.LIZ
            java.lang.Class<X.NGj> r6 = X.C2498NGj.class
            java.lang.Class<X.Mzj> r5 = X.C2056Mzj.class
            X.NBZ r4 = r7.LJI
            X.Mzu r3 = new X.Mzu
            r3.<init>(r8)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r7.LIZ(r6, r5)
            r20 = r7
            r21 = r5
            r20.LIZ(r21, r22, r23, r24, r25)
            X.0P9 r20 = X.0P9.IMMEDIATE
            X.0PE r7 = new X.0PE
            r7.<init>()
            com.bytedance.als.AlsLogicContainer r15 = r1.LIZ
            java.lang.Class<X.N2x> r6 = X.C2148N2x.class
            java.lang.Class<X.N2r> r5 = X.C2142N2r.class
            X.NBZ r4 = r15.LJI
            X.N35 r3 = new X.N35
            r3.<init>(r7)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r15.LIZ(r6, r5)
            r16 = r5
            r15.LIZ(r16, r17, r18, r19, r20)
            X.0P9 r25 = X.0P9.IMMEDIATE
            X.0PE r8 = new X.0PE
            r8.<init>()
            com.bytedance.als.AlsLogicContainer r7 = r1.LIZ
            java.lang.Class<X.NCN> r6 = X.NCN.class
            java.lang.Class<X.NFn> r5 = X.C2476NFn.class
            X.NBZ r4 = r7.LJI
            X.NCc r3 = new X.NCc
            r3.<init>(r8)
            r4.LIZ(r5, (java.lang.String) r2, r3)
            r7.LIZ(r6, r5)
            r20 = r7
            r21 = r5
            r20.LIZ(r21, r22, r23, r24, r25)
            r1.LIZ()
            com.bytedance.als.AlsLogicContainer r1 = X.0PD.LIZIZ(r0)
            X.NrO r1 = r1.LJII
            r0.LJFF = r1
            X.5E9 r1 = X.5E9.LIZ
            r1.LIZIZ()
            X.NrO r2 = r0.LJFF
            java.lang.Class<X.MxJ> r1 = X.C1906MxJ.class
            java.lang.Object r1 = r2.LIZ(r1)
            X.MxJ r1 = (X.C1906MxJ) r1
            r0.LJJIIJ = r1
            X.NrO r2 = r0.LJFF
            java.lang.Class<X.NQV> r1 = X.NQV.class
            java.lang.Object r1 = r2.LIZ(r1)
            X.NQV r1 = (X.NQV) r1
            r0.LJJIIJZLJL = r1
            X.NrO r2 = r0.LJFF
            java.lang.Class<X.NGj> r1 = X.C2498NGj.class
            java.lang.Object r1 = r2.LIZ(r1)
            X.NGj r1 = (X.C2498NGj) r1
            r0.LJJIIZ = r1
            X.MxJ r1 = r0.LJJIIJ
            X.NQv r1 = r1.LJJZ()
            r0.LJIIIIZZ = r1
            X.MxJ r1 = r0.LJJIIJ
            android.view.SurfaceView r1 = r1.LJJIJIIJIL()
            r0.LJIIJ = r1
            X.Muq r2 = new X.Muq
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            r2.<init>(r1)
            boolean r5 = r2.LIZ()
            com.ss.android.ugc.aweme.shortvideo.SafeHandler r4 = r0.LJII
            X.NdL r3 = new X.NdL
            r3.<init>(r0)
            if (r5 == 0) goto L_0x0349
            r1 = 2000(0x7d0, double:9.88E-321)
        L_0x0211:
            r4.postDelayed(r3, r1)
            if (r5 == 0) goto L_0x021d
            X.MxJ r2 = r0.LJJIIJ
            com.bytedance.bpea.basics.PrivacyCert r1 = X.N2V.LIZLLL
            r2.LIZ((com.bytedance.bpea.basics.Cert) r1, (boolean) r10)
        L_0x021d:
            X.MxJ r1 = r0.LJJIIJ
            X.0PM r2 = r1.LJIIIIZZ()
            X.NdF r1 = new X.NdF
            r1.<init>(r0)
            r2.LIZ(r0, r1)
            X.MxJ r2 = r0.LJJIIJ
            X.6s8 r1 = new X.6s8
            r1.<init>()
            r2.LIZ((X.N2Z) r1)
            X.MxJ r1 = r0.LJJIIJ
            X.0PL r2 = r1.LJIJ()
            X.759 r1 = new X.759
            r1.<init>(r0)
            r2.LIZ(r0, r1)
            X.MxJ r1 = r0.LJJIIJ
            X.NeR r3 = r1.LJJIJ()
            X.OJL r2 = new X.OJL
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            com.ss.android.ugc.aweme.creative.CreativeInfo r1 = r1.LJIJ
            java.lang.String r1 = r1.getCreationId()
            if (r1 != 0) goto L_0x033f
            java.lang.String r1 = ""
        L_0x0257:
            r2.<init>(r1)
            r3.setControllerCallback(r2)
            X.NrO r2 = r0.LJFF
            java.lang.Class<X.NOw> r1 = X.C2719NOw.class
            java.lang.Object r1 = r2.LIZ(r1)
            X.NOw r1 = (X.C2719NOw) r1
            r0.LJJIIZI = r1
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            boolean r1 = X.6zP.LIZ(r1)
            if (r1 == 0) goto L_0x0298
            X.NNA r15 = new X.NNA
            X.MxJ r1 = r0.LJJIIJ
            X.NeR r17 = r1.LJJIJ()
            X.NI0 r18 = r0.LJIILLIIL()
            X.NQv r3 = r0.LJIIIIZZ
            X.Fpn r2 = new X.Fpn
            X.MxJ r1 = r0.LJJIIJ
            r2.<init>(r0, r1)
            X.NrO r1 = r0.LJFF
            r16 = r0
            r19 = r3
            r20 = r2
            r21 = r1
            r15.<init>(r16, r17, r18, r19, r20, r21)
            r0.LJJJ = r15
            r15.LIZ()
        L_0x0298:
            X.MxJ r1 = r0.LJJIIJ
            X.0PL r2 = r1.LJJJIL()
            X.75J r1 = new X.75J
            r1.<init>(r0)
            r2.LIZ(r0, r1)
            X.NQV r1 = r0.LJJIIJZLJL
            X.0PL r2 = r1.LJIILL()
            X.Ndz r1 = new X.Ndz
            r1.<init>(r0)
            r2.LIZ(r0, r1)
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r1 = "init recorderModule end"
            r2.step((java.lang.String) r9, (java.lang.String) r1)
            java.lang.String r1 = "TTEPEffectPreviewActivity => onCreate start"
            X.6Zq.LIZ(r1)
            X.6nl r1 = X.6nl.LIZ()
            r3 = 0
            r1.LJIILIIL = r3
            X.6mc.LIZ = r3
            X.Ng0 r1 = X.56Y.LIZ
            r1.step((java.lang.String) r9, (java.lang.String) r11)
            X.NdG r1 = new X.NdG
            r1.<init>()
            X.C3678Nkn.LIZ((X.MWE) r1)
            X.Nks r1 = new X.Nks
            r1.<init>(r0)
            X.C3678Nkn.LIZ((X.MWE) r1)
            X.LFn r1 = new X.LFn
            r1.<init>()
            X.C3678Nkn.LIZ((X.MWE) r1)
            X.FWb r1 = X.FWb.LIZIZ
            r1.LIZ()
            X.6mL r1 = X.6mL.LIZ
            X.MV8.LIZ(r0, r1)
            com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity.super.onCreate(r13)
            android.content.Intent r2 = r0.getIntent()
            java.lang.String r1 = "translation_type"
            int r2 = r2.getIntExtra(r1, r3)
            r1 = 3
            if (r2 != r1) goto L_0x0303
            X.Fnq.LIZ(r0, r1)
        L_0x0303:
            android.view.Window r2 = r0.getWindow()
            r1 = 128(0x80, float:1.794E-43)
            r2.addFlags(r1)
            r1 = 2131558531(0x7f0d0083, float:1.874238E38)
            r0.setContentView(r1)
            android.content.res.Resources r1 = r0.getResources()
            android.content.res.Configuration r1 = r1.getConfiguration()
            if (r1 == 0) goto L_0x033d
            android.content.res.Resources r1 = r0.getResources()
            android.content.res.Configuration r1 = r1.getConfiguration()
            int r1 = r1.screenWidthDp
        L_0x0326:
            r0.LJJIZ = r1
            boolean r1 = X.FgP.LIZ(r0)
            if (r1 != 0) goto L_0x034d
            java.lang.String r1 = "RecordConditionCheck.check() false"
            X.6Zq.LIZ(r1)
            r0.finish()
            com.bytedance.apm.agent.v2.instrumentation.ActivityAgent.onTrace(r12, r11, r3)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r14)
            return
        L_0x033d:
            r1 = 0
            goto L_0x0326
        L_0x033f:
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            com.ss.android.ugc.aweme.creative.CreativeInfo r1 = r1.LJIJ
            java.lang.String r1 = r1.getCreationId()
            goto L_0x0257
        L_0x0349:
            r1 = 0
            goto L_0x0211
        L_0x034d:
            boolean r1 = X.Ijf.LIZ()
            if (r1 == 0) goto L_0x03e0
            r1 = 15
        L_0x0355:
            X.IDi.LIZ(r1)
            r1 = 2131369724(0x7f0a1efc, float:1.8359434E38)
            android.view.View r1 = r0.findViewById(r1)
            android.widget.FrameLayout r1 = (android.widget.FrameLayout) r1
            r0.LJJIJIL = r1
            r1 = 2131366972(0x7f0a143c, float:1.8353853E38)
            android.view.View r2 = r0.findViewById(r1)
            android.widget.FrameLayout r2 = (android.widget.FrameLayout) r2
            r0.LJIIIZ = r2
            X.MxJ r1 = r0.LJJIIJ
            X.NeR r1 = r1.LJJIJ()
            r2.addView(r1)
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r1 = "init stickerModule start"
            r2.step((java.lang.String) r9, (java.lang.String) r1)
            X.NrO r2 = r0.LJFF
            java.lang.Class<X.NFd> r1 = X.C2466NFd.class
            java.lang.Object r4 = r2.LIZ(r1)
            X.NFd r4 = (X.C2466NFd) r4
            com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity$5 r1 = new com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity$5
            r1.<init>()
            r4.LIZ((X.NHB) r1)
            X.NQV r1 = r0.LJJIIJZLJL
            X.0PL r2 = r1.LJIJ()
            X.Ndc r1 = new X.Ndc
            r1.<init>(r4)
            r2.LIZ(r0, r1)
            X.NAd r2 = r4.LJIJJLI()
            com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity$4 r1 = new com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity$4
            r1.<init>()
            r2.LIZ((X.N9L) r1)
            X.0AA r1 = r0.getSupportFragmentManager()
            java.util.List r2 = r1.LJFF()
            boolean r1 = X.5Fn.LIZIZ(r2)
            if (r1 == 0) goto L_0x03e6
            X.POK r1 = X.C3227NdW.LIZ
            java.util.List r2 = X.FcR.LIZ(r2, r1)
            boolean r1 = X.5Fn.LIZIZ(r2)
            if (r1 == 0) goto L_0x03e6
            X.0AA r1 = r0.getSupportFragmentManager()
            X.0AP r4 = r1.LIZ()
            java.util.Iterator r2 = r2.iterator()
        L_0x03d0:
            boolean r1 = r2.hasNext()
            if (r1 == 0) goto L_0x03e3
            java.lang.Object r1 = r2.next()
            androidx.fragment.app.Fragment r1 = (androidx.fragment.app.Fragment) r1
            r4.LIZ(r1)
            goto L_0x03d0
        L_0x03e0:
            r1 = 7
            goto L_0x0355
        L_0x03e3:
            r4.LIZJ()
        L_0x03e6:
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r1 = "init stickerModule end"
            r2.step((java.lang.String) r9, (java.lang.String) r1)
            android.content.Intent r2 = r0.getIntent()
            java.lang.String r1 = "tabs"
            int r2 = r2.getIntExtra(r1, r3)
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            r1.LJLIIIL = r2
            X.6ku r1 = new X.6ku
            r1.<init>()
            X.C3678Nkn.LIZ((X.MWE) r1)
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            X.6pk.LIZ(r1)
            X.FRf r2 = X.C4220NtX.LIZJ
            java.lang.String r1 = "SHOOT"
            r2.LIZ(r1)
            X.0CD r2 = r0.getLifecycle()
            X.2fs r1 = com.ss.android.ugc.aweme.shortvideo.ui.AudioFocusManager.LIZIZ
            com.ss.android.ugc.aweme.shortvideo.ui.AudioFocusManager r1 = r1.LIZ(r0)
            r2.LIZ(r1)
            r1 = 2131366846(0x7f0a13be, float:1.8353597E38)
            android.view.View r4 = r0.findViewById(r1)
            android.widget.FrameLayout r4 = (android.widget.FrameLayout) r4
            r0.LJIJJLI = r4
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            com.ss.android.ugc.effectmanager.effect.model.Effect r1 = r1.LJIILLIIL
            if (r1 == 0) goto L_0x04eb
            r2 = 1
        L_0x042e:
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            boolean r1 = r1.LJJLL
            if (r1 != 0) goto L_0x04e8
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r1 = r0.LJI
            boolean r1 = r1.LJJZ
            if (r1 != 0) goto L_0x04e8
            if (r2 != 0) goto L_0x04e8
            boolean r1 = X.ME7.LIZ()
            if (r1 != 0) goto L_0x04e8
            r1 = 1
        L_0x0443:
            X.C3204Nd9.LIZ(r0, r4, r1, r10)
            com.ss.android.ugc.aweme.shortvideo.SafeHandler r2 = r0.LJII
            X.NCZ r1 = new X.NCZ
            r1.<init>(r0)
            r2.post(r1)
            X.5rv.LJIIJJI = r10
            java.lang.String r1 = "TTEPEffectPreviewActivity => onCreate end"
            X.6Zq.LIZ(r1)
            X.C4209NtM.LIZ()
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r4 = r0.LJI
            android.content.Intent r2 = r0.getIntent()
            java.lang.String r1 = "share_id"
            java.lang.String r1 = LIZ(r2, r1)
            r4.LJIIIZ = r1
            com.ss.android.ugc.aweme.shortvideo.ShortVideoContext r4 = r0.LJI
            android.content.Intent r2 = r0.getIntent()
            java.lang.String r1 = "channel"
            java.lang.String r1 = LIZ(r2, r1)
            r4.LJJIIJZLJL = r1
            X.Nkq r1 = new X.Nkq
            r1.<init>()
            X.C3678Nkn.LIZ((X.MWE) r1)
            X.MW5 r1 = new X.MW5
            r1.<init>()
            X.C3678Nkn.LIZ((X.MWE) r1)
            X.7M4 r1 = new X.7M4
            r1.<init>(r0)
            X.C3678Nkn.LIZ((X.MWE) r1)
            com.ss.android.ugc.aweme.shortvideo.ui.task.PreloadMediaDataTask r5 = new com.ss.android.ugc.aweme.shortvideo.ui.task.PreloadMediaDataTask
            X.0CD r4 = r0.getLifecycle()
            long r1 = java.lang.System.currentTimeMillis()
            r5.<init>(r4, r0, r1)
            X.C3678Nkn.LIZ((X.MWE) r5)
            com.ss.android.ugc.aweme.shortvideo.ui.task.PreloadMusicListTask r2 = new com.ss.android.ugc.aweme.shortvideo.ui.task.PreloadMusicListTask
            X.0CD r1 = r0.getLifecycle()
            r2.<init>(r1)
            X.C3678Nkn.LIZ((X.MWE) r2)
            X.NgH r1 = new X.NgH
            r1.<init>(r0)
            X.C3678Nkn.LIZ((X.MWE) r1)
            com.ss.android.ugc.aweme.shortvideo.ui.task.CacheChooseMediaViewHolderTask r2 = new com.ss.android.ugc.aweme.shortvideo.ui.task.CacheChooseMediaViewHolderTask
            X.0CD r1 = r0.getLifecycle()
            r2.<init>(r0, r1)
            X.C3678Nkn.LIZ((X.MWE) r2)
            X.Ng0 r2 = X.56Y.LIZ
            java.lang.String r1 = "onCreate end"
            r2.step((java.lang.String) r9, (java.lang.String) r1)
            X.MxJ r1 = r0.LJJIIJ
            r1.LJJIL()
            boolean r1 = X.ME7.LIZ()
            if (r1 == 0) goto L_0x04e1
            android.content.Intent r2 = r0.getIntent()
            java.lang.String r1 = "auto_start_recording"
            boolean r1 = r2.getBooleanExtra(r1, r3)
            if (r1 != 0) goto L_0x04e1
            r0.LJIILL()
            r0.LJIL = r3
        L_0x04e1:
            com.bytedance.apm.agent.v2.instrumentation.ActivityAgent.onTrace(r12, r11, r3)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r14)
            return
        L_0x04e8:
            r1 = 0
            goto L_0x0443
        L_0x04eb:
            r2 = 0
            goto L_0x042e
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity.onCreate(android.os.Bundle):void");
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        C3224NdT ndT;
        for (6CS onKeyDown : this.LJJIJIIJIL) {
            if (onKeyDown.onKeyDown(i, keyEvent)) {
                return true;
            }
        }
        if (i != 4) {
            return TTEPEffectPreviewActivity.super.onKeyDown(i, keyEvent);
        }
        if (this.LJIJ != null) {
            NQV nqv = this.LJJIIJZLJL;
            if (nqv != null && !((Boolean) nqv.LIZJ().LIZ()).booleanValue()) {
                return true;
            }
            C3243Ndm ndm = this.LJJIJL;
            if ((ndm == null || !ndm.LIZ()) && (ndT = (C3224NdT) this.LJIJ.LIZ().LIZIZ(C3224NdT.class)) != null) {
                ndT.LIZ("system_back_button", System.currentTimeMillis());
            }
            return true;
        } else if (getIntent().hasExtra("stitch_params")) {
            return true;
        } else {
            return TTEPEffectPreviewActivity.super.onKeyDown(i, keyEvent);
        }
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [android.content.Context, X.1hK, java.lang.Object, com.ss.android.ugc.aweme.ttep.TTEPEffectPreviewActivity] */
    public void onActivityResult(int i, int i2, Intent intent) {
        C3224NdT ndT;
        boolean z;
        for (6CT LIZ : this.LJJIJIIJI) {
            if (LIZ.LIZ(i, i2, intent)) {
                return;
            }
        }
        TTEPEffectPreviewActivity.super.onActivityResult(i, i2, intent);
        if (i == 1002) {
            if (i2 == -1) {
                ShortVideoContext shortVideoContext = this.LJI;
                if (shortVideoContext == null || shortVideoContext.LJJLJ == null) {
                    z = false;
                } else {
                    z = true;
                }
                if (!(intent == null || LIZIZ(intent) == null || z)) {
                    Intent intent2 = new Intent();
                    intent2.setClass(this, C4220NtX.LIZJ.LJ());
                    intent2.addFlags(67108864);
                    intent2.putExtras(LIZIZ(intent));
                    3i8.LIZ(intent2, this);
                    startActivity(intent2);
                }
                finish();
            }
        } else if (i == 1003 && i2 == -1 && (ndT = (C3224NdT) this.LJIJ.LIZ().LIZIZ(C3224NdT.class)) != null) {
            ndT.LIZJ();
        }
    }

    public final void LIZ(boolean z, MusicModel musicModel, String str) {
        an anVar = this.LJIJI;
        if (anVar != null) {
            anVar.LIZ(z, musicModel, str);
        }
    }
}
