package com.ss.android.ugc.aweme.account.agegate.activity;

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.1hU;
import X.2GD;
import X.7he;
import X.8gF;
import X.C2162Rtm;
import X.C2419Rxv;
import X.C2420Rxw;
import X.C2463Ryd;
import X.C2574S1a;
import X.Crj;
import android.app.Activity;
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.router.arg.RouteArgExtension;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.account.login.v2.base.ActionResultModel;
import java.io.Serializable;
import java.util.HashMap;

public final class FtcActivity extends C2463Ryd {
    public final Crj LIZ = RouteArgExtension.INSTANCE.optionalArgNotNull((Activity) this, C2419Rxv.LIZ, "next_page", Integer.class);
    public final Crj LIZJ = 7he.LIZ(new C2420Rxw(this));
    public HashMap LIZLLL;

    static {
        Covode.recordClassIndex(50542);
    }

    private final int LIZJ() {
        return ((Number) this.LIZ.getValue()).intValue();
    }

    private final Serializable LJIIIIZZ() {
        return (Serializable) this.LIZJ.getValue();
    }

    public final void _$_clearFindViewByIdCache() {
        HashMap hashMap = this.LIZLLL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

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

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

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

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

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity, X.SNU, 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.account.agegate.activity.FtcActivity", "onWindowFocusChanged", true);
        super.onWindowFocusChanged(z);
    }

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

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

