APKPure.apk(点击下载) / RegisterFragment.java


package com.apkpure.aegon.pages;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.LinkMovementMethod;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatEditText;
import com.apkpure.aegon.R;
import com.apkpure.aegon.main.launcher.PageConfig;
import com.apkpure.aegon.plugin.login.api.LoginType;
import com.apkpure.proto.nano.OpenConfigProtos;
import com.apkpure.proto.nano.ResultResponseProtos;
import com.apkpure.proto.nano.UserInfoProtos;
import com.apkpure.proto.nano.UserRequestProtos;
import e.g.a.i0.g0;
import e.g.a.i0.n0;
import e.g.a.i0.p1;
import e.g.a.s.l.a;
import e.g.a.t.b.i;
import e.g.a.v.o;
import e.g.a.v.s.r;
import e.g.a.x.x3;
import e.g.a.x.y3;
import e.g.a.z.k.k.d;
import e.w.c.e.b.l;
import e.w.e.a.b.l.b;
import i.i.d.c;
import java.util.HashMap;
import java.util.regex.Pattern;

public class RegisterFragment extends i implements View.OnClickListener {
    public static final /* synthetic */ int y = 0;

    /* renamed from: g  reason: collision with root package name */
    public AppCompatEditText f2181g;

    /* renamed from: h  reason: collision with root package name */
    public AppCompatEditText f2182h;

    /* renamed from: i  reason: collision with root package name */
    public AppCompatEditText f2183i;

    /* renamed from: j  reason: collision with root package name */
    public AppCompatEditText f2184j;

    /* renamed from: k  reason: collision with root package name */
    public TextView f2185k;

    /* renamed from: l  reason: collision with root package name */
    public ImageView f2186l;

    /* renamed from: m  reason: collision with root package name */
    public TextView f2187m;

    /* renamed from: n  reason: collision with root package name */
    public Button f2188n;

    /* renamed from: o  reason: collision with root package name */
    public ImageView f2189o;

    /* renamed from: p  reason: collision with root package name */
    public ImageView f2190p;

    /* renamed from: q  reason: collision with root package name */
    public ImageView f2191q;

    /* renamed from: r  reason: collision with root package name */
    public ImageView f2192r;

    /* renamed from: s  reason: collision with root package name */
    public boolean f2193s = false;

    /* renamed from: t  reason: collision with root package name */
    public ProgressDialog f2194t;
    public Handler u;
    public final d v = new d();
    public ClickableSpan w = new ClickableSpan() {
        /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass1 */

        public void onClick(View view) {
            OpenConfigProtos.OpenConfig openConfig = new OpenConfigProtos.OpenConfig();
            openConfig.title = RegisterFragment.this.getString(R.string.arg_RES_2131821237);
            openConfig.type = "WebPage";
            openConfig.url = "https://api.pureapk.com/m/v2/page/terms-service.html";
            HashMap hashMap = new HashMap();
            RegisterFragment registerFragment = RegisterFragment.this;
            int i2 = RegisterFragment.y;
            hashMap.put("eventId", registerFragment.c.getString(R.string.arg_RES_2131821618));
            hashMap.put("currentPage", "");
            openConfig.eventInfoV2 = hashMap;
            n0.M(RegisterFragment.this.c, openConfig);
        }
    };
    public ClickableSpan x = new ClickableSpan() {
        /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass2 */

        public void onClick(View view) {
            RegisterFragment registerFragment = RegisterFragment.this;
            int i2 = RegisterFragment.y;
            n0.f0(registerFragment.d);
        }
    };

    public static i newInstance(PageConfig pageConfig) {
        return i.G1(RegisterFragment.class, pageConfig);
    }

