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

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.1hK;
import X.2GD;
import X.2HN;
import X.2nK;
import X.3v1;
import X.44L;
import X.44i;
import X.7he;
import X.C1700RmK;
import X.C1953RqP;
import X.C1962RqY;
import X.C1968Rqe;
import X.C1969Rqf;
import X.C1970Rqg;
import X.C2076RsO;
import X.C2078RsQ;
import X.C2080RsS;
import X.C2081RsT;
import X.C2085RsX;
import X.C2091Rsd;
import X.C2094Rsg;
import X.C2162Rtm;
import X.C2202RuQ;
import X.C2671S4t;
import X.Crj;
import X.JLi;
import X.JtF;
import X.M12;
import X.S52;
import X.S5C;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.account.login.v2.base.ActionResultModel;
import com.ss.android.ugc.aweme.account.login.v2.ui.fragments.BaseI18nLoginFragment;
import java.util.HashMap;
import kotlin.h.b.n;

public final class FtcCreatePasswordFragment extends BaseI18nLoginFragment implements C1969Rqf, S5C {
    public static final C2085RsX LIZJ = new C2085RsX((byte) 0);
    public C1968Rqe LIZ;
    public final Crj LIZIZ = 7he.LIZ(new C2081RsT(this));
    public final Crj LIZLLL = 7he.LIZ(new C2080RsS(this));
    public final Crj LJIIL = 7he.LIZ(new C2078RsQ(this));
    public HashMap LJIILIIL;

    static {
        Covode.recordClassIndex(50583);
    }

    private final boolean LJIIIZ() {
        return ((Boolean) this.LIZLLL.getValue()).booleanValue();
    }

    public final int LIZ() {
        return 2131558702;
    }

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

    public final void LJIIJ() {
        HashMap hashMap = this.LJIILIIL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        LJIIJ();
    }

    public final void LJFF() {
        ((C2671S4t) LIZ(2131365235)).LIZIZ(true);
    }

    public final void LJI() {
        ((C2671S4t) LIZ(2131365235)).LIZ(true);
    }

    public final boolean aA_() {
        2nK.onEventV3("exit_create_password_page");
        return LJIIIZ();
    }

    public final void onResume() {
        super.onResume();
        C2094Rsg.LIZ(((S52) LIZ(2131365236)).getEditText());
    }

    public final C2202RuQ LIZLLL() {
        String str;
        boolean z = !LJIIIZ();
        if (((Boolean) this.LJIIL.getValue()).booleanValue()) {
            str = getString(2131823105);
        } else {
            str = " ";
        }
        return new C2202RuQ(str, (String) null, z, getString(2131822559), (String) null, false, (String) null, false, false, 1514);
    }

    public final void LJIIIIZZ() {
        1hK activity = getActivity();
        if (activity != null) {
            Bundle arguments = getArguments();
            if (arguments == null) {
                arguments = new Bundle();
            }
            arguments.putString("platform", "account");
            n.LIZIZ(arguments, "");
            0Bx LIZ2 = 0By.LIZ(activity, (0Bv) null);
            if (2GD.LIZ) {
                0Bs.LIZ(LIZ2, activity);
            }
            LIZ2.LIZ(ActionResultModel.class).LIZIZ.postValue(arguments);
        }
    }

    public final void LJII() {
        if (LJIIIZ()) {
            44i.LIZJ(false);
        }
        Bundle arguments = getArguments();
        if (arguments == null) {
            arguments = new Bundle();
        }
        arguments.putInt("next_page", C2162Rtm.DELETE_VIDEO_ALERT.getValue());
        arguments.putSerializable("age_gate_response", new 44L(false, 3v1.PASS, 3v1.US_FTC, 1, (2HN) null));
        arguments.putString("enter_from", "from_kids_password_page");
        n.LIZIZ(arguments, "");
        LIZ(arguments);
    }

