package com.ss.android.ugc.aweme.compliance.protection.timelock.ui.fragment;

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0HH;
import X.1hK;
import X.AnonymousClass2GD;
import X.AnonymousClass2UX;
import X.C12422nK;
import X.C16832uR;
import X.C30953c7;
import X.C30983cA;
import X.C31083cK;
import X.C45353zL;
import X.C45393zP;
import X.C45413zR;
import X.C45503za;
import X.C45513zb;
import X.C45523zc;
import X.C45533zd;
import X.C45543ze;
import X.C45563zg;
import X.C45593zj;
import X.C45623zm;
import X.C459140p;
import X.LjB;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PgU;
import X.PhE;
import X.PlI;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.LiveData;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.api.BaseResponse;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.compliance.protection.familypairing.api.FamilyPairingApi;
import com.ss.android.ugc.aweme.compliance.protection.timelock.viewmodel.SetLockParamViewModel;
import java.util.HashMap;
import kotlin.h.b.n;

public abstract class AbsOptionsFragmentV2 extends AmeBaseFragment {
    public Button LIZ;
    public Button LIZIZ;

    static {
        Covode.recordClassIndex(62142);
    }

    public abstract int LIZ();

    public final LiveData<C45413zR> LIZJ() {
        if (getActivity() == null) {
            return null;
        }
        return LIZ(getActivity()).LIZ(SetLockParamViewModel.class).LIZ;
    }

    public final boolean LIZLLL() {
        if (LIZJ() == null || ((C45413zR) LIZJ().getValue()).LIZIZ == null) {
            return false;
        }
        return true;
    }

    public final /* synthetic */ void LJ() {
        PgU<C459140p> dynamicPassword;
        String str = "";
        if (!LIZLLL()) {
            AnonymousClass2UX r1 = new AnonymousClass2UX();
            if (LIZJ() != null) {
                if (((C45413zR) LIZJ().getValue()).LIZ == 0) {
                    str = "time_lock";
                } else {
                    str = "teen_mode";
                }
            }
            r1.LIZ("enter_method", str);
            C12422nK.LIZ("qa_enter_change_passport", r1.LIZ);
            Fragment LIZIZ2 = C45353zL.LIZIZ(2);
            C45513zb LIZ2 = C45503za.LIZ().LIZ("TimeLockEnterFragmentV2");
            LIZ2.LIZ(LIZIZ2);
            LIZ2.LIZ(this, new C45623zm<Boolean>() {
                static {
                    Covode.recordClassIndex(62143);
                }

                public final /* bridge */ /* synthetic */ void LIZ() {
                    AbsOptionsFragmentV2.this.LIZ(C45353zL.LIZ(true));
                }
            });
            LIZ(LIZIZ2);
        } else if (LIZJ() != null && LIZJ().getValue() != null && ((C45413zR) LIZJ().getValue()).LIZIZ != null) {
            String str2 = ((C45413zR) LIZJ().getValue()).LIZIZ.LIZ;
            String str3 = ((C45413zR) LIZJ().getValue()).LIZIZ.LIZIZ;
            Context context = getContext();
            M12.LIZ(str2, str3, context);
            if (!TextUtils.isEmpty(str2) && (dynamicPassword = FamilyPairingApi.LIZIZ.getDynamicPassword(str2, str3)) != null) {
                n.LIZIZ(dynamicPassword, str);
                dynamicPassword.LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new LjB(context), new C45533zd(context));
            }
        }
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ2 = 0By.LIZ(r2, (0Bv) null);
        if (AnonymousClass2GD.LIZ) {
            0Bs.LIZ(LIZ2, r2);
        }
        return LIZ2;
    }

    public final void LIZ(Fragment fragment) {
        getActivity().LIZ(fragment);
    }

    public final void LIZ(int i) {
        HashMap hashMap = new HashMap();
        if (i == 1) {
            hashMap.put("teen_mode", "0");
        } else {
            hashMap.put("screen_time_management", "0");
        }
        if (LIZJ() != null && LIZJ().getValue() != null && ((C45413zR) LIZJ().getValue()).LIZIZ != null) {
            C45393zP r0 = ((C45413zR) LIZJ().getValue()).LIZIZ;
            PgU<BaseResponse> LIZ2 = FamilyPairingApi.LIZ(r0.LIZ, r0.LIZIZ, hashMap);
            if (LIZ2 != null) {
                LIZ2.LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C45523zc(this, i), new C45543ze(this));
            }
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        AbsOptionsFragmentV2.super.onViewCreated(view, bundle);
        this.LIZ = (Button) view.findViewById(2131363004);
        C30953c7 r4 = (C30953c7) view.findViewById(2131371289);
        if (r4 != null) {
            C16832uR r3 = new C16832uR();
            C30983cA r1 = new C30983cA();
            r1.LIZ(2131755170);
            r1.LIZ((C31083cK) new C45563zg(this));
            r3.LIZ(r1);
            r3.LIZLLL = false;
            r4.setNavActions(r3);
        }
        this.LIZIZ = (Button) view.findViewById(2131363003);
        this.LIZ.setOnClickListener(new C45593zj(this));
    }

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