    /* JADX WARNING: Removed duplicated region for block: B:28:0x00cb  */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x00cf  */
    public void L1() {
        TextView textView;
        int i2;
        long currentTimeMillis = System.currentTimeMillis();
        boolean z = false;
        boolean z2 = currentTimeMillis - p1.b >= 500;
        p1.b = currentTimeMillis;
        if (z2) {
            final String obj = this.f2181g.getText().toString();
            String obj2 = this.f2182h.getText().toString();
            final String obj3 = this.f2183i.getText().toString();
            String obj4 = this.f2184j.getText().toString();
            AppCompatEditText appCompatEditText = null;
            this.f2181g.setError(null);
            this.f2182h.setError(null);
            this.f2183i.setError(null);
            this.f2184j.setError(null);
            if (TextUtils.isEmpty(obj)) {
                textView = this.f2185k;
                i2 = R.string.arg_RES_2131821973;
            } else {
                if (!(TextUtils.isEmpty(obj) ? false : !Pattern.compile("[`~!@#$%^&*()+=|{}':;',\\[\\]<>/?~!@#¥%……&*()+|{}【】‘;:”“’。,、 ?]").matcher(obj).find())) {
                    textView = this.f2185k;
                    i2 = R.string.arg_RES_2131821971;
                } else {
                    if (!c.G(obj2)) {
                        this.f2185k.setText(getString(R.string.arg_RES_2131821947));
                        appCompatEditText = this.f2182h;
                    } else if (!c.K(obj3)) {
                        this.f2185k.setText(getString(R.string.arg_RES_2131821977));
                        appCompatEditText = this.f2183i;
                    } else {
                        if (!obj3.equals(obj4)) {
                            this.f2185k.setText(getString(R.string.arg_RES_2131821942));
                            appCompatEditText = this.f2184j;
                        }
                        if (z) {
                            appCompatEditText.requestFocus();
                            return;
                        }
                        this.f2185k.setText("");
                        UserRequestProtos.RegisterRequest registerRequest = new UserRequestProtos.RegisterRequest();
                        UserInfoProtos.UserInfo userInfo = new UserInfoProtos.UserInfo();
                        userInfo.account = obj;
                        userInfo.email = obj2;
                        userInfo.password = obj3;
                        registerRequest.userInfo = userInfo;
                        registerRequest.deviceInfo = r.c();
                        String g2 = r.g(10);
                        String f2 = r.f("user/register", g2);
                        registerRequest.f2901k = g2;
                        byte[] byteArray = e.l.e.g1.d.toByteArray(registerRequest);
                        this.f2194t = ProgressDialog.show(this.d, getString(R.string.arg_RES_2131821184), getString(R.string.arg_RES_2131821184), true);
                        g0.a(this.d, "apkpure", "reg");
                        a.x0(this.d, byteArray, a.Q("user/register", f2), new o() {
                            /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass3 */

                            @Override // e.g.a.v.o
                            public void a(String str, String str2) {
                                RegisterFragment.this.u.post(new y3(this, str2));
                            }

                            @Override // e.g.a.v.o
                            public void b(ResultResponseProtos.ResponseWrapper responseWrapper) {
                                RegisterFragment.this.u.post(new x3(this, responseWrapper, obj, obj3));
                            }
                        });
                        return;
                    }
                    z = true;
                    if (z) {
                    }
                }
            }
            textView.setText(getString(i2));
            appCompatEditText = this.f2181g;
            z = true;
            if (z) {
            }
        }
    }

    public void onClick(View view) {
        AppCompatEditText appCompatEditText;
        int id = view.getId();
        if (id == R.id.arg_RES_2131298243) {
            L1();
        } else if (id != R.id.arg_RES_2131298887) {
            switch (id) {
                case R.id.arg_RES_2131298245 /*{ENCODED_INT: 2131298245}*/:
                    this.f2184j.setText("");
                    appCompatEditText = this.f2184j;
                    appCompatEditText.setSelected(false);
                    break;
                case R.id.arg_RES_2131298246 /*{ENCODED_INT: 2131298246}*/:
                    this.f2182h.setText("");
                    appCompatEditText = this.f2182h;
                    appCompatEditText.setSelected(false);
                    break;
                case R.id.arg_RES_2131298247 /*{ENCODED_INT: 2131298247}*/:
                    this.f2181g.setText("");
                    appCompatEditText = this.f2181g;
                    appCompatEditText.setSelected(false);
                    break;
                case R.id.arg_RES_2131298248 /*{ENCODED_INT: 2131298248}*/:
                    this.f2183i.setText("");
                    appCompatEditText = this.f2183i;
                    appCompatEditText.setSelected(false);
                    break;
            }
        } else {
            if (!this.f2193s) {
                this.f2183i.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                this.f2184j.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                this.f2186l.setSelected(true);
            } else {
                this.f2183i.setTransformationMethod(PasswordTransformationMethod.getInstance());
                this.f2184j.setTransformationMethod(PasswordTransformationMethod.getInstance());
                this.f2186l.setSelected(false);
            }
            this.f2193s = !this.f2193s;
            AppCompatEditText appCompatEditText2 = this.f2183i;
            appCompatEditText2.setSelection(appCompatEditText2.getText().length());
            AppCompatEditText appCompatEditText3 = this.f2184j;
            appCompatEditText3.setSelection(appCompatEditText3.getText().length());
            this.f2183i.postInvalidate();
            this.f2184j.postInvalidate();
        }
        b.C0315b.f12266a.s(view);
    }

