package com.ss.android.ugc.aweme.infoSticker.customsticker.activity;

import X.8gF;
import X.AnonymousClass5GX;
import X.AnonymousClass6GL;
import X.AnonymousClass6K0;
import X.C31456Jz;
import X.C50266xc;
import X.DVG;
import X.ODZ;
import X.OIK;
import X.Ofd;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.creative.CreativeInfo;
import com.ss.android.ugc.aweme.infoSticker.customsticker.EditPreviewStickerViewModel;
import com.ss.android.ugc.aweme.mediachoose.helper.MediaModel;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import java.util.HashMap;
import kotlin.h.b.n;

public final class CustomStickerPreviewActivity extends AnonymousClass6GL {
    public static final AnonymousClass6K0 LJFF = new AnonymousClass6K0((byte) 0);
    public AnonymousClass5GX LJ;
    public EditPreviewStickerViewModel LJI;
    public String LJII;
    public String LJIIIIZZ;
    public String LJIIIZ;
    public CreativeInfo LJIIJ;
    public HashMap LJIIJJI;

    static {
        Covode.recordClassIndex(88492);
    }

    public final void LIZIZ(boolean z) {
    }

    public final void LJIIIIZZ() {
    }

    public final View g_(int i) {
        if (this.LJIIJJI == null) {
            this.LJIIJJI = new HashMap();
        }
        View view = (View) this.LJIIJJI.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LJIIJJI.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity, X.6GL, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        super.onDestroy();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity, X.6GL, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity", "onResume", true);
        super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity, X.6GL, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity", "onWindowFocusChanged", true);
        CustomStickerPreviewActivity.super.onWindowFocusChanged(z);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity, X.Ltg, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        overridePendingTransition(0, 0);
        CustomStickerPreviewActivity.super.onPause();
    }

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

    public final void onBackPressed() {
        AnonymousClass5GX r0 = this.LJ;
        if (r0 == null) {
            n.LIZ("");
        }
        if (r0.LIZ().LIZIZ()) {
            CustomStickerPreviewActivity.super.onBackPressed();
            return;
        }
        AnonymousClass5GX r02 = this.LJ;
        if (r02 == null) {
            n.LIZ("");
        }
        if (!r02.LIZ().LJJIJIL) {
            AnonymousClass5GX r03 = this.LJ;
            if (r03 == null) {
                n.LIZ("");
            }
            if (r03.LIZ().LIZ()) {
                EditPreviewStickerViewModel editPreviewStickerViewModel = this.LJI;
                if (editPreviewStickerViewModel == null) {
                    n.LIZ("");
                }
                editPreviewStickerViewModel.LIZIZ();
                return;
            }
            CustomStickerPreviewActivity.super.onBackPressed();
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(boolean r5) {
        /*
            r4 = this;
            int r2 = X.3G3.LIZ()
            r1 = r4
            r0 = 1090519040(0x41000000, float:8.0)
            float r0 = X.C37926di.LIZIZ(r1, r0)
            int r0 = (int) r0
            int r2 = r2 - r0
            r0 = 0
            int r3 = java.lang.Math.max(r2, r0)
            r0 = 1103364096(0x41c40000, float:24.5)
            float r0 = X.C37926di.LIZIZ(r1, r0)
            int r0 = (int) r0
            int r3 = r3 + r0
            r0 = 2131362569(0x7f0a0309, float:1.8344922E38)
            android.view.View r2 = r4.findViewById(r0)
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r2, r0)
            android.view.ViewGroup$LayoutParams r1 = r2.getLayoutParams()
            java.lang.String r0 = "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams"
            java.util.Objects.requireNonNull(r1, r0)
            android.widget.RelativeLayout$LayoutParams r1 = (android.widget.RelativeLayout.LayoutParams) r1
            r1.topMargin = r3
            r2.setLayoutParams(r1)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity.LIZ(boolean):void");
    }

    /* JADX WARNING: type inference failed for: r14v0, types: [com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity, X.Ltg, X.6GL, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity", "onCreate", true);
        super.onCreate(bundle);
        setContentView(2131558477);
        Intent intent = getIntent();
        n.LIZIZ(intent, "");
        this.LJIIJ = C50266xc.LIZIZ(intent);
        this.LJII = LIZ(getIntent(), "shoot_way");
        this.LJIIIIZZ = LIZ(getIntent(), "content_source");
        this.LJIIIZ = LIZ(getIntent(), "content_type");
        MediaModel mediaModel = (MediaModel) getIntent().getParcelableExtra("preview_sticker_params");
        if (mediaModel != null) {
            n.LIZIZ(mediaModel, "");
            Effect parcelableExtra = getIntent().getParcelableExtra("custom_sticker");
            String str = this.LJII;
            String str2 = this.LJIIIIZZ;
            String str3 = this.LJIIIZ;
            CreativeInfo creativeInfo = this.LJIIJ;
            if (creativeInfo == null) {
                n.LIZ("");
            }
            this.LJ = new AnonymousClass5GX(mediaModel, parcelableExtra, str, str2, str3, creativeInfo);
            ODZ LIZ = Ofd.LIZ(this, AnonymousClass5GX.class);
            LIZ.LJ = false;
            LIZ.LJFF = new C31456Jz(this);
            LIZ.LIZIZ = false;
            LIZ.LIZJ = false;
            LIZ.LIZLLL = 2131369672;
            LIZ.LIZ();
        }
        EditPreviewStickerViewModel LIZ2 = DVG.LIZ(this).LIZ(EditPreviewStickerViewModel.class);
        n.LIZIZ(LIZ2, "");
        EditPreviewStickerViewModel editPreviewStickerViewModel = LIZ2;
        this.LJI = editPreviewStickerViewModel;
        if (editPreviewStickerViewModel == null) {
            n.LIZ("");
        }
        editPreviewStickerViewModel.LIZJ(new OIK((MediaModel) getIntent().getParcelableExtra("preview_sticker_params")));
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.infoSticker.customsticker.activity.CustomStickerPreviewActivity", "onCreate", false);
    }

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