米游社.apk(点击下载) / UserProtocolDialogActivity.java


package com.mihoyo.hyperion.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import av.l0;
import av.n0;
import av.w;
import com.mihoyo.commlib.utils.ExtensionKt;
import com.mihoyo.hotfix.runtime.patch.RuntimeDirector;
import com.mihoyo.hyperion.R;
import com.mihoyo.hyperion.main.HyperionMainActivity;
import com.mihoyo.hyperion.manager.MihoyoRouter;
import com.mihoyo.hyperion.model.bean.BaseBean;
import com.mihoyo.hyperion.user.account.AccountManager;
import com.mihoyo.hyperion.utils.AppUtils;
import com.mihoyo.hyperion.utils.DialogActivityHelper;
import du.d0;
import du.f0;
import du.k2;
import ge.t;
import he.f;
import java.util.LinkedHashMap;
import java.util.Map;
import oi.k;

public final class UserProtocolDialogActivity extends t8.a implements he.f {

    /* renamed from: c */
    public static final a f36774c = new a(null);
    public static RuntimeDirector m__m;

    /* renamed from: a */
    public final d0 f36775a = f0.c(new b(this));

    /* renamed from: b */
    public Map<Integer, View> f36776b = new LinkedHashMap();

    public static final class a {
        public static RuntimeDirector m__m;

        public a() {
        }

        public /* synthetic */ a(w wVar) {
            this();
        }

        public static /* synthetic */ void b(a aVar, Context context, boolean z10, int i10, Object obj) {
            if ((i10 & 2) != 0) {
                z10 = true;
            }
            aVar.a(context, z10);
        }

