package com.ss.android.ugc.aweme.account.login.v2.ui;

import X.7he;
import X.8gF;
import X.C2162Rtm;
import X.C2167Rtr;
import X.C2499RzD;
import X.C2575S1b;
import X.Crj;
import X.M12;
import X.S0L;
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.account.login.v2.base.BaseAccountFlowFragment;
import com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity;
import java.util.HashMap;
import kotlin.h.b.n;

public final class LoginActionFlowActivity extends CommonFlowActivity {
    public final Crj LIZ = 7he.LIZ(new C2499RzD(this));
    public HashMap LJIIIIZZ;

    static {
        Covode.recordClassIndex(51750);
    }

    private final S0L LJIIIZ() {
        return (S0L) this.LIZ.getValue();
    }

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

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

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, 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.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, 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.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity", "onResume", true);
        super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, 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.login.v2.ui.LoginActionFlowActivity", "onWindowFocusChanged", true);
        super.onWindowFocusChanged(z);
    }

    public final void onBackPressed() {
        BaseAccountFlowFragment LJ;
        BaseAccountFlowFragment LJ2 = LJ();
        if ((LJ2 == null || !LJ2.aA_()) && (LJ = LJ()) != null) {
            Bundle arguments = LJ.getArguments();
            if (arguments == null) {
                n.LIZIZ();
            }
            arguments.putInt("next_page", C2162Rtm.FINISH.getValue());
            Bundle arguments2 = LJ.getArguments();
            if (arguments2 == null) {
                n.LIZIZ();
            }
            n.LIZIZ(arguments2, "");
            LJ.LIZ(arguments2);
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, 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) {
        }
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.account.login.v2.base.CommonFlowActivity, com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity", "onCreate", true);
        activityConfiguration(C2575S1b.LIZ);
        super.onCreate(bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.account.login.v2.ui.LoginActionFlowActivity", "onCreate", false);
    }

    public final void LIZ(Bundle bundle) {
        C2162Rtm rtm;
        if (bundle != null && C2162Rtm.Companion.LIZ(bundle.getInt("next_page", C2162Rtm.FINISH.getValue())) == C2162Rtm.FINISH) {
            C2162Rtm LIZ2 = C2162Rtm.Companion.LIZ(bundle.getInt("current_page", -1));
            while (true) {
                M12.LIZ(LIZ2);
                int i = C2167Rtr.LIZ[LIZ2.ordinal()];
                if (i != 1) {
                    if (i == 2) {
                        S0L LJIIIZ = LJIIIZ();
                        if (LJIIIZ != null && LJIIIZ.getNeedShowPrivateAccountTips()) {
                            rtm = C2162Rtm.PRIVATE_ACCOUNT_TIPS;
                            break;
                        }
                        LIZ2 = C2162Rtm.PRIVATE_ACCOUNT_TIPS;
                    } else {
                        rtm = C2162Rtm.FINISH;
                        break;
                    }
                } else {
                    S0L LJIIIZ2 = LJIIIZ();
                    if (LJIIIZ2 != null && LJIIIZ2.getNeedSetUserName()) {
                        rtm = C2162Rtm.CREATE_USERNAME;
                        break;
                    }
                    LIZ2 = C2162Rtm.CREATE_USERNAME;
                }
            }
            if (rtm == C2162Rtm.FINISH) {
                LIZIZ((Bundle) null);
                return;
            }
            bundle.putInt("next_page", rtm.getValue());
        }
        super.LIZ(bundle);
    }
}
