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

import X.2GO;
import X.2HZ;
import X.8gF;
import X.C30456Gd;
import X.C30886Hu;
import X.C43536ml;
import X.C44676ob;
import X.C48086u6;
import X.C48296uR;
import X.C539678o;
import X.CbG;
import X.CqM;
import X.Fnq;
import X.ISm;
import X.KDE;
import X.Ltg;
import X.M12;
import X.Rc9;
import X.Szo;
import android.content.Context;
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.shortvideo.edit.VideoPublishEditModel;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public final class ShoutOutsPublishActivity extends Ltg implements 2HZ, 2GO {
    public C48086u6 LIZLLL;
    public VideoPublishEditModel LJ;
    public HashMap LJFF;

    static {
        Covode.recordClassIndex(114108);
    }

    public final boolean dL_() {
        return true;
    }

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

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(498, new Rc9(ShoutOutsPublishActivity.class, "onEvent", C48296uR.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.Ltg, android.app.Activity, com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity] */
    public final void onPause() {
        8gF.LIZJ(this);
        ShoutOutsPublishActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.1oX, android.app.Activity, com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity] */
    public final void onStart() {
        8gF.LIZ(this);
        ShoutOutsPublishActivity.super.onStart();
    }

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

    public final void onBackPressed() {
        ShoutOutsPublishActivity.super.onBackPressed();
        LJII();
    }

    private final void LJIIIIZZ() {
        EventBus LIZ = EventBus.LIZ();
        if (!LIZ.LIZ(this)) {
            EventBus.LIZ(LIZ, this);
        }
    }

    public final void LJI() {
        EventBus LIZ = EventBus.LIZ();
        if (LIZ.LIZ(this)) {
            LIZ.LIZIZ(this);
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void finish() {
        /*
            r2 = this;
            com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity.super.finish()
            r1 = r2
            int r0 = X.Fnq.LIZ()
            X.Fnq.LIZIZ(r1, r0)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity.finish():void");
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [X.Ltg, android.app.Activity, com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity] */
    public final void onDestroy() {
        8gF.LJ(this);
        ShoutOutsPublishActivity.super.onDestroy();
        C539678o.LJ.LIZ((Context) this);
        LJI();
    }

    public final void LIZLLL() {
        Szo LIZ = Szo.LIZIZ.LIZ(this);
        LIZ.LIZ(2131099659);
        LIZ.LIZLLL(2131099659);
        LIZ.LIZ(true);
        LIZ.LIZ.LIZJ();
    }

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

    public final void LJII() {
        if (this.LJ != null) {
            C48086u6 r0 = this.LIZLLL;
            if (r0 != null) {
                r0.LJJIL();
            }
            VideoPublishEditModel videoPublishEditModel = this.LJ;
            if (videoPublishEditModel == null) {
                n.LIZIZ();
            }
            String desc = videoPublishEditModel.mShoutOutsData.getDesc();
            VideoPublishEditModel videoPublishEditModel2 = this.LJ;
            if (videoPublishEditModel2 == null) {
                n.LIZIZ();
            }
            C44676ob price = videoPublishEditModel2.mShoutOutsData.getPrice();
            VideoPublishEditModel videoPublishEditModel3 = this.LJ;
            if (videoPublishEditModel3 == null) {
                n.LIZIZ();
            }
            CqM.LIZ(new C30886Hu(desc, price, videoPublishEditModel3.mShoutOutsData.getBuyerMoneyDes()));
        }
    }

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

    /* JADX WARNING: type inference failed for: r6v0, types: [X.Ltg, android.app.Activity, com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity] */
    public final void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity", "onCreate", true);
        ShoutOutsPublishActivity.super.onCreate(bundle);
        Fnq.LIZ(this, Fnq.LIZ());
        setContentView(2131558517);
        C539678o.LJ.LIZ((Context) this, getIntent(), bundle);
        Intent intent = getIntent();
        if (intent.getBooleanExtra("shout_out_from_dl", false)) {
            Serializable serializableExtra = intent.getSerializableExtra("shout_out_data");
            if (serializableExtra != null) {
                LIZ((VideoPublishEditModel) null, (C43536ml) serializableExtra);
            } else {
                NullPointerException nullPointerException = new NullPointerException("null cannot be cast to non-null type com.ss.android.ugc.aweme.shoutouts.ShoutOutsData");
                ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity", "onCreate", false);
                throw nullPointerException;
            }
        } else {
            n.LIZIZ(intent, "");
            VideoPublishEditModel LIZ = C30456Gd.LIZ(intent);
            this.LJ = LIZ;
            if (LIZ == null) {
                n.LIZIZ();
            }
            LIZ(LIZ, (C43536ml) null);
        }
        LJIIIIZZ();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity", "onCreate", false);
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onEvent(C48296uR r6) {
        M12.LIZ(r6);
        C48086u6 r4 = this.LIZLLL;
        if (r4 != null) {
            C44676ob r3 = r6.LIZ;
            KDE kde = r6.LIZIZ;
            M12.LIZ(r3);
            if (r4.LJJI != null && r3.getMoneyDes() != null) {
                C43536ml r0 = r4.LJJ;
                if (r0 == null) {
                    n.LIZ("");
                }
                r0.setPrice(r3);
                C43536ml r02 = r4.LJJ;
                if (r02 == null) {
                    n.LIZ("");
                }
                r02.setBuyerMoneyDes(kde);
                r4.LJJIJLIJ();
                CbG cbG = r4.LJIJJ;
                if (cbG == null) {
                    n.LIZ("");
                }
                cbG.setEnabled(true);
                if (r4.LJJIIJZLJL != null) {
                    VideoPublishEditModel videoPublishEditModel = r4.LJJIIJZLJL;
                    C43536ml r03 = r4.LJJ;
                    if (r03 == null) {
                        n.LIZ("");
                    }
                    videoPublishEditModel.mShoutOutsData = r03;
                }
                if (!r4.LJJII) {
                    View view = r4.LJIIL;
                    if (view == null) {
                        n.LIZ("");
                    }
                    view.setVisibility(0);
                }
            }
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final void LIZ(com.ss.android.ugc.aweme.shortvideo.edit.VideoPublishEditModel r4, X.C43536ml r5) {
        /*
            r3 = this;
            X.6u6 r0 = new X.6u6
            r0.<init>(r4, r5)
            r3.LIZLLL = r0
            r1 = r3
            java.lang.Class<X.6u6> r0 = X.C48086u6.class
            X.ODZ r2 = X.Ofd.LIZ(r1, r0)
            r1 = 0
            r2.LJ = r1
            X.6uI r0 = new X.6uI
            r0.<init>(r3)
            r2.LJFF = r0
            r2.LIZIZ = r1
            r2.LIZJ = r1
            r0 = 2131365161(0x7f0a0d29, float:1.835018E38)
            r2.LIZLLL = r0
            r2.LIZ()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.shoutouts.ShoutOutsPublishActivity.LIZ(com.ss.android.ugc.aweme.shortvideo.edit.VideoPublishEditModel, X.6ml):void");
    }
}