    /* JADX WARNING: type inference failed for: r1v2, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZIZ(android.os.Bundle r5) {
        /*
            r4 = this;
            if (r5 != 0) goto L_0x0007
            android.os.Bundle r5 = new android.os.Bundle
            r5.<init>()
        L_0x0007:
            java.io.Serializable r1 = r4.LJIIIIZZ()
            if (r1 == 0) goto L_0x0012
            java.lang.String r0 = "age_gate_response"
            r5.putSerializable(r0, r1)
        L_0x0012:
            java.lang.String r0 = X.C2409Rxl.LIZIZ
            boolean r0 = android.text.TextUtils.isEmpty(r0)
            if (r0 != 0) goto L_0x0021
            java.lang.String r1 = X.C2409Rxl.LIZIZ
            java.lang.String r0 = "enter_from"
            r5.putString(r0, r1)
        L_0x0021:
            boolean r0 = X.C2469Ryj.LIZ()
            if (r0 == 0) goto L_0x002d
            r1 = 1
            java.lang.String r0 = "only_login"
            r5.putBoolean(r0, r1)
        L_0x002d:
            java.lang.String r1 = "platform"
            java.lang.String r0 = "account"
            r5.putString(r1, r0)
            r1 = r4
            java.lang.String r0 = "//account/ftc/complete"
            com.bytedance.router.SmartRoute r0 = com.bytedance.router.SmartRouter.buildRoute((android.content.Context) r1, (java.lang.String) r0)
            r0.withParam((android.os.Bundle) r5)
            r0.open()
            android.app.Activity[] r0 = com.ss.android.ugc.aweme.utils.ActivityStack.getActivityStack()
            java.lang.String r3 = ""
            kotlin.h.b.n.LIZIZ(r0, r3)
            java.util.List r0 = X.LeY.LJI(r0)
            java.util.Iterator r2 = r0.iterator()
        L_0x0052:
            boolean r0 = r2.hasNext()
            if (r0 == 0) goto L_0x006b
            java.lang.Object r1 = r2.next()
            android.app.Activity r1 = (android.app.Activity) r1
            kotlin.h.b.n.LIZIZ(r1, r3)
            boolean r0 = r1.isFinishing()
            if (r0 != 0) goto L_0x0052
            r1.finish()
            goto L_0x0052
        L_0x006b:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity.LIZIZ(android.os.Bundle):void");
    }

    /* JADX WARNING: type inference failed for: r7v0, types: [com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity, X.Ryd, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity", "onCreate", true);
        activityConfiguration(C2574S1a.LIZ);
        super.onCreate(bundle);
        if (bundle == null) {
            if (LIZJ() != C2162Rtm.NONE.getValue()) {
                0Bx LIZ2 = 0By.LIZ(this, (0Bv) null);
                if (2GD.LIZ) {
                    0Bs.LIZ(LIZ2, this);
                }
                1hU<Bundle> r3 = LIZ2.LIZ(ActionResultModel.class).LIZ;
                Bundle LIZ3 = LIZ(getIntent());
                if (LIZ3 == null) {
                    LIZ3 = new Bundle();
                }
                LIZ3.putInt("next_page", LIZJ());
                r3.postValue(LIZ3);
            } else {
                IllegalArgumentException illegalArgumentException = new IllegalArgumentException("Cannot start AgeGateActivityV2 with Step.NONE");
                ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity", "onCreate", false);
                throw illegalArgumentException;
            }
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity", "onCreate", false);
    }

    /* JADX WARNING: type inference failed for: r1v2, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(android.os.Bundle r7) {
        /*
            r6 = this;
            java.io.Serializable r3 = r6.LJIIIIZZ()
            boolean r0 = r3 instanceof X.44L
            if (r0 != 0) goto L_0x0009
            r3 = 0
        L_0x0009:
            X.44L r3 = (X.44L) r3
            if (r3 != 0) goto L_0x0017
            X.44L r3 = new X.44L
            r2 = 0
            X.3v1 r1 = X.3v1.PASS
            X.3v1 r0 = X.3v1.US_FTC
            r3.<init>(r2, r1, r0)
        L_0x0017:
            if (r7 != 0) goto L_0x001e
            android.os.Bundle r7 = new android.os.Bundle
            r7.<init>()
        L_0x001e:
            r0 = -1
            java.lang.String r5 = "current_page"
            int r4 = r7.getInt(r5, r0)
            X.Rtp r1 = X.C2162Rtm.Companion
            X.Rtm r0 = X.C2162Rtm.FTC_CREATE_ACCOUNT
            int r0 = r0.getValue()
            java.lang.String r2 = "next_page"
            int r0 = r7.getInt(r2, r0)
            X.Rtm r1 = r1.LIZ(r0)
            X.Rtm r0 = X.C2162Rtm.DELETE_VIDEO_ALERT
            if (r1 != r0) goto L_0x006f
            r1 = r6
            java.lang.String r0 = X.C2376RxE.LIZ
            com.bytedance.router.SmartRoute r2 = com.bytedance.router.SmartRouter.buildRoute((android.content.Context) r1, (java.lang.String) r0)
            java.lang.String r0 = "age_gate_response"
            r2.withParam((java.lang.String) r0, (java.io.Serializable) r3)
            java.lang.String r1 = "enter_from"
            java.lang.String r0 = ""
            java.lang.String r0 = r7.getString(r1, r0)
            r2.withParam((java.lang.String) r1, (java.lang.String) r0)
            boolean r1 = r3.is_prompt()
            java.lang.String r0 = "is_prompt"
            r2.withParam((java.lang.String) r0, (int) r1)
            X.3v1 r0 = r3.getAgeGatePostAction()
            int r1 = r0.getValue()
            java.lang.String r0 = "age_gate_post_action"
            r2.withParam((java.lang.String) r0, (int) r1)
            r2.open()
            r6.finish()
            return
        L_0x006f:
            java.lang.String r0 = "previous_page"
            r7.putInt(r0, r4)
            int r0 = r1.getValue()
            r7.putInt(r5, r0)
            r7.remove(r2)
            X.Ruh r0 = X.C2219Ruh.LIZ
            com.ss.android.ugc.aweme.account.login.v2.base.BaseAccountFlowFragment r0 = r0.LIZ(r1)
            X.C2463Ryd.LIZ(r6, r0, r7)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.account.agegate.activity.FtcActivity.LIZ(android.os.Bundle):void");
    }
}