        public final void a(Context context, boolean z10) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                l0.p(context, "context");
                if (!DialogActivityHelper.INSTANCE.canShowDialogActivity()) {
                    wa.a.f147149a.b("UserProtocolDialogActivity not show");
                    return;
                }
                Intent intent = new Intent(context, UserProtocolDialogActivity.class);
                if (!(context instanceof Activity)) {
                    intent.addFlags(268435456);
                }
                if (z10) {
                    pd.a aVar = pd.a.f102018a;
                    if (!aVar.a()) {
                        aVar.c(true);
                        aVar.d(true);
                        context.startActivity(intent);
                        return;
                    }
                    return;
                }
                context.startActivity(intent);
                return;
            }
            runtimeDirector.invocationDispatch(0, this, context, Boolean.valueOf(z10));
        }
    }

    public static final class b extends n0 implements zu.a<t> {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36777a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(UserProtocolDialogActivity userProtocolDialogActivity) {
            super(0);
            this.f36777a = userProtocolDialogActivity;
        }

        /* renamed from: a */
        public final t invoke() {
            RuntimeDirector runtimeDirector = m__m;
            return (runtimeDirector == null || !runtimeDirector.isRedirect(0)) ? new t(this.f36777a) : (t) runtimeDirector.invocationDispatch(0, this, ga.a.f66507a);
        }
    }

    public static final class c extends n0 implements zu.a<k2> {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36778a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public c(UserProtocolDialogActivity userProtocolDialogActivity) {
            super(0);
            this.f36778a = userProtocolDialogActivity;
        }

        @Override // zu.a
        public final void invoke() {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                AccountManager.INSTANCE.logOut();
                this.f36778a.finish();
                k kVar = k.f99551a;
                if (kVar.I()) {
                    kVar.e(false);
                } else {
                    HyperionMainActivity.O.h(true);
                }
            } else {
                runtimeDirector.invocationDispatch(0, this, ga.a.f66507a);
            }
        }
    }

    public static final class d extends n0 implements zu.a<k2> {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36779a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public d(UserProtocolDialogActivity userProtocolDialogActivity) {
            super(0);
            this.f36779a = userProtocolDialogActivity;
        }

        @Override // zu.a
        public final void invoke() {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector != null && runtimeDirector.isRedirect(0)) {
                runtimeDirector.invocationDispatch(0, this, ga.a.f66507a);
            } else if (!((CheckBox) this.f36779a._$_findCachedViewById(R.id.mUserDialogCheckBox)).isChecked()) {
                AppUtils.INSTANCE.showToast("你还没有同意用户协议哦~");
            } else {
                this.f36779a.q4().dispatch(new f.a());
            }
        }
    }

    public static final class e extends ClickableSpan {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36780a;

        public e(UserProtocolDialogActivity userProtocolDialogActivity) {
            this.f36780a = userProtocolDialogActivity;
        }

        public void onClick(View view) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                l0.p(view, "widget");
                MihoyoRouter.openNativePage$default(MihoyoRouter.INSTANCE, this.f36780a, cb.a.f14567a.f(), false, 4, null);
                return;
            }
            runtimeDirector.invocationDispatch(0, this, view);
        }

        public void updateDrawState(TextPaint textPaint) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(1)) {
                l0.p(textPaint, "ds");
                textPaint.setUnderlineText(false);
                return;
            }
            runtimeDirector.invocationDispatch(1, this, textPaint);
        }
    }

    public static final class f extends ClickableSpan {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36781a;

        public f(UserProtocolDialogActivity userProtocolDialogActivity) {
            this.f36781a = userProtocolDialogActivity;
        }

        public void onClick(View view) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                l0.p(view, "widget");
                MihoyoRouter.openNativePage$default(MihoyoRouter.INSTANCE, this.f36781a, "https://m.miyoushe.com/bh3/?type=noHeader&type=inApp#/agreement?type=privacy", false, 4, null);
                return;
            }
            runtimeDirector.invocationDispatch(0, this, view);
        }

        public void updateDrawState(TextPaint textPaint) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(1)) {
                l0.p(textPaint, "ds");
                textPaint.setUnderlineText(false);
                return;
            }
            runtimeDirector.invocationDispatch(1, this, textPaint);
        }
    }

    public static final class g extends ClickableSpan {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36782a;

        public g(UserProtocolDialogActivity userProtocolDialogActivity) {
            this.f36782a = userProtocolDialogActivity;
        }

        public void onClick(View view) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                l0.p(view, "widget");
                MihoyoRouter.openNativePage$default(MihoyoRouter.INSTANCE, this.f36782a, cb.a.f14567a.E(), false, 4, null);
                return;
            }
            runtimeDirector.invocationDispatch(0, this, view);
        }

        public void updateDrawState(TextPaint textPaint) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(1)) {
                l0.p(textPaint, "ds");
                textPaint.setUnderlineText(false);
                return;
            }
            runtimeDirector.invocationDispatch(1, this, textPaint);
        }
    }

    public static final class h extends ClickableSpan {
        public static RuntimeDirector m__m;

        /* renamed from: a */
        public final /* synthetic */ UserProtocolDialogActivity f36783a;

        public h(UserProtocolDialogActivity userProtocolDialogActivity) {
            this.f36783a = userProtocolDialogActivity;
        }

        public void onClick(View view) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(0)) {
                l0.p(view, "widget");
                MihoyoRouter.openNativePage$default(MihoyoRouter.INSTANCE, this.f36783a, cb.a.f14567a.c(), false, 4, null);
                return;
            }
            runtimeDirector.invocationDispatch(0, this, view);
        }

        public void updateDrawState(TextPaint textPaint) {
            RuntimeDirector runtimeDirector = m__m;
            if (runtimeDirector == null || !runtimeDirector.isRedirect(1)) {
                l0.p(textPaint, "ds");
                textPaint.setUnderlineText(false);
                return;
            }
            runtimeDirector.invocationDispatch(1, this, textPaint);
        }
    }

    @Override // he.f
    public void B2(BaseBean baseBean) {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector == null || !runtimeDirector.isRedirect(3)) {
            l0.p(baseBean, "bean");
            AccountManager.INSTANCE.isAgreeProtocol();
            finish();
            return;
        }
        runtimeDirector.invocationDispatch(3, this, baseBean);
    }

    @Override // t8.a
    public void _$_clearFindViewByIdCache() {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector == null || !runtimeDirector.isRedirect(6)) {
            this.f36776b.clear();
        } else {
            runtimeDirector.invocationDispatch(6, this, ga.a.f66507a);
        }
    }

    @Override // t8.a
    public View _$_findCachedViewById(int i10) {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector == null || !runtimeDirector.isRedirect(7)) {
            Map<Integer, View> map = this.f36776b;
            View view = map.get(Integer.valueOf(i10));
            if (view != null) {
                return view;
            }
            View findViewById = findViewById(i10);
            if (findViewById == null) {
                return null;
            }
            map.put(Integer.valueOf(i10), findViewById);
            return findViewById;
        }
        return (View) runtimeDirector.invocationDispatch(7, this, Integer.valueOf(i10));
    }

    @Override // androidx.activity.ComponentActivity
    public void onBackPressed() {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector != null && runtimeDirector.isRedirect(4)) {
            runtimeDirector.invocationDispatch(4, this, ga.a.f66507a);
        }
    }

    @Override // androidx.activity.ComponentActivity, androidx.fragment.app.e, t8.a, g0.j
    public void onCreate(Bundle bundle) {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector == null || !runtimeDirector.isRedirect(1)) {
            super.onCreate(bundle);
            setContentView(R.layout.activity_user_protocol_dialog);
            setFinishOnTouchOutside(false);
            TextView textView = (TextView) _$_findCachedViewById(R.id.mUserDialogCancel);
            l0.o(textView, "mUserDialogCancel");
            ExtensionKt.M(textView, new c(this));
            TextView textView2 = (TextView) _$_findCachedViewById(R.id.mUserDialogOK);
            l0.o(textView2, "mUserDialogOK");
            ExtensionKt.M(textView2, new d(this));
            TextView textView3 = (TextView) _$_findCachedViewById(R.id.mUserDialogTip);
            l0.o(textView3, "mUserDialogTip");
            p4(textView3);
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
            String string = getResources().getString(R.string.user_agree_protocol);
            l0.o(string, "resources.getString(R.string.user_agree_protocol)");
            spannableStringBuilder.append((CharSequence) string);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(i0.d.f(this, R.color.text_gray_link)), 0, string.length(), 17);
            spannableStringBuilder.setSpan(new h(this), 0, string.length(), 17);
            spannableStringBuilder.setSpan(new StyleSpan(1), 0, string.length(), 17);
            String string2 = getResources().getString(R.string.user_agree_privacy);
            l0.o(string2, "resources.getString(R.string.user_agree_privacy)");
            spannableStringBuilder.append((CharSequence) string2);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(i0.d.f(this, R.color.text_gray_link)), string.length(), spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new f(this), string.length(), spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new StyleSpan(1), string.length(), spannableStringBuilder.length(), 17);
            String string3 = getResources().getString(R.string.user_third_sdk_list);
            l0.o(string3, "resources.getString(R.string.user_third_sdk_list)");
            int length = spannableStringBuilder.length();
            spannableStringBuilder.append((CharSequence) string3);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(i0.d.f(this, R.color.text_gray_link)), length, spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new g(this), length, spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new StyleSpan(1), length, spannableStringBuilder.length(), 17);
            String string4 = getResources().getString(R.string.mihoyo_children_agree_privacy);
            l0.o(string4, "resources.getString(R.st…o_children_agree_privacy)");
            int length2 = spannableStringBuilder.length();
            spannableStringBuilder.append((CharSequence) string4);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(i0.d.f(this, R.color.text_gray_link)), length2, spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new e(this), length2, spannableStringBuilder.length(), 17);
            spannableStringBuilder.setSpan(new StyleSpan(1), length2, spannableStringBuilder.length(), 17);
            spannableStringBuilder.append((CharSequence) "有更新,请阅读并同意后继续使用,米哈游感谢你的一直陪伴。");
            int i10 = R.id.mUserAgreeTitle;
            ((TextView) _$_findCachedViewById(i10)).setText(spannableStringBuilder);
            ((TextView) _$_findCachedViewById(i10)).setMovementMethod(LinkMovementMethod.getInstance());
            return;
        }
        runtimeDirector.invocationDispatch(1, this, bundle);
    }

    @Override // androidx.fragment.app.e, androidx.appcompat.app.e
    public void onDestroy() {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector == null || !runtimeDirector.isRedirect(5)) {
            super.onDestroy();
            pd.a.f102018a.c(false);
            return;
        }
        runtimeDirector.invocationDispatch(5, this, ga.a.f66507a);
    }

    public final void p4(View view) {
        RuntimeDirector runtimeDirector = m__m;
        if (runtimeDirector != null && runtimeDirector.isRedirect(2)) {
            runtimeDirector.invocationDispatch(2, this, view);
        } else if (view instanceof TextView) {
            ((TextView) view).setHighlightColor(getResources().getColor(17170445));
        }
    }

    public final t q4() {
        RuntimeDirector runtimeDirector = m__m;
        return (runtimeDirector == null || !runtimeDirector.isRedirect(0)) ? (t) this.f36775a.getValue() : (t) runtimeDirector.invocationDispatch(0, this, ga.a.f66507a);
    }
}