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

import X.070;
import X.0HH;
import X.9aa;
import X.AnonymousClass2UX;
import X.C12422nK;
import X.C33273fr;
import X.C33293ft;
import X.C33303fu;
import X.C33313fv;
import X.C33323fw;
import X.C33343fy;
import X.Lnj;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PhE;
import X.PlI;
import X.Qeg;
import X.SfZ;
import android.content.Context;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.account.view.IPrivateAccountTipsView;
import java.util.Locale;
import java.util.Objects;
import kotlin.h.b.n;
import kotlin.o.z;

public final class PrivateAccountTipsViewDelegate implements IPrivateAccountTipsView {
    public C33293ft LIZ;

    static {
        Covode.recordClassIndex(51754);
    }

    public final void LIZJ() {
        this.LIZ = null;
    }

    public final void LIZIZ() {
        C33293ft r2 = this.LIZ;
        if (r2 == null) {
            n.LIZIZ();
        }
        r2.LIZ = System.currentTimeMillis();
    }

    public final void LIZ() {
        if (SfZ.LJIIJJI) {
            AnonymousClass2UX r4 = new AnonymousClass2UX();
            r4.LIZ("result", "background");
            long currentTimeMillis = System.currentTimeMillis();
            C33293ft r0 = this.LIZ;
            if (r0 == null) {
                n.LIZIZ();
            }
            r4.LIZ("stay_time", currentTimeMillis - r0.LIZ);
            C12422nK.LIZ("private_notify_exit", r4.LIZ);
        }
    }

    public static IPrivateAccountTipsView LIZLLL() {
        MethodCollector.i(149);
        IPrivateAccountTipsView iPrivateAccountTipsView = (IPrivateAccountTipsView) Lnj.LIZ(IPrivateAccountTipsView.class, false);
        if (iPrivateAccountTipsView != null) {
            MethodCollector.o(149);
            return iPrivateAccountTipsView;
        }
        Object LIZIZ = Lnj.LIZIZ(IPrivateAccountTipsView.class, false);
        if (LIZIZ != null) {
            IPrivateAccountTipsView iPrivateAccountTipsView2 = (IPrivateAccountTipsView) LIZIZ;
            MethodCollector.o(149);
            return iPrivateAccountTipsView2;
        }
        if (Lnj.LJJIIZI == null) {
            synchronized (IPrivateAccountTipsView.class) {
                try {
                    if (Lnj.LJJIIZI == null) {
                        Lnj.LJJIIZI = new PrivateAccountTipsViewDelegate();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(149);
                    throw th;
                }
            }
        }
        PrivateAccountTipsViewDelegate privateAccountTipsViewDelegate = (PrivateAccountTipsViewDelegate) Lnj.LJJIIZI;
        MethodCollector.o(149);
        return privateAccountTipsViewDelegate;
    }

    public final void LIZ(Bundle bundle) {
        if (bundle == null) {
            C12422nK.onEventV3("private_notify_show");
        }
    }

    public final void LIZ(View view, C33343fy r12) {
        M12.LIZ(view, r12);
        C33293ft r4 = new C33293ft(view, r12);
        this.LIZ = r4;
        r4.LIZJ.findViewById(2131365285).setOnClickListener(new C33273fr(r4));
        Context context = r4.LIZJ.getContext();
        String string = context.getString(2131826626);
        n.LIZIZ(string, "");
        int i = 0;
        String string2 = context.getString(2131823743, new Object[]{string});
        n.LIZIZ(string2, "");
        SpannableString spannableString = new SpannableString(string2);
        int LIZ2 = z.LIZ(string2, string, 0, false, 6);
        spannableString.setSpan(new C33303fu(context, 070.LIZJ(context, 2131099750)), LIZ2, string.length() + LIZ2, 34);
        TextView textView = (TextView) r4.LIZJ.findViewById(2131371237);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        textView.setText(spannableString);
        textView.setHighlightColor(070.LIZJ(context, 2131099762));
        Qeg findViewById = r4.LIZJ.findViewById(2131371239);
        n.LIZIZ(findViewById, "");
        Qeg qeg = findViewById;
        String str = 9aa.LIZIZ;
        n.LIZIZ(str, "");
        Locale locale = Locale.ROOT;
        n.LIZIZ(locale, "");
        Objects.requireNonNull(str, "null cannot be cast to non-null type java.lang.String");
        String lowerCase = str.toLowerCase(locale);
        n.LIZIZ(lowerCase, "");
        if (!n.LIZ(lowerCase, "fr")) {
            i = 8;
        }
        qeg.setVisibility(i);
        ((PrivateAccountUserSettingsApi) r4.LIZIZ.getValue()).setPrivatePolicyShow("minor_private_policy_status", "0").LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(C33323fw.LIZ, C33313fv.LIZ);
    }

    public final View LIZ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        M12.LIZ(layoutInflater);
        View LIZ2 = 0HH.LIZ(layoutInflater, 2131558708, viewGroup, false);
        n.LIZIZ(LIZ2, "");
        return LIZ2;
    }
}