    @Override // androidx.fragment.app.Fragment, e.g.a.t.b.i
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    @Override // androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        g0.o(this.c, LoginType.PROVIDER_REGISTER, null);
        this.u = new Handler(Looper.getMainLooper());
        View inflate = layoutInflater.inflate(R.layout.arg_RES_2131493186, viewGroup, false);
        this.f2181g = (AppCompatEditText) inflate.findViewById(R.id.arg_RES_2131298885);
        this.f2182h = (AppCompatEditText) inflate.findViewById(R.id.arg_RES_2131298846);
        this.f2183i = (AppCompatEditText) inflate.findViewById(R.id.arg_RES_2131298886);
        this.f2184j = (AppCompatEditText) inflate.findViewById(R.id.arg_RES_2131298830);
        this.f2186l = (ImageView) inflate.findViewById(R.id.arg_RES_2131298887);
        this.f2187m = (TextView) inflate.findViewById(R.id.arg_RES_2131298241);
        this.f2188n = (Button) inflate.findViewById(R.id.arg_RES_2131298243);
        this.f2189o = (ImageView) inflate.findViewById(R.id.arg_RES_2131298247);
        this.f2190p = (ImageView) inflate.findViewById(R.id.arg_RES_2131298246);
        this.f2191q = (ImageView) inflate.findViewById(R.id.arg_RES_2131298248);
        this.f2192r = (ImageView) inflate.findViewById(R.id.arg_RES_2131298245);
        this.f2185k = (TextView) inflate.findViewById(R.id.arg_RES_2131297181);
        this.f2187m.setMovementMethod(LinkMovementMethod.getInstance());
        String string = getString(R.string.arg_RES_2131821690);
        String string2 = getString(R.string.arg_RES_2131821689);
        String string3 = getString(R.string.arg_RES_2131821686);
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
        int indexOf = string.indexOf(string2);
        int indexOf2 = string.indexOf(string3);
        try {
            spannableStringBuilder.setSpan(this.w, indexOf, string2.length() + indexOf, 33);
            spannableStringBuilder.setSpan(this.x, indexOf2, string3.length() + indexOf2, 33);
        } catch (IndexOutOfBoundsException unused) {
        }
        this.f2187m.setText(spannableStringBuilder);
        l.b1(this, inflate);
        return inflate;
    }

    @Override // e.w.e.a.b.t.c.c, androidx.fragment.app.Fragment, e.g.a.t.b.i
    public void onResume() {
        super.onResume();
        this.f2188n.setOnClickListener(this);
        this.f2186l.setOnClickListener(this);
        this.f2189o.setOnClickListener(this);
        this.f2190p.setOnClickListener(this);
        this.f2191q.setOnClickListener(this);
        this.f2192r.setOnClickListener(this);
        this.f2181g.addTextChangedListener(new e.g.a.z.k.c() {
            /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass4 */

            public void afterTextChanged(Editable editable) {
                RegisterFragment.this.f2185k.setText("");
                RegisterFragment.this.f2189o.setVisibility(editable.length() > 0 ? 0 : 8);
            }
        });
        this.f2182h.addTextChangedListener(new e.g.a.z.k.c() {
            /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass5 */

            public void afterTextChanged(Editable editable) {
                RegisterFragment.this.f2185k.setText("");
                RegisterFragment.this.f2190p.setVisibility(editable.length() > 0 ? 0 : 8);
            }
        });
        this.f2183i.addTextChangedListener(new e.g.a.z.k.c() {
            /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass6 */

            public void afterTextChanged(Editable editable) {
                RegisterFragment.this.f2185k.setText("");
                RegisterFragment.this.f2191q.setVisibility(editable.length() > 0 ? 0 : 8);
            }
        });
        this.f2184j.addTextChangedListener(new e.g.a.z.k.c() {
            /* class com.apkpure.aegon.pages.RegisterFragment.AnonymousClass7 */

            public void afterTextChanged(Editable editable) {
                RegisterFragment.this.f2185k.setText("");
                RegisterFragment.this.f2192r.setVisibility(editable.length() > 0 ? 0 : 8);
                if (RegisterFragment.this.f2186l.getVisibility() == 8) {
                    RegisterFragment.this.f2186l.setVisibility(0);
                }
            }
        });
        g0.q(this.d, LoginType.PROVIDER_REGISTER, "RegisterFragment");
    }
}