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

import X.0HH;
import X.7he;
import X.C2604S2e;
import X.C2619S2t;
import X.C2621S2v;
import X.Crj;
import X.M12;
import X.S2J;
import X.S2V;
import X.S2W;
import X.S2Y;
import X.SNU;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.account.login.auth.I18nSignUpActivity;
import com.ss.android.ugc.aweme.account.login.auth.SignupViewModel;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;

public final class LoginDialogFragment extends AmeBaseFragment {
    public S2W LIZ;
    public final Crj LIZIZ = 7he.LIZ(new C2604S2e(this));
    public HashMap LIZJ;

    static {
        Covode.recordClassIndex(50950);
    }

    private final SignupViewModel LIZ() {
        return (SignupViewModel) this.LIZIZ.getValue();
    }

    public final void onDestroyView() {
        S2W s2w = this.LIZ;
        if (s2w != null) {
            Dialog dialog = s2w.LIZLLL;
            if (dialog != null) {
                dialog.dismiss();
            }
            Dialog dialog2 = s2w.LJ;
            if (dialog2 != null) {
                dialog2.dismiss();
            }
            Dialog dialog3 = s2w.LJFF;
            if (dialog3 != null) {
                dialog3.dismiss();
            }
        }
        LoginDialogFragment.super.onDestroyView();
        HashMap hashMap = this.LIZJ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        S2W s2y;
        List<C2619S2t> LIZ2;
        View view2 = view;
        M12.LIZ(view2);
        LoginDialogFragment.super.onViewCreated(view2, bundle);
        Bundle arguments = getArguments();
        if (arguments != null) {
            I18nSignUpActivity activity = getActivity();
            Objects.requireNonNull(activity, "null cannot be cast to non-null type com.ss.android.ugc.aweme.account.login.auth.I18nSignUpActivity");
            C2621S2v LIZLLL = activity.LIZLLL();
            if (arguments.getBoolean("UseViewPager", true)) {
                Objects.requireNonNull(LIZLLL, "null cannot be cast to non-null type com.ss.android.ugc.aweme.account.login.auth.factory.ViewPagerSignupManager");
                S2J s2j = (S2J) LIZLLL;
                I18nSignUpActivity activity2 = getActivity();
                Objects.requireNonNull(activity2, "null cannot be cast to non-null type com.ss.android.ugc.aweme.account.login.auth.I18nSignUpActivity");
                I18nSignUpActivity i18nSignUpActivity = activity2;
                SNU activity3 = getActivity();
                Objects.requireNonNull(activity3, "null cannot be cast to non-null type com.bytedance.ies.foundation.activity.BaseActivity");
                SNU snu = activity3;
                boolean z = arguments.getBoolean("is_signup_view");
                if (arguments.getBoolean("is_signup_view")) {
                    LIZ2 = LIZ().LIZIZ();
                } else {
                    LIZ2 = LIZ().LIZ();
                }
                s2y = new S2V(s2j, i18nSignUpActivity, snu, view2, z, LIZ2);
            } else {
                SNU activity4 = getActivity();
                Objects.requireNonNull(activity4, "null cannot be cast to non-null type com.bytedance.ies.foundation.activity.BaseActivity");
                s2y = new S2Y(LIZLLL, activity4, view2, LIZ().LIZ());
            }
            this.LIZ = s2y;
        }
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        return 0HH.LIZ(layoutInflater, 2131558711, viewGroup, false);
    }
}