    public static final /* synthetic */ C1968Rqe LIZ(FtcCreatePasswordFragment ftcCreatePasswordFragment) {
        C1968Rqe rqe = ftcCreatePasswordFragment.LIZ;
        if (rqe == null) {
            n.LIZ("");
        }
        return rqe;
    }

    private final C2076RsO LIZLLL(Boolean bool) {
        if (n.LIZ(bool, true)) {
            return C2076RsO.Success;
        }
        if (n.LIZ(bool, false)) {
            return C2076RsO.Error;
        }
        return C2076RsO.None;
    }

    public final void LIZIZ(int i) {
        if (i == 4) {
            C1953RqP.LIZ(true);
        } else if (i == 5) {
            C1953RqP.LIZ(false);
        }
    }

    public final void LIZJ(Boolean bool) {
        C2091Rsd rsd = (C2091Rsd) LIZ(2131365229);
        if (rsd != null) {
            rsd.setVariant(LIZLLL(bool));
        }
    }

    public final void onCreate(Bundle bundle) {
        FtcCreatePasswordFragment.super.onCreate(bundle);
        boolean LJIIIZ = LJIIIZ();
        C1700RmK LJIL = LJIL();
        String LJIJI = LJIJI();
        n.LIZIZ(LJIJI, "");
        this.LIZ = new C1968Rqe(this, LJIIIZ, LJIL, LJIJI);
    }

    public final void LIZIZ(Boolean bool) {
        C2091Rsd rsd = (C2091Rsd) LIZ(2131365230);
        if (rsd != null) {
            rsd.setVariant(LIZLLL(bool));
        }
    }

    public final void LIZ(Boolean bool) {
        C2091Rsd rsd = (C2091Rsd) LIZ(2131365228);
        if (rsd != null) {
            rsd.setVariant(LIZLLL(bool));
        }
    }

    public final void LIZ(Integer num) {
        LJFF();
        if (num != null) {
            String string = getString(num.intValue());
            n.LIZIZ(string, "");
            LIZ(0, string);
        }
    }

    public final void LIZ(String str) {
        LJFF();
        if (str != null) {
            LIZ(0, str);
        }
    }

    public final void LIZ(boolean z) {
        C2671S4t s4t = (C2671S4t) LIZ(2131365235);
        if (s4t != null) {
            s4t.setEnabled(z);
        }
    }

    public final void LIZ(int i, String str) {
        M12.LIZ(str);
        JLi LIZ2 = LIZ(2131365237);
        if (LIZ2 != null) {
            LIZ2.LIZ(str);
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        EditText editText;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        if (LJIIIZ()) {
            44i.LIZJ(true);
        }
        S52 s52 = (S52) LIZ(2131365236);
        if (s52 != null) {
            s52.LIZ(4, 1);
        }
        C2091Rsd rsd = (C2091Rsd) LIZ(2131365228);
        if (rsd != null) {
            String string = getString(2131822555);
            n.LIZIZ(string, "");
            rsd.setDesc(string);
        }
        C2091Rsd rsd2 = (C2091Rsd) LIZ(2131365230);
        if (rsd2 != null) {
            String string2 = getString(2131822556);
            n.LIZIZ(string2, "");
            rsd2.setDesc(string2);
        }
        C2091Rsd rsd3 = (C2091Rsd) LIZ(2131365229);
        if (rsd3 != null) {
            String string3 = getString(2131822557);
            n.LIZIZ(string3, "");
            rsd3.setDesc(string3);
        }
        S52 s522 = (S52) LIZ(2131365236);
        if (s522 != null) {
            s522.setListener(this);
        }
        S52 s523 = (S52) LIZ(2131365236);
        if (!(s523 == null || (editText = s523.getEditText()) == null)) {
            editText.addTextChangedListener(new C1970Rqg(this));
        }
        LIZ(LIZ(2131365235), new C1962RqY(this));
        String as_ = as_();
        JtF jtF = new JtF();
        jtF.LIZ("enter_from", as_);
        2nK.LIZ("show_create_password_page", jtF.LIZ);
    }
}
