盛康基办.apk(点击下载) / HloginActivity.java


package im.guobwnxjuc.ui.hui.login;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.util.Base64;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.blankj.utilcode.constant.CacheConstants;
import com.blankj.utilcode.constant.TimeConstants;
import com.coremedia.iso.boxes.TrackReferenceTypeBox;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
import com.king.zxing.util.LogUtils;
import im.guobwnxjuc.messenger.AndroidUtilities;
import im.guobwnxjuc.messenger.ApplicationLoader;
import im.guobwnxjuc.messenger.BuildVars;
import im.guobwnxjuc.messenger.ContactsController;
import im.guobwnxjuc.messenger.FileLog;
import im.guobwnxjuc.messenger.ImageLocation;
import im.guobwnxjuc.messenger.LocaleController;
import im.guobwnxjuc.messenger.MessageObject;
import im.guobwnxjuc.messenger.MessagesController;
import im.guobwnxjuc.messenger.MessagesStorage;
import im.guobwnxjuc.messenger.NotificationCenter;
import im.guobwnxjuc.messenger.R;
import im.guobwnxjuc.messenger.SRPHelper;
import im.guobwnxjuc.messenger.SendMessagesHelper;
import im.guobwnxjuc.messenger.UserConfig;
import im.guobwnxjuc.messenger.Utilities;
import im.guobwnxjuc.messenger.utils.DrawableUtils;
import im.guobwnxjuc.phoneformat.PhoneFormat;
import im.guobwnxjuc.tgnet.ConnectionsManager;
import im.guobwnxjuc.tgnet.RequestDelegate;
import im.guobwnxjuc.tgnet.SerializedData;
import im.guobwnxjuc.tgnet.TLObject;
import im.guobwnxjuc.tgnet.TLRPC;
import im.guobwnxjuc.ui.CountrySelectActivity;
import im.guobwnxjuc.ui.ExternalActionActivity;
import im.guobwnxjuc.ui.IndexActivity;
import im.guobwnxjuc.ui.LaunchActivity;
import im.guobwnxjuc.ui.TwoStepVerificationActivity;
import im.guobwnxjuc.ui.actionbar.ActionBar;
import im.guobwnxjuc.ui.actionbar.ActionBarMenu;
import im.guobwnxjuc.ui.actionbar.ActionBarMenuItem;
import im.guobwnxjuc.ui.actionbar.AlertDialog;
import im.guobwnxjuc.ui.actionbar.BaseFragment;
import im.guobwnxjuc.ui.actionbar.Theme;
import im.guobwnxjuc.ui.actionbar.ThemeDescription;
import im.guobwnxjuc.ui.cells.CheckBoxCell;
import im.guobwnxjuc.ui.components.AlertsCreator;
import im.guobwnxjuc.ui.components.AvatarDrawable;
import im.guobwnxjuc.ui.components.BackupImageView;
import im.guobwnxjuc.ui.components.ContextProgressView;
import im.guobwnxjuc.ui.components.EditTextBoldCursor;
import im.guobwnxjuc.ui.components.HintEditText;
import im.guobwnxjuc.ui.components.ImageUpdater;
import im.guobwnxjuc.ui.components.LayoutHelper;
import im.guobwnxjuc.ui.components.RadialProgressView;
import im.guobwnxjuc.ui.components.SlideView;
import im.guobwnxjuc.ui.components.toast.ToastUtils;
import im.guobwnxjuc.ui.hui.login.HloginActivity;
import im.guobwnxjuc.ui.hviews.dialogs.XDialog;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.text.Typography;
import org.slf4j.Marker;

@Deprecated
public class HloginActivity extends BaseFragment {
    private static final int done_button = 1;
    private boolean checkPermissions;
    private boolean checkShowPermissions;
    private TLRPC.TL_help_termsOfService currentTermsOfService;
    private int currentViewNum;
    private ActionBarMenuItem doneItem;
    private AnimatorSet doneItemAnimation;
    private ContextProgressView doneProgressView;
    private boolean newAccount;
    private Dialog permissionsDialog;
    private ArrayList<String> permissionsItems;
    private Dialog permissionsShowDialog;
    private ArrayList<String> permissionsShowItems;
    private int progressRequestId;
    private int scrollHeight;
    private boolean syncContacts;
    private SlideView[] views;

    /* access modifiers changed from: private */
    public class ProgressView extends View {
        private Paint paint = new Paint();
        private Paint paint2 = new Paint();
        private float progress;

        public ProgressView(Context context) {
            super(context);
            this.paint.setColor(Theme.getColor(Theme.key_login_progressInner));
            this.paint2.setColor(Theme.getColor(Theme.key_login_progressOuter));
        }

        public void setProgress(float f) {
            this.progress = f;
            invalidate();
        }

        /* access modifiers changed from: protected */
        public void onDraw(Canvas canvas) {
            float measuredWidth = (float) ((int) (((float) getMeasuredWidth()) * this.progress));
            canvas.drawRect(0.0f, 0.0f, measuredWidth, (float) getMeasuredHeight(), this.paint2);
            canvas.drawRect(measuredWidth, 0.0f, (float) getMeasuredWidth(), (float) getMeasuredHeight(), this.paint);
        }
    }

    public HloginActivity() {
        this.views = new SlideView[9];
        this.permissionsItems = new ArrayList<>();
        this.permissionsShowItems = new ArrayList<>();
        this.checkPermissions = true;
        this.checkShowPermissions = true;
        this.syncContacts = true;
    }

    public HloginActivity(int i) {
        this.views = new SlideView[9];
        this.permissionsItems = new ArrayList<>();
        this.permissionsShowItems = new ArrayList<>();
        this.checkPermissions = true;
        this.checkShowPermissions = true;
        this.syncContacts = true;
        this.currentAccount = i;
        this.newAccount = true;
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onFragmentDestroy() {
        super.onFragmentDestroy();
        int i = 0;
        while (true) {
            SlideView[] slideViewArr = this.views;
            if (i < slideViewArr.length) {
                if (slideViewArr[i] != null) {
                    slideViewArr[i].onDestroyActivity();
                }
                i++;
            } else {
                return;
            }
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public View createView(Context context) {
        this.actionBar.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
        this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
            /* class im.guobwnxjuc.ui.hui.login.HloginActivity.AnonymousClass1 */

            @Override // im.guobwnxjuc.ui.actionbar.ActionBar.ActionBarMenuOnItemClick
            public void onItemClick(int i) {
                if (i == 1) {
                    if (HloginActivity.this.doneProgressView.getTag() == null) {
                        HloginActivity.this.views[HloginActivity.this.currentViewNum].onNextPressed();
                    } else if (HloginActivity.this.getParentActivity() != null) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                        builder.setMessage(LocaleController.getString("StopLoading", R.string.StopLoading));
                        builder.setPositiveButton(LocaleController.getString("WaitMore", R.string.WaitMore), null);
                        builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                            /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$1$xj6j0clIHFrB0g0U_bLiIMoWw2Y */

                            public final void onClick(DialogInterface dialogInterface, int i) {
                                HloginActivity.AnonymousClass1.this.lambda$onItemClick$0$HloginActivity$1(dialogInterface, i);
                            }
                        });
                        HloginActivity.this.showDialog(builder.create());
                    }
                } else if (i == -1 && HloginActivity.this.onBackPressed()) {
                    HloginActivity.this.finishFragment();
                }
            }

            public /* synthetic */ void lambda$onItemClick$0$HloginActivity$1(DialogInterface dialogInterface, int i) {
                HloginActivity.this.views[HloginActivity.this.currentViewNum].onCancelPressed();
                HloginActivity.this.needHideProgress(true);
            }
        });
        ActionBarMenu createMenu = this.actionBar.createMenu();
        this.actionBar.setBackButtonDrawable(DrawableUtils.tintDrawable(getParentActivity().getResources().getDrawable(R.mipmap.ic_login_back).mutate(), Theme.getColor(Theme.key_actionBarDefaultIcon)));
        this.actionBar.setCastShadows(false);
        this.doneItem = createMenu.addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56.0f));
        ContextProgressView contextProgressView = new ContextProgressView(context, 1);
        this.doneProgressView = contextProgressView;
        contextProgressView.setAlpha(0.0f);
        this.doneProgressView.setScaleX(0.1f);
        this.doneProgressView.setScaleY(0.1f);
        this.doneProgressView.setVisibility(4);
        this.doneItem.addView(this.doneProgressView, LayoutHelper.createFrame(-1, -1.0f));
        this.doneItem.setContentDescription(LocaleController.getString("Done", R.string.Done));
        AnonymousClass2 r2 = new ScrollView(context) {
            /* class im.guobwnxjuc.ui.hui.login.HloginActivity.AnonymousClass2 */

            public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
                if (HloginActivity.this.currentViewNum == 1 || HloginActivity.this.currentViewNum == 2 || HloginActivity.this.currentViewNum == 4) {
                    rect.bottom += AndroidUtilities.dp(40.0f);
                }
                return super.requestChildRectangleOnScreen(view, rect, z);
            }

            /* access modifiers changed from: protected */
            public void onMeasure(int i, int i2) {
                HloginActivity.this.scrollHeight = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
                super.onMeasure(i, i2);
            }
        };
        r2.setFillViewport(true);
        this.fragmentView = r2;
        FrameLayout frameLayout = new FrameLayout(context);
        r2.addView(frameLayout, LayoutHelper.createScroll(-1, -2, 51));
        this.views[0] = new PhoneView(context);
        this.views[1] = new LoginActivitySmsView(context, 1);
        this.views[2] = new LoginActivitySmsView(context, 2);
        this.views[3] = new LoginActivitySmsView(context, 3);
        this.views[4] = new LoginActivitySmsView(context, 4);
        this.views[5] = new LoginActivityRegisterView(context);
        this.views[6] = new LoginActivityPasswordView(context);
        this.views[7] = new LoginActivityRecoverView(context);
        this.views[8] = new LoginActivityResetWaitView(context);
        int i = 0;
        while (true) {
            SlideView[] slideViewArr = this.views;
            if (i >= slideViewArr.length) {
                break;
            }
            slideViewArr[i].setVisibility(i == 0 ? 0 : 8);
            SlideView slideView = this.views[i];
            float f = 18.0f;
            float f2 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
            if (AndroidUtilities.isTablet()) {
                f = 26.0f;
            }
            frameLayout.addView(slideView, LayoutHelper.createFrame(-1.0f, -1.0f, 51, f2, 30.0f, f, 0.0f));
            i++;
        }
        Bundle loadCurrentState = loadCurrentState();
        if (loadCurrentState != null) {
            this.currentViewNum = loadCurrentState.getInt("currentViewNum", 0);
            this.syncContacts = loadCurrentState.getInt("syncContacts", 1) == 1;
            int i2 = this.currentViewNum;
            if (i2 >= 1 && i2 <= 4) {
                int i3 = loadCurrentState.getInt("open");
                if (i3 != 0 && Math.abs((System.currentTimeMillis() / 1000) - ((long) i3)) >= 86400) {
                    this.currentViewNum = 0;
                    clearCurrentState();
                }
            } else if (this.currentViewNum == 6) {
                LoginActivityPasswordView loginActivityPasswordView = (LoginActivityPasswordView) this.views[6];
                if (loginActivityPasswordView.passwordType == 0 || loginActivityPasswordView.current_salt1 == null || loginActivityPasswordView.current_salt2 == null) {
                    this.currentViewNum = 0;
                    clearCurrentState();
                }
            }
            loadCurrentState = null;
        }
        int i4 = 0;
        while (true) {
            SlideView[] slideViewArr2 = this.views;
            if (i4 >= slideViewArr2.length) {
                return this.fragmentView;
            }
            if (loadCurrentState != null) {
                if (i4 < 1 || i4 > 4) {
                    this.views[i4].restoreStateParams(loadCurrentState);
                } else if (i4 == this.currentViewNum) {
                    slideViewArr2[i4].restoreStateParams(loadCurrentState);
                }
            }
            if (this.currentViewNum == i4) {
                this.views[i4].setVisibility(0);
                this.views[i4].onShow();
                if (i4 == 3 || i4 == 8) {
                    this.doneItem.setVisibility(8);
                }
            } else {
                this.views[i4].setVisibility(8);
            }
            i4++;
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onPause() {
        super.onPause();
        AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid);
        if (this.newAccount) {
            ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onResume() {
        int i;
        super.onResume();
        if (this.newAccount) {
            ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
        }
        AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
        try {
            if (this.currentViewNum >= 1 && this.currentViewNum <= 4 && (this.views[this.currentViewNum] instanceof LoginActivitySmsView) && (i = ((LoginActivitySmsView) this.views[this.currentViewNum]).openTime) != 0 && Math.abs((System.currentTimeMillis() / 1000) - ((long) i)) >= 86400) {
                this.views[this.currentViewNum].onBackPressed(true);
                setPage(0, false, null, true);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) {
        if (i == 6) {
            this.checkPermissions = false;
            int i2 = this.currentViewNum;
            if (i2 == 0) {
                this.views[i2].onNextPressed();
            }
        } else if (i == 7) {
            this.checkShowPermissions = false;
            int i3 = this.currentViewNum;
            if (i3 == 0) {
                ((PhoneView) this.views[i3]).fillNumber();
            }
        }
    }

    private Bundle loadCurrentState() {
        if (this.newAccount) {
            return null;
        }
        try {
            Bundle bundle = new Bundle();
            for (Map.Entry<String, ?> entry : ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).getAll().entrySet()) {
                String key = entry.getKey();
                Object value = entry.getValue();
                String[] split = key.split("_\\|_");
                if (split.length == 1) {
                    if (value instanceof String) {
                        bundle.putString(key, (String) value);
                    } else if (value instanceof Integer) {
                        bundle.putInt(key, ((Integer) value).intValue());
                    }
                } else if (split.length == 2) {
                    Bundle bundle2 = bundle.getBundle(split[0]);
                    if (bundle2 == null) {
                        bundle2 = new Bundle();
                        bundle.putBundle(split[0], bundle2);
                    }
                    if (value instanceof String) {
                        bundle2.putString(split[1], (String) value);
                    } else if (value instanceof Integer) {
                        bundle2.putInt(split[1], ((Integer) value).intValue());
                    }
                }
            }
            return bundle;
        } catch (Exception e) {
            FileLog.e(e);
            return null;
        }
    }

    private void clearCurrentState() {
        SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).edit();
        edit.clear();
        edit.commit();
    }

    private void putBundleToEditor(Bundle bundle, SharedPreferences.Editor editor, String str) {
        for (String str2 : bundle.keySet()) {
            Object obj = bundle.get(str2);
            if (obj instanceof String) {
                if (str != null) {
                    editor.putString(str + "_|_" + str2, (String) obj);
                } else {
                    editor.putString(str2, (String) obj);
                }
            } else if (obj instanceof Integer) {
                if (str != null) {
                    editor.putInt(str + "_|_" + str2, ((Integer) obj).intValue());
                } else {
                    editor.putInt(str2, ((Integer) obj).intValue());
                }
            } else if (obj instanceof Bundle) {
                putBundleToEditor((Bundle) obj, editor, str2);
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onDialogDismiss(Dialog dialog) {
        if (Build.VERSION.SDK_INT < 23) {
            return;
        }
        if (dialog == this.permissionsDialog && !this.permissionsItems.isEmpty() && getParentActivity() != null) {
            try {
                getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
            } catch (Exception unused) {
            }
        } else if (dialog == this.permissionsShowDialog && !this.permissionsShowItems.isEmpty() && getParentActivity() != null) {
            getParentActivity().requestPermissions((String[]) this.permissionsShowItems.toArray(new String[0]), 7);
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public boolean onBackPressed() {
        int i = this.currentViewNum;
        int i2 = 0;
        if (i == 0) {
            while (true) {
                SlideView[] slideViewArr = this.views;
                if (i2 < slideViewArr.length) {
                    if (slideViewArr[i2] != null) {
                        slideViewArr[i2].onDestroyActivity();
                    }
                    i2++;
                } else {
                    clearCurrentState();
                    return true;
                }
            }
        } else {
            if (i == 6) {
                this.views[i].onBackPressed(true);
                setPage(0, true, null, true);
            } else if (i == 7 || i == 8) {
                this.views[this.currentViewNum].onBackPressed(true);
                setPage(6, true, null, true);
            } else if (i < 1 || i > 4) {
                int i3 = this.currentViewNum;
                if (i3 == 5) {
                    ((LoginActivityRegisterView) this.views[i3]).wrongNumber.callOnClick();
                }
            } else if (this.views[i].onBackPressed(false)) {
                setPage(0, true, null, true);
            }
            return false;
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void onActivityResultFragment(int i, int i2, Intent intent) {
        LoginActivityRegisterView loginActivityRegisterView = (LoginActivityRegisterView) this.views[5];
        if (loginActivityRegisterView != null) {
            loginActivityRegisterView.imageUpdater.onActivityResult(i, i2, intent);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void needShowAlert(String str, String str2) {
        if (str2 != null && getParentActivity() != null) {
            XDialog.Builder builder = new XDialog.Builder(getParentActivity());
            builder.setTitle(str);
            builder.setMessage(str2);
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            showDialog(builder.create());
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void needShowInvalidAlert(String str, boolean z) {
        if (getParentActivity() != null) {
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
            if (z) {
                builder.setMessage(LocaleController.getString("BannedPhoneNumber", R.string.BannedPhoneNumber));
            } else {
                builder.setMessage(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
            }
            builder.setNeutralButton(LocaleController.getString("BotHelp", R.string.BotHelp), new DialogInterface.OnClickListener(z, str) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$8yWC1vyLbYj_um0cYcjnxZTRH0 */
                private final /* synthetic */ boolean f$1;
                private final /* synthetic */ String f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void onClick(DialogInterface dialogInterface, int i) {
                    HloginActivity.this.lambda$needShowInvalidAlert$0$HloginActivity(this.f$1, this.f$2, dialogInterface, i);
                }
            });
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
            showDialog(builder.create());
        }
    }

    public /* synthetic */ void lambda$needShowInvalidAlert$0$HloginActivity(boolean z, String str, DialogInterface dialogInterface, int i) {
        try {
            PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
            String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
            Intent intent = new Intent("android.intent.action.SEND");
            intent.setType("message/rfc822");
            intent.putExtra("android.intent.extra.EMAIL", new String[]{"login@stel.com"});
            if (z) {
                intent.putExtra("android.intent.extra.SUBJECT", "Banned phone number: " + str);
                intent.putExtra("android.intent.extra.TEXT", "I'm trying to use my mobile phone number: " + str + "\nBut App says it's banned. Please help.\n\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault());
            } else {
                intent.putExtra("android.intent.extra.SUBJECT", "Invalid phone number: " + str);
                intent.putExtra("android.intent.extra.TEXT", "I'm trying to use my mobile phone number: " + str + "\nBut App says it's invalid. Please help.\n\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault());
            }
            getParentActivity().startActivity(Intent.createChooser(intent, "Send email..."));
        } catch (Exception unused) {
            needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
        }
    }

    private void showEditDoneProgress(final boolean z) {
        AnimatorSet animatorSet = this.doneItemAnimation;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        this.doneItemAnimation = new AnimatorSet();
        if (z) {
            this.doneProgressView.setTag(1);
            this.doneProgressView.setVisibility(0);
            this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneProgressView, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneProgressView, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneProgressView, View.ALPHA, 1.0f));
        } else {
            this.doneProgressView.setTag(null);
            this.doneItem.getContentView().setVisibility(0);
            this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneProgressView, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneProgressView, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneProgressView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), View.ALPHA, 1.0f));
        }
        this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
            /* class im.guobwnxjuc.ui.hui.login.HloginActivity.AnonymousClass3 */

            public void onAnimationEnd(Animator animator) {
                if (HloginActivity.this.doneItemAnimation != null && HloginActivity.this.doneItemAnimation.equals(animator)) {
                    if (!z) {
                        HloginActivity.this.doneProgressView.setVisibility(4);
                    } else {
                        HloginActivity.this.doneItem.getContentView().setVisibility(4);
                    }
                }
            }

            public void onAnimationCancel(Animator animator) {
                if (HloginActivity.this.doneItemAnimation != null && HloginActivity.this.doneItemAnimation.equals(animator)) {
                    HloginActivity.this.doneItemAnimation = null;
                }
            }
        });
        this.doneItemAnimation.setDuration(150L);
        this.doneItemAnimation.start();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void needShowProgress(int i) {
        this.progressRequestId = i;
        showEditDoneProgress(true);
    }

    public void needHideProgress(boolean z) {
        if (this.progressRequestId != 0) {
            if (z) {
                ConnectionsManager.getInstance(this.currentAccount).cancelRequest(this.progressRequestId, true);
            }
            this.progressRequestId = 0;
        }
        showEditDoneProgress(false);
    }

    public void setPage(int i, boolean z, Bundle bundle, boolean z2) {
        if (i == 3 || i == 8) {
            this.doneItem.setVisibility(8);
        } else {
            if (i == 0) {
                this.checkPermissions = true;
                this.checkShowPermissions = true;
            }
            this.doneItem.setVisibility(0);
        }
        int i2 = this.currentViewNum;
        if (i2 == i) {
            this.views[i2].setParams(bundle, false);
        } else if (z) {
            SlideView[] slideViewArr = this.views;
            final SlideView slideView = slideViewArr[i2];
            SlideView slideView2 = slideViewArr[i];
            this.currentViewNum = i;
            slideView2.setParams(bundle, false);
            setParentActivityTitle(slideView2.getHeaderName());
            slideView2.onShow();
            int i3 = AndroidUtilities.displaySize.x;
            if (z2) {
                i3 = -i3;
            }
            slideView2.setX((float) i3);
            slideView2.setVisibility(0);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.addListener(new AnimatorListenerAdapter() {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.AnonymousClass4 */

                public void onAnimationEnd(Animator animator) {
                    slideView.setVisibility(8);
                    slideView.setX(0.0f);
                }
            });
            Animator[] animatorArr = new Animator[2];
            Property property = View.TRANSLATION_X;
            float[] fArr = new float[1];
            fArr[0] = (float) (z2 ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x);
            animatorArr[0] = ObjectAnimator.ofFloat(slideView, property, fArr);
            animatorArr[1] = ObjectAnimator.ofFloat(slideView2, View.TRANSLATION_X, 0.0f);
            animatorSet.playTogether(animatorArr);
            animatorSet.setDuration(300L);
            animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
            animatorSet.start();
        } else {
            this.actionBar.setBackButtonImage((this.views[i].needBackButton() || this.newAccount) ? R.mipmap.ic_back : 0);
            this.views[this.currentViewNum].setVisibility(8);
            this.currentViewNum = i;
            this.views[i].setParams(bundle, false);
            this.views[i].setVisibility(0);
            setParentActivityTitle(this.views[i].getHeaderName());
            this.views[i].onShow();
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public void saveSelfArgs(Bundle bundle) {
        try {
            Bundle bundle2 = new Bundle();
            bundle2.putInt("currentViewNum", this.currentViewNum);
            bundle2.putInt("syncContacts", this.syncContacts ? 1 : 0);
            for (int i = 0; i <= this.currentViewNum; i++) {
                SlideView slideView = this.views[i];
                if (slideView != null) {
                    slideView.saveStateParams(bundle2);
                }
            }
            SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).edit();
            edit.clear();
            putBundleToEditor(bundle2, edit, null);
            edit.commit();
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    private void needFinishActivity() {
        clearCurrentState();
        if (getParentActivity() instanceof LaunchActivity) {
            if (this.newAccount) {
                this.newAccount = false;
                ((LaunchActivity) getParentActivity()).switchToAccount(this.currentAccount, true);
                finishFragment();
                return;
            }
            presentFragment(new IndexActivity(), true);
            NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
        } else if (getParentActivity() instanceof ExternalActionActivity) {
            ((ExternalActionActivity) getParentActivity()).onFinishLogin();
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void onAuthSuccess(TLRPC.TL_auth_authorization tL_auth_authorization) {
        ConnectionsManager.getInstance(this.currentAccount).setUserId(tL_auth_authorization.user.id);
        UserConfig.getInstance(this.currentAccount).clearConfig();
        MessagesController.getInstance(this.currentAccount).cleanup();
        UserConfig.getInstance(this.currentAccount).syncContacts = this.syncContacts;
        UserConfig.getInstance(this.currentAccount).setCurrentUser(tL_auth_authorization.user);
        UserConfig.getInstance(this.currentAccount).saveConfig(true);
        MessagesStorage.getInstance(this.currentAccount).cleanup(true);
        ArrayList<TLRPC.User> arrayList = new ArrayList<>();
        arrayList.add(tL_auth_authorization.user);
        MessagesStorage.getInstance(this.currentAccount).putUsersAndChats(arrayList, null, true, true);
        MessagesController.getInstance(this.currentAccount).putUser(tL_auth_authorization.user, false);
        ContactsController.getInstance(this.currentAccount).checkAppAccount();
        MessagesController.getInstance(this.currentAccount).checkProxyInfo(true);
        ConnectionsManager.getInstance(this.currentAccount).updateDcSettings();
        needFinishActivity();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void fillNextCodeParams(Bundle bundle, TLRPC.TL_auth_sentCode tL_auth_sentCode) {
        bundle.putString("phoneHash", tL_auth_sentCode.phone_code_hash);
        if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeCall) {
            bundle.putInt("nextType", 4);
        } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) {
            bundle.putInt("nextType", 3);
        } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeSms) {
            bundle.putInt("nextType", 2);
        }
        if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeApp) {
            bundle.putInt("type", 1);
            bundle.putInt("length", tL_auth_sentCode.type.length);
            setPage(1, true, bundle, false);
            return;
        }
        if (tL_auth_sentCode.timeout == 0) {
            tL_auth_sentCode.timeout = 60;
        }
        bundle.putInt("timeout", tL_auth_sentCode.timeout * 1000);
        if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeCall) {
            bundle.putInt("type", 4);
            bundle.putInt("length", tL_auth_sentCode.type.length);
            setPage(4, true, bundle, false);
        } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
            bundle.putInt("type", 3);
            bundle.putString("pattern", tL_auth_sentCode.type.pattern);
            setPage(3, true, bundle, false);
        } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeSms) {
            bundle.putInt("type", 2);
            bundle.putInt("length", tL_auth_sentCode.type.length);
            setPage(2, true, bundle, false);
        }
    }

    public class PhoneView extends SlideView implements AdapterView.OnItemSelectedListener {
        private CheckBoxCell checkBoxCell;
        private EditTextBoldCursor codeField;
        private HashMap<String, String> codesMap = new HashMap<>();
        private ArrayList<String> countriesArray = new ArrayList<>();
        private HashMap<String, String> countriesMap = new HashMap<>();
        private TextView countryButton;
        private int countryState = 0;
        private boolean ignoreOnPhoneChange = false;
        private boolean ignoreOnTextChange = false;
        private boolean ignoreSelection = false;
        private boolean nextPressed = false;
        private HintEditText phoneField;
        private HashMap<String, String> phoneFormatMap = new HashMap<>();
        private TextView textView;
        private TextView textView2;
        private View view;

        public void fillNumber() {
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onNothingSelected(AdapterView<?> adapterView) {
        }

        public PhoneView(Context context) {
            super(context);
            setOrientation(1);
            TextView textView3 = new TextView(context);
            addView(textView3, LayoutHelper.createLinear(-1, -2, 0.0f, 42.0f, 0.0f, 14.0f));
            textView3.setText(LocaleController.getString("Login", R.string.Login));
            textView3.setGravity(17);
            textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            textView3.setTextSize(24.0f);
            TextView textView4 = new TextView(context);
            addView(textView4, LayoutHelper.createLinear(-1, -2, 0.0f, 12.5f, 0.0f, 0.0f));
            textView4.setText(LocaleController.getString("StartText", R.string.StartText));
            textView4.setGravity(17);
            textView4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText));
            textView4.setTextSize(14.0f);
            View view2 = new View(context);
            this.view = view2;
            view2.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), 0);
            this.view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            addView(this.view, LayoutHelper.createLinear(-1.0f, 0.5f, 0.0f, 44.0f, 0.0f, 0.0f));
            TextView textView5 = new TextView(context);
            this.countryButton = textView5;
            textView5.setTextSize(1, 18.0f);
            this.countryButton.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), 0);
            this.countryButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.countryButton.setMaxLines(1);
            this.countryButton.setSingleLine(true);
            this.countryButton.setEllipsize(TextUtils.TruncateAt.END);
            this.countryButton.setGravity(19);
            this.countryButton.setBackgroundResource(R.drawable.spinner_states);
            addView(this.countryButton, LayoutHelper.createLinear(-1, 48, 0.0f, 0.0f, 0.0f, 0.0f));
            this.countryButton.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$Qb3yEQR10cxKBdg67pepWpdmVz4 */

                public final void onClick(View view) {
                    HloginActivity.PhoneView.this.lambda$new$2$HloginActivity$PhoneView(view);
                }
            });
            View view3 = new View(context);
            this.view = view3;
            view3.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            addView(this.view, LayoutHelper.createLinear(-1.0f, 0.5f));
            LinearLayout linearLayout = new LinearLayout(context);
            linearLayout.setOrientation(0);
            addView(linearLayout, LayoutHelper.createLinear(-1, 58, 0.0f, 0.0f, 0.0f, 0.0f));
            ImageView imageView = new ImageView(context);
            Drawable tintDrawable = DrawableUtils.tintDrawable(HloginActivity.this.getParentActivity().getResources().getDrawable(R.mipmap.icon_phone).mutate(), Theme.getColor(Theme.key_actionBarDefaultIcon));
            linearLayout.addView(imageView, LayoutHelper.createLinear(-2, -1, 5.0f, 0.0f, 0.0f, 0.0f));
            imageView.setImageDrawable(tintDrawable);
            TextView textView6 = new TextView(context);
            this.textView = textView6;
            textView6.setText(Marker.ANY_NON_NULL_MARKER);
            this.textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.textView.setTextSize(1, 18.0f);
            this.textView.setGravity(16);
            linearLayout.addView(this.textView, LayoutHelper.createLinear(-2, -1, 14.0f, 0.0f, 0.0f, 0.0f));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.codeField = editTextBoldCursor;
            editTextBoldCursor.setInputType(3);
            this.codeField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setBackground(null);
            this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.codeField.setCursorWidth(1.5f);
            this.codeField.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
            this.codeField.setTextSize(1, 18.0f);
            this.codeField.setMaxLines(1);
            this.codeField.setGravity(19);
            this.codeField.setImeOptions(268435461);
            this.codeField.setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)});
            linearLayout.addView(this.codeField, LayoutHelper.createLinear(46, -1, 0.0f, 0.0f, 0.0f, 0.0f));
            this.codeField.addTextChangedListener(new TextWatcher(HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.PhoneView.AnonymousClass1 */

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void afterTextChanged(Editable editable) {
                    boolean z;
                    String str;
                    if (!PhoneView.this.ignoreOnTextChange) {
                        PhoneView.this.ignoreOnTextChange = true;
                        String stripExceptNumbers = PhoneFormat.stripExceptNumbers(PhoneView.this.codeField.getText().toString());
                        PhoneView.this.codeField.setText(stripExceptNumbers);
                        String str2 = null;
                        if (stripExceptNumbers.length() == 0) {
                            PhoneView.this.countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                            PhoneView.this.phoneField.setHintText((String) null);
                            PhoneView.this.countryState = 1;
                        } else {
                            int i = 4;
                            if (stripExceptNumbers.length() > 4) {
                                while (true) {
                                    if (i < 1) {
                                        str = null;
                                        z = false;
                                        break;
                                    }
                                    String substring = stripExceptNumbers.substring(0, i);
                                    if (((String) PhoneView.this.codesMap.get(substring)) != null) {
                                        String str3 = stripExceptNumbers.substring(i) + PhoneView.this.phoneField.getText().toString();
                                        PhoneView.this.codeField.setText(substring);
                                        z = true;
                                        str = str3;
                                        stripExceptNumbers = substring;
                                        break;
                                    }
                                    i--;
                                }
                                if (!z) {
                                    str = stripExceptNumbers.substring(1) + PhoneView.this.phoneField.getText().toString();
                                    EditTextBoldCursor editTextBoldCursor = PhoneView.this.codeField;
                                    stripExceptNumbers = stripExceptNumbers.substring(0, 1);
                                    editTextBoldCursor.setText(stripExceptNumbers);
                                }
                            } else {
                                str = null;
                                z = false;
                            }
                            String str4 = (String) PhoneView.this.codesMap.get(stripExceptNumbers);
                            if (str4 != null) {
                                int indexOf = PhoneView.this.countriesArray.indexOf(str4);
                                if (indexOf != -1) {
                                    PhoneView.this.ignoreSelection = true;
                                    PhoneView.this.countryButton.setText((CharSequence) PhoneView.this.countriesArray.get(indexOf));
                                    String str5 = (String) PhoneView.this.phoneFormatMap.get(stripExceptNumbers);
                                    HintEditText hintEditText = PhoneView.this.phoneField;
                                    if (str5 != null) {
                                        str2 = str5.replace('X', Typography.ndash);
                                    }
                                    hintEditText.setHintText(str2);
                                    PhoneView.this.countryState = 0;
                                } else {
                                    PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
                                    PhoneView.this.phoneField.setHintText((String) null);
                                    PhoneView.this.countryState = 2;
                                }
                            } else {
                                PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
                                PhoneView.this.phoneField.setHintText((String) null);
                                PhoneView.this.countryState = 2;
                            }
                            if (!z) {
                                PhoneView.this.codeField.setSelection(PhoneView.this.codeField.getText().length());
                            }
                            if (str != null) {
                                PhoneView.this.phoneField.requestFocus();
                                PhoneView.this.phoneField.setText(str);
                                PhoneView.this.phoneField.setSelection(PhoneView.this.phoneField.length());
                            }
                        }
                        PhoneView.this.ignoreOnTextChange = false;
                    }
                }
            });
            this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$3ImCqYIN1NkDk4R_19h03gY5FHo */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.PhoneView.this.lambda$new$3$HloginActivity$PhoneView(textView, i, keyEvent);
                }
            });
            View view4 = new View(context);
            this.view = view4;
            view4.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            linearLayout.addView(this.view, LayoutHelper.createLinear(0.5f, 32.0f, 16, 16.0f, 0.0f, 16.0f, 0.0f));
            AnonymousClass2 r6 = new HintEditText(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.PhoneView.AnonymousClass2 */

                public boolean onTouchEvent(MotionEvent motionEvent) {
                    if (motionEvent.getAction() == 0 && !AndroidUtilities.showKeyboard(this)) {
                        clearFocus();
                        requestFocus();
                    }
                    return super.onTouchEvent(motionEvent);
                }
            };
            this.phoneField = r6;
            r6.setInputType(3);
            this.phoneField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.phoneField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.phoneField.setBackground(null);
            this.phoneField.setPadding(0, 0, 0, 0);
            this.phoneField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.phoneField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.phoneField.setCursorWidth(1.5f);
            this.phoneField.setTextSize(1, 18.0f);
            this.phoneField.setMaxLines(1);
            this.phoneField.setGravity(19);
            this.phoneField.setImeOptions(268435461);
            linearLayout.addView(this.phoneField, LayoutHelper.createFrame(-1, -1.0f));
            this.phoneField.addTextChangedListener(new TextWatcher(HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.PhoneView.AnonymousClass3 */
                private int actionPosition;
                private int characterAction = -1;

                public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                }

                public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                    if (i2 == 0 && i3 == 1) {
                        this.characterAction = 1;
                    } else if (i2 != 1 || i3 != 0) {
                        this.characterAction = -1;
                    } else if (charSequence.charAt(i) != ' ' || i <= 0) {
                        this.characterAction = 2;
                    } else {
                        this.characterAction = 3;
                        this.actionPosition = i - 1;
                    }
                }

                public void afterTextChanged(Editable editable) {
                    int i;
                    int i2;
                    if (!PhoneView.this.ignoreOnPhoneChange) {
                        int selectionStart = PhoneView.this.phoneField.getSelectionStart();
                        String obj = PhoneView.this.phoneField.getText().toString();
                        if (this.characterAction == 3) {
                            obj = obj.substring(0, this.actionPosition) + obj.substring(this.actionPosition + 1);
                            selectionStart--;
                        }
                        StringBuilder sb = new StringBuilder(obj.length());
                        int i3 = 0;
                        while (i3 < obj.length()) {
                            int i4 = i3 + 1;
                            String substring = obj.substring(i3, i4);
                            if ("0123456789".contains(substring)) {
                                sb.append(substring);
                            }
                            i3 = i4;
                        }
                        PhoneView.this.ignoreOnPhoneChange = true;
                        String hintText = PhoneView.this.phoneField.getHintText();
                        if (hintText != null) {
                            int i5 = 0;
                            while (true) {
                                if (i5 >= sb.length()) {
                                    break;
                                } else if (i5 < hintText.length()) {
                                    if (hintText.charAt(i5) == ' ') {
                                        sb.insert(i5, ' ');
                                        i5++;
                                        if (!(selectionStart != i5 || (i2 = this.characterAction) == 2 || i2 == 3)) {
                                            selectionStart++;
                                        }
                                    }
                                    i5++;
                                } else {
                                    sb.insert(i5, ' ');
                                    if (selectionStart == i5 + 1 && (i = this.characterAction) != 2 && i != 3) {
                                        selectionStart++;
                                    }
                                }
                            }
                        }
                        editable.replace(0, editable.length(), sb);
                        if (selectionStart >= 0) {
                            HintEditText hintEditText = PhoneView.this.phoneField;
                            if (selectionStart > PhoneView.this.phoneField.length()) {
                                selectionStart = PhoneView.this.phoneField.length();
                            }
                            hintEditText.setSelection(selectionStart);
                        }
                        PhoneView.this.phoneField.onTextChange();
                        PhoneView.this.ignoreOnPhoneChange = false;
                    }
                }
            });
            this.phoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$vjFVrWNKEYUKUrTM70xKikIPnVE */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.PhoneView.this.lambda$new$4$HloginActivity$PhoneView(textView, i, keyEvent);
                }
            });
            this.phoneField.setOnKeyListener(new View.OnKeyListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$VHn8uPBbjHelntl1vLQHj50Q3HY */

                public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                    return HloginActivity.PhoneView.this.lambda$new$5$HloginActivity$PhoneView(view, i, keyEvent);
                }
            });
            View view5 = new View(context);
            this.view = view5;
            view5.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            addView(this.view, LayoutHelper.createLinear(-1.0f, 0.5f));
            TextView textView7 = new TextView(context);
            this.textView2 = textView7;
            textView7.setText(LocaleController.getString("StartText", R.string.StartText));
            this.textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.textView2.setTextSize(1, 14.0f);
            this.textView2.setGravity(LocaleController.isRTL ? 5 : 3);
            this.textView2.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.textView2, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 28, 0, 10));
            this.textView2.setVisibility(8);
            TextView textView8 = new TextView(context);
            textView8.setText(LocaleController.getString("Next", R.string.Next).toUpperCase());
            textView8.setGravity(17);
            textView8.setTextColor(-1);
            textView8.setTextSize(1, 16.0f);
            textView8.setBackground(Theme.createSimpleSelectorRoundRectDrawable((float) AndroidUtilities.dp(24.0f), Color.parseColor("#FF268CFF"), Color.parseColor("#FF1E69BD")));
            if (Build.VERSION.SDK_INT >= 21) {
                StateListAnimator stateListAnimator = new StateListAnimator();
                stateListAnimator.addState(new int[]{16842919}, ObjectAnimator.ofFloat(textView8, "translationZ", (float) AndroidUtilities.dp(2.0f), (float) AndroidUtilities.dp(4.0f)).setDuration(200L));
                stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(textView8, "translationZ", (float) AndroidUtilities.dp(4.0f), (float) AndroidUtilities.dp(2.0f)).setDuration(200L));
                textView8.setStateListAnimator(stateListAnimator);
            }
            textView8.setPadding(AndroidUtilities.dp(20.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(20.0f), AndroidUtilities.dp(10.0f));
            addView(textView8, LayoutHelper.createLinear(-1, -2, 17, 32, 56, 32, 0));
            textView8.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$LJ4EhqB2RSSCioGD3OssfiuB86E */

                public final void onClick(View view) {
                    HloginActivity.PhoneView.this.lambda$new$6$HloginActivity$PhoneView(view);
                }
            });
            if (HloginActivity.this.newAccount) {
                CheckBoxCell checkBoxCell2 = new CheckBoxCell(context, 2);
                this.checkBoxCell = checkBoxCell2;
                checkBoxCell2.setText(LocaleController.getString("SyncContacts", R.string.SyncContacts), "", HloginActivity.this.syncContacts, false);
                addView(this.checkBoxCell, LayoutHelper.createLinear(-2, -1, 51, 0, 0, 0, 0));
                this.checkBoxCell.setOnClickListener(new View.OnClickListener() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$eukeNbD5qhnGziqPIEuzArH8V0 */

                    public final void onClick(View view) {
                        HloginActivity.PhoneView.this.lambda$new$7$HloginActivity$PhoneView(view);
                    }
                });
            }
            HashMap hashMap = new HashMap();
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt")));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    String[] split = readLine.split(";");
                    this.countriesArray.add(0, split[2]);
                    this.countriesMap.put(split[2], split[0]);
                    this.codesMap.put(split[0], split[2]);
                    if (split.length > 3) {
                        this.phoneFormatMap.put(split[0], split[3]);
                    }
                    hashMap.put(split[1], split[2]);
                }
                bufferedReader.close();
            } catch (Exception e) {
                FileLog.e(e);
            }
            Collections.sort(this.countriesArray, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE);
            try {
                TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
            } catch (Exception e2) {
                FileLog.e(e2);
            }
            HloginActivity.this.getAccountInstance().getConnectionsManager().sendRequest(new TLRPC.TL_help_getNearestDc(), new RequestDelegate(hashMap) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$Dbh4Zq7Pu3QX7xslEEBJiLBmcus */
                private final /* synthetic */ HashMap f$1;

                {
                    this.f$1 = r2;
                }

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    HloginActivity.PhoneView.this.lambda$new$9$HloginActivity$PhoneView(this.f$1, tLObject, tL_error);
                }
            }, 10);
            if (this.codeField.length() == 0) {
                this.countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                this.phoneField.setHintText((String) null);
                this.countryState = 1;
            }
            if (this.codeField.length() != 0) {
                this.phoneField.requestFocus();
                HintEditText hintEditText = this.phoneField;
                hintEditText.setSelection(hintEditText.length());
                return;
            }
            this.codeField.requestFocus();
        }

        public /* synthetic */ void lambda$new$2$HloginActivity$PhoneView(View view2) {
            CountrySelectActivity countrySelectActivity = new CountrySelectActivity(true);
            countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$d2WgMoJcfSMrwqcsgG5UkqihRFQ */

                @Override // im.guobwnxjuc.ui.CountrySelectActivity.CountrySelectActivityDelegate
                public final void didSelectCountry(CountrySelectActivity.Country country) {
                    HloginActivity.PhoneView.this.lambda$null$1$HloginActivity$PhoneView(country);
                }
            });
            HloginActivity.this.presentFragment(countrySelectActivity);
        }

        public /* synthetic */ void lambda$null$1$HloginActivity$PhoneView(CountrySelectActivity.Country country) {
            selectCountry(null, country);
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$e3PNcW81EPjpZiH2d8IdgcBE4c */

                public final void run() {
                    HloginActivity.PhoneView.this.lambda$null$0$HloginActivity$PhoneView();
                }
            }, 300);
            this.phoneField.requestFocus();
            HintEditText hintEditText = this.phoneField;
            hintEditText.setSelection(hintEditText.length());
        }

        public /* synthetic */ void lambda$null$0$HloginActivity$PhoneView() {
            AndroidUtilities.showKeyboard(this.phoneField);
        }

        public /* synthetic */ boolean lambda$new$3$HloginActivity$PhoneView(TextView textView3, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            this.phoneField.requestFocus();
            HintEditText hintEditText = this.phoneField;
            hintEditText.setSelection(hintEditText.length());
            return true;
        }

        public /* synthetic */ boolean lambda$new$4$HloginActivity$PhoneView(TextView textView3, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        public /* synthetic */ boolean lambda$new$5$HloginActivity$PhoneView(View view2, int i, KeyEvent keyEvent) {
            if (i != 67 || this.phoneField.length() != 0) {
                return false;
            }
            this.codeField.requestFocus();
            EditTextBoldCursor editTextBoldCursor = this.codeField;
            editTextBoldCursor.setSelection(editTextBoldCursor.length());
            this.codeField.dispatchKeyEvent(keyEvent);
            return true;
        }

        public /* synthetic */ void lambda$new$6$HloginActivity$PhoneView(View view2) {
            onNextPressed();
        }

        public /* synthetic */ void lambda$new$7$HloginActivity$PhoneView(View view2) {
            if (HloginActivity.this.getParentActivity() != null) {
                HloginActivity hloginActivity = HloginActivity.this;
                hloginActivity.syncContacts = !hloginActivity.syncContacts;
                ((CheckBoxCell) view2).setChecked(HloginActivity.this.syncContacts, true);
                if (HloginActivity.this.syncContacts) {
                    ToastUtils.show((int) R.string.SyncContactsOn);
                } else {
                    ToastUtils.show((int) R.string.SyncContactsOff);
                }
            }
        }

        public /* synthetic */ void lambda$new$9$HloginActivity$PhoneView(HashMap hashMap, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tLObject, hashMap) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$pXdJqdZOLplD2tU1gq2LhpfsQIo */
                private final /* synthetic */ TLObject f$1;
                private final /* synthetic */ HashMap f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.PhoneView.this.lambda$null$8$HloginActivity$PhoneView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$8$HloginActivity$PhoneView(TLObject tLObject, HashMap hashMap) {
            if (tLObject != null) {
                TLRPC.TL_nearestDc tL_nearestDc = (TLRPC.TL_nearestDc) tLObject;
                if (this.codeField.length() == 0) {
                    setCountry(hashMap, tL_nearestDc.country.toUpperCase());
                }
            }
        }

        public void selectCountry(String str, CountrySelectActivity.Country country) {
            String str2 = null;
            if (str != null) {
                if (this.countriesArray.indexOf(str) != -1) {
                    this.ignoreOnTextChange = true;
                    String str3 = this.countriesMap.get(str);
                    this.codeField.setText(str3);
                    this.countryButton.setText(str);
                    String str4 = this.phoneFormatMap.get(str3);
                    HintEditText hintEditText = this.phoneField;
                    if (str4 != null) {
                        str2 = str4.replace('X', Typography.ndash);
                    }
                    hintEditText.setHintText(str2);
                    this.countryState = 0;
                    this.ignoreOnTextChange = false;
                }
            } else if (country != null) {
                this.ignoreOnTextChange = true;
                EditTextBoldCursor editTextBoldCursor = this.codeField;
                editTextBoldCursor.setText(country.code + "");
                if (country.phoneFormat != null) {
                    HintEditText hintEditText2 = this.phoneField;
                    if (country.phoneFormat != null) {
                        str2 = country.phoneFormat.replace('X', Typography.ndash);
                    }
                    hintEditText2.setHintText(str2);
                }
                this.countryState = 0;
                this.ignoreOnTextChange = false;
            }
        }

        private void setCountry(HashMap<String, String> hashMap, String str) {
            String str2 = hashMap.get(str);
            if (str2 != null && this.countriesArray.indexOf(str2) != -1) {
                this.codeField.setText(this.countriesMap.get(str2));
                this.countryState = 0;
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onItemSelected(AdapterView<?> adapterView, View view2, int i, long j) {
            if (this.ignoreSelection) {
                this.ignoreSelection = false;
                return;
            }
            this.ignoreOnTextChange = true;
            this.codeField.setText(this.countriesMap.get(this.countriesArray.get(i)));
            this.ignoreOnTextChange = false;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (HloginActivity.this.getParentActivity() != null && !this.nextPressed) {
                int i = this.countryState;
                if (i == 1) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                } else if (i == 2 && !BuildVars.DEBUG_VERSION) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("WrongCountry", R.string.WrongCountry));
                } else if (this.codeField.length() == 0) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
                } else {
                    StringBuilder sb = new StringBuilder();
                    sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.codeField.getText())));
                    sb.append(" ");
                    sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.phoneField.getText())));
                    String sb2 = sb.toString();
                    if (HloginActivity.this.getParentActivity() instanceof LaunchActivity) {
                        for (int i2 = 0; i2 < 3; i2++) {
                            UserConfig instance = UserConfig.getInstance(i2);
                            if (instance.isClientActivated() && PhoneNumberUtils.compare(sb2, instance.getCurrentUser().phone)) {
                                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                                builder.setMessage(LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn));
                                builder.setPositiveButton(LocaleController.getString("AccountSwitch", R.string.AccountSwitch), new DialogInterface.OnClickListener(i2) {
                                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$i2g9CxnFRpGrnQeGhCuQWbv8ILE */
                                    private final /* synthetic */ int f$1;

                                    {
                                        this.f$1 = r2;
                                    }

                                    public final void onClick(DialogInterface dialogInterface, int i) {
                                        HloginActivity.PhoneView.this.lambda$onNextPressed$10$HloginActivity$PhoneView(this.f$1, dialogInterface, i);
                                    }
                                });
                                builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
                                HloginActivity.this.showDialog(builder.create());
                                return;
                            }
                        }
                    }
                    ConnectionsManager.getInstance(HloginActivity.this.currentAccount).cleanup(false);
                    TLRPC.TL_auth_sendCode tL_auth_sendCode = new TLRPC.TL_auth_sendCode();
                    tL_auth_sendCode.api_hash = BuildVars.APP_HASH;
                    tL_auth_sendCode.api_id = BuildVars.APP_ID;
                    tL_auth_sendCode.phone_number = sb2;
                    tL_auth_sendCode.settings = new TLRPC.TL_codeSettings();
                    tL_auth_sendCode.settings.allow_flashcall = false;
                    tL_auth_sendCode.settings.allow_app_hash = ApplicationLoader.hasPlayServices;
                    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
                    if (tL_auth_sendCode.settings.allow_app_hash) {
                        sharedPreferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit();
                    } else {
                        sharedPreferences.edit().remove("sms_hash").commit();
                    }
                    Bundle bundle = new Bundle();
                    bundle.putString("phone", Marker.ANY_NON_NULL_MARKER + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText()));
                    try {
                        bundle.putString("ephone", Marker.ANY_NON_NULL_MARKER + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString()));
                    } catch (Exception e) {
                        FileLog.e(e);
                        bundle.putString("ephone", Marker.ANY_NON_NULL_MARKER + sb2);
                    }
                    bundle.putString("phoneFormated", sb2);
                    this.nextPressed = true;
                    HloginActivity.this.needShowProgress(ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_sendCode, new RequestDelegate(bundle, tL_auth_sendCode) {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$fYAih1n2DzKUkm3TVEAyH8E0Olg */
                        private final /* synthetic */ Bundle f$1;
                        private final /* synthetic */ TLRPC.TL_auth_sendCode f$2;

                        {
                            this.f$1 = r2;
                            this.f$2 = r3;
                        }

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            HloginActivity.PhoneView.this.lambda$onNextPressed$12$HloginActivity$PhoneView(this.f$1, this.f$2, tLObject, tL_error);
                        }
                    }, 27));
                }
            }
        }

        public /* synthetic */ void lambda$onNextPressed$10$HloginActivity$PhoneView(int i, DialogInterface dialogInterface, int i2) {
            if (UserConfig.selectedAccount != i) {
                ((LaunchActivity) HloginActivity.this.getParentActivity()).switchToAccount(i, false);
            }
            HloginActivity.this.finishFragment();
        }

        public /* synthetic */ void lambda$onNextPressed$12$HloginActivity$PhoneView(Bundle bundle, TLRPC.TL_auth_sendCode tL_auth_sendCode, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, bundle, tLObject, tL_auth_sendCode) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$7mWsMzctgmyWtyyBh5C1vfb6qrQ */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ Bundle f$2;
                private final /* synthetic */ TLObject f$3;
                private final /* synthetic */ TLRPC.TL_auth_sendCode f$4;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                    this.f$4 = r5;
                }

                public final void run() {
                    HloginActivity.PhoneView.this.lambda$null$11$HloginActivity$PhoneView(this.f$1, this.f$2, this.f$3, this.f$4);
                }
            });
        }

        public /* synthetic */ void lambda$null$11$HloginActivity$PhoneView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_auth_sendCode tL_auth_sendCode) {
            this.nextPressed = false;
            if (tL_error == null) {
                HloginActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject);
            } else if (tL_error.text != null) {
                if (tL_error.text.contains("PHONE_NUMBER_INVALID")) {
                    HloginActivity.this.needShowInvalidAlert(tL_auth_sendCode.phone_number, false);
                } else if (tL_error.text.contains("PHONE_PASSWORD_FLOOD")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
                } else if (tL_error.text.contains("PHONE_NUMBER_FLOOD")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("PhoneNumberFlood", R.string.PhoneNumberFlood));
                } else if (tL_error.text.contains("PHONE_NUMBER_BANNED")) {
                    HloginActivity.this.needShowInvalidAlert(tL_auth_sendCode.phone_number, true);
                } else if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
                } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
                } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
                } else if (tL_error.code != -1000) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                }
            }
            HloginActivity.this.needHideProgress(false);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            fillNumber();
            CheckBoxCell checkBoxCell2 = this.checkBoxCell;
            if (checkBoxCell2 != null) {
                checkBoxCell2.setChecked(HloginActivity.this.syncContacts, false);
            }
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$PhoneView$HQqGxxZJgG9QWgDnD8Jm3WTbWdA */

                public final void run() {
                    HloginActivity.PhoneView.this.lambda$onShow$13$HloginActivity$PhoneView();
                }
            }, 100);
        }

        public /* synthetic */ void lambda$onShow$13$HloginActivity$PhoneView() {
            if (this.phoneField == null) {
                return;
            }
            if (this.codeField.length() != 0) {
                this.phoneField.requestFocus();
                HintEditText hintEditText = this.phoneField;
                hintEditText.setSelection(hintEditText.length());
                AndroidUtilities.showKeyboard(this.phoneField);
                return;
            }
            this.codeField.requestFocus();
            AndroidUtilities.showKeyboard(this.codeField);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            return LocaleController.getString("YourPhone", R.string.YourPhone);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            String obj = this.codeField.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("phoneview_code", obj);
            }
            String obj2 = this.phoneField.getText().toString();
            if (obj2.length() != 0) {
                bundle.putString("phoneview_phone", obj2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            String string = bundle.getString("phoneview_code");
            if (string != null) {
                this.codeField.setText(string);
            }
            String string2 = bundle.getString("phoneview_phone");
            if (string2 != null) {
                this.phoneField.setText(string2);
            }
        }
    }

    public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
        private ImageView blackImageView;
        private ImageView blueImageView;
        private String catchedPhone;
        private EditTextBoldCursor[] codeField;
        private LinearLayout codeFieldContainer;
        private int codeTime = 15000;
        private Timer codeTimer;
        private TextView confirmTextView;
        private Bundle currentParams;
        private int currentType;
        private String emailPhone;
        private boolean ignoreOnTextChange;
        private boolean isRestored;
        private double lastCodeTime;
        private double lastCurrentTime;
        private String lastError = "";
        private int length;
        private boolean nextPressed;
        private int nextType;
        private int openTime;
        private String pattern = "*";
        private String phone;
        private String phoneHash;
        private TextView problemText;
        private ProgressView progressView;
        private String requestPhone;
        private int time = TimeConstants.MIN;
        private TextView timeText;
        private Timer timeTimer;
        private int timeout;
        private final Object timerSync = new Object();
        private TextView titleTextView;
        private boolean waitingForEvent;

        static /* synthetic */ void lambda$onBackPressed$11(TLObject tLObject, TLRPC.TL_error tL_error) {
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public LoginActivitySmsView(Context context, int i) {
            super(context);
            this.currentType = i;
            setOrientation(1);
            TextView textView = new TextView(context);
            this.confirmTextView = textView;
            textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.confirmTextView.setTextSize(1, 14.0f);
            this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            TextView textView2 = new TextView(context);
            this.titleTextView = textView2;
            textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.titleTextView.setTextSize(1, 18.0f);
            this.titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            int i2 = 3;
            this.titleTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.titleTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.titleTextView.setGravity(49);
            if (this.currentType == 3) {
                this.confirmTextView.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
                FrameLayout frameLayout = new FrameLayout(context);
                addView(frameLayout, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
                ImageView imageView = new ImageView(context);
                imageView.setImageResource(R.drawable.phone_activate);
                if (LocaleController.isRTL) {
                    frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
                    frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f));
                } else {
                    frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
                    frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 21, 0.0f, 2.0f, 0.0f, 2.0f));
                }
            } else {
                this.confirmTextView.setGravity(49);
                FrameLayout frameLayout2 = new FrameLayout(context);
                addView(frameLayout2, LayoutHelper.createLinear(-2, -2, 49));
                if (this.currentType == 1) {
                    ImageView imageView2 = new ImageView(context);
                    this.blackImageView = imageView2;
                    imageView2.setImageResource(R.drawable.sms_devices);
                    this.blackImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
                    frameLayout2.addView(this.blackImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    ImageView imageView3 = new ImageView(context);
                    this.blueImageView = imageView3;
                    imageView3.setImageResource(R.drawable.sms_bubble);
                    this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY));
                    frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    this.titleTextView.setText(LocaleController.getString("SentAppCodeTitle", R.string.SentAppCodeTitle));
                } else {
                    this.titleTextView.setText(LocaleController.getString("SentSmsCodeTitle", R.string.SentSmsCodeTitle));
                }
                addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 18, 0, 0));
                addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 17, 0, 0));
            }
            View view = new View(context);
            view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            addView(view, LayoutHelper.createLinear(-1.0f, 0.5f, 16, 16.0f, 72.0f, 16.0f, 0.0f));
            LinearLayout linearLayout = new LinearLayout(context);
            linearLayout.setOrientation(0);
            addView(linearLayout, LayoutHelper.createLinear(-1, 68, 1, 16, 0, 16, 0));
            ImageView imageView4 = new ImageView(context);
            imageView4.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            imageView4.setImageDrawable(DrawableUtils.tintDrawable(HloginActivity.this.getParentActivity().getResources().getDrawable(R.mipmap.icon_phone).mutate(), Theme.getColor(Theme.key_actionBarDefaultIcon)));
            linearLayout.addView(imageView4, LayoutHelper.createLinear(-2, -2, 16));
            View view2 = new View(context);
            view2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            linearLayout.addView(view2, LayoutHelper.createLinear(0.5f, 34.0f, 16, 16.0f, 0.0f, 16.0f, 0.0f));
            LinearLayout linearLayout2 = new LinearLayout(context);
            this.codeFieldContainer = linearLayout2;
            linearLayout2.setOrientation(0);
            linearLayout.addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, 34, 16, 0, 0, 0, 0));
            if (this.currentType == 3) {
                this.codeFieldContainer.setVisibility(8);
            }
            View view3 = new View(context);
            view3.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
            addView(view3, LayoutHelper.createLinear(-1.0f, 0.5f, 16, 16.0f, 0.0f, 16.0f, 0.0f));
            AnonymousClass1 r4 = new TextView(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivitySmsView.AnonymousClass1 */

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
                }
            };
            this.timeText = r4;
            r4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.timeText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            if (this.currentType == 3) {
                this.timeText.setTextSize(1, 14.0f);
                addView(this.timeText, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
                this.progressView = new ProgressView(context);
                this.timeText.setGravity(LocaleController.isRTL ? 5 : i2);
                addView(this.progressView, LayoutHelper.createLinear(-1, 3, 0.0f, 12.0f, 0.0f, 0.0f));
            } else {
                this.timeText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
                this.timeText.setTextSize(1, 15.0f);
                this.timeText.setGravity(49);
                addView(this.timeText, LayoutHelper.createLinear(-2, -2, 49));
            }
            AnonymousClass2 r42 = new TextView(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivitySmsView.AnonymousClass2 */

                /* access modifiers changed from: protected */
                public void onMeasure(int i, int i2) {
                    super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
                }
            };
            this.problemText = r42;
            r42.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            this.problemText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.problemText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
            this.problemText.setTextSize(1, 15.0f);
            this.problemText.setGravity(49);
            if (this.currentType == 1) {
                this.problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms));
            } else {
                this.problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode));
            }
            addView(this.problemText, LayoutHelper.createLinear(-2, -2, 49, 0, 50, 0, 0));
            this.problemText.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$TxRvvLEM25pltGx_uBTcrZ79mVA */

                public final void onClick(View view) {
                    HloginActivity.LoginActivitySmsView.this.lambda$new$0$HloginActivity$LoginActivitySmsView(view);
                }
            });
            TextView textView3 = new TextView(context);
            textView3.setText(LocaleController.getString("Next", R.string.Next).toUpperCase());
            textView3.setGravity(17);
            textView3.setTextColor(-1);
            textView3.setTextSize(1, 16.0f);
            textView3.setBackground(Theme.createSimpleSelectorRoundRectDrawable((float) AndroidUtilities.dp(24.0f), Color.parseColor("#FF268CFF"), Color.parseColor("#FF1E69BD")));
            if (Build.VERSION.SDK_INT >= 21) {
                StateListAnimator stateListAnimator = new StateListAnimator();
                stateListAnimator.addState(new int[]{16842919}, ObjectAnimator.ofFloat(textView3, "translationZ", (float) AndroidUtilities.dp(2.0f), (float) AndroidUtilities.dp(4.0f)).setDuration(200L));
                stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(textView3, "translationZ", (float) AndroidUtilities.dp(4.0f), (float) AndroidUtilities.dp(2.0f)).setDuration(200L));
                textView3.setStateListAnimator(stateListAnimator);
            }
            textView3.setPadding(AndroidUtilities.dp(20.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(20.0f), AndroidUtilities.dp(10.0f));
            addView(textView3, LayoutHelper.createLinear(-1, -2, 17, 32, 50, 32, 0));
            textView3.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$lGriXLuIXGTHsVEij_ofFBaTfeo */

                public final void onClick(View view) {
                    HloginActivity.LoginActivitySmsView.this.lambda$new$1$HloginActivity$LoginActivitySmsView(view);
                }
            });
        }

        public /* synthetic */ void lambda$new$0$HloginActivity$LoginActivitySmsView(View view) {
            if (!this.nextPressed) {
                if ((this.nextType == 4 && this.currentType == 2) || this.nextType == 0) {
                    try {
                        PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
                        String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
                        Intent intent = new Intent("android.intent.action.SEND");
                        intent.setType("message/rfc822");
                        intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@stel.com"});
                        intent.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + format + " " + this.emailPhone);
                        intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.requestPhone + "\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.lastError);
                        getContext().startActivity(Intent.createChooser(intent, "Send email..."));
                    } catch (Exception unused) {
                        HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
                    }
                } else if (HloginActivity.this.doneProgressView.getTag() == null) {
                    resendCode();
                }
            }
        }

        public /* synthetic */ void lambda$new$1$HloginActivity$LoginActivitySmsView(View view) {
            onNextPressed();
        }

        /* access modifiers changed from: protected */
        public void onMeasure(int i, int i2) {
            ImageView imageView;
            super.onMeasure(i, i2);
            if (this.currentType != 3 && (imageView = this.blueImageView) != null) {
                int measuredHeight = imageView.getMeasuredHeight() + this.titleTextView.getMeasuredHeight() + this.confirmTextView.getMeasuredHeight() + AndroidUtilities.dp(35.0f);
                int dp = AndroidUtilities.dp(80.0f);
                int dp2 = AndroidUtilities.dp(291.0f);
                if (HloginActivity.this.scrollHeight - measuredHeight < dp) {
                    setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
                } else if (HloginActivity.this.scrollHeight > dp2) {
                    setMeasuredDimension(getMeasuredWidth(), dp2);
                } else {
                    setMeasuredDimension(getMeasuredWidth(), HloginActivity.this.scrollHeight);
                }
            }
        }

        /* access modifiers changed from: protected */
        public void onLayout(boolean z, int i, int i2, int i3, int i4) {
            int i5;
            super.onLayout(z, i, i2, i3, i4);
            if (this.currentType != 3 && this.blueImageView != null) {
                int bottom = this.confirmTextView.getBottom();
                int measuredHeight = getMeasuredHeight() - bottom;
                if (this.problemText.getVisibility() == 0) {
                    int measuredHeight2 = this.problemText.getMeasuredHeight();
                    i5 = (measuredHeight + bottom) - measuredHeight2;
                    TextView textView = this.problemText;
                    textView.layout(textView.getLeft(), i5, this.problemText.getRight(), measuredHeight2 + i5);
                } else if (this.timeText.getVisibility() == 0) {
                    int measuredHeight3 = this.timeText.getMeasuredHeight();
                    i5 = (measuredHeight + bottom) - measuredHeight3;
                    TextView textView2 = this.timeText;
                    textView2.layout(textView2.getLeft(), i5, this.timeText.getRight(), measuredHeight3 + i5);
                } else {
                    i5 = measuredHeight + bottom;
                }
                int measuredHeight4 = this.codeFieldContainer.getMeasuredHeight();
                int i6 = (((i5 - bottom) - measuredHeight4) / 2) + bottom;
                LinearLayout linearLayout = this.codeFieldContainer;
                linearLayout.layout(linearLayout.getLeft(), i6, this.codeFieldContainer.getRight(), measuredHeight4 + i6);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void resendCode() {
            Bundle bundle = new Bundle();
            bundle.putString("phone", this.phone);
            bundle.putString("ephone", this.emailPhone);
            bundle.putString("phoneFormated", this.requestPhone);
            this.nextPressed = true;
            TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
            tL_auth_resendCode.phone_number = this.requestPhone;
            tL_auth_resendCode.phone_code_hash = this.phoneHash;
            ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate(bundle) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$hVq_DT6dzqzlDjMXccEgA9rXY */
                private final /* synthetic */ Bundle f$1;

                {
                    this.f$1 = r2;
                }

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    HloginActivity.LoginActivitySmsView.this.lambda$resendCode$3$HloginActivity$LoginActivitySmsView(this.f$1, tLObject, tL_error);
                }
            }, 10);
            HloginActivity.this.needShowProgress(0);
        }

        public /* synthetic */ void lambda$resendCode$3$HloginActivity$LoginActivitySmsView(Bundle bundle, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, bundle, tLObject) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$2lPT4Akl65wrx86KDgIrC7hcNd0 */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ Bundle f$2;
                private final /* synthetic */ TLObject f$3;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                }

                public final void run() {
                    HloginActivity.LoginActivitySmsView.this.lambda$null$2$HloginActivity$LoginActivitySmsView(this.f$1, this.f$2, this.f$3);
                }
            });
        }

        public /* synthetic */ void lambda$null$2$HloginActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject) {
            this.nextPressed = false;
            if (tL_error == null) {
                HloginActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject);
            } else if (tL_error.text != null) {
                if (tL_error.text.contains("PHONE_NUMBER_INVALID")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
                } else if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
                } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                    onBackPressed(true);
                    HloginActivity.this.setPage(0, true, null, true);
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
                } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
                } else if (tL_error.code != -1000) {
                    HloginActivity hloginActivity = HloginActivity.this;
                    String string = LocaleController.getString("AppName", R.string.AppName);
                    hloginActivity.needShowAlert(string, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + tL_error.text);
                }
            }
            HloginActivity.this.needHideProgress(false);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            if (this.currentType == 1) {
                return this.phone;
            }
            return LocaleController.getString("YourCode", R.string.YourCode);
        }

        /* JADX WARNING: Removed duplicated region for block: B:98:0x036d  */
        /* JADX WARNING: Removed duplicated region for block: B:99:0x0378  */
        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            int i;
            String str;
            String string;
            int i2;
            if (bundle != null) {
                this.isRestored = z;
                this.waitingForEvent = true;
                int i3 = this.currentType;
                if (i3 == 2) {
                    AndroidUtilities.setWaitingForSms(true);
                    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
                } else if (i3 == 3) {
                    AndroidUtilities.setWaitingForCall(true);
                    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
                }
                this.currentParams = bundle;
                this.phone = bundle.getString("phone");
                this.emailPhone = bundle.getString("ephone");
                this.requestPhone = bundle.getString("phoneFormated");
                this.phoneHash = bundle.getString("phoneHash");
                int i4 = bundle.getInt("timeout");
                this.time = i4;
                this.timeout = i4;
                this.openTime = (int) (System.currentTimeMillis() / 1000);
                this.nextType = bundle.getInt("nextType");
                this.pattern = bundle.getString("pattern");
                int i5 = bundle.getInt("length");
                this.length = i5;
                if (i5 == 0) {
                    this.length = 5;
                }
                EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                CharSequence charSequence = "";
                Drawable drawable = null;
                int i6 = 8;
                if (editTextBoldCursorArr != null && editTextBoldCursorArr.length == this.length) {
                    int i7 = 0;
                    while (true) {
                        EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
                        if (i7 >= editTextBoldCursorArr2.length) {
                            break;
                        }
                        editTextBoldCursorArr2[i7].setText(charSequence);
                        i7++;
                    }
                } else {
                    this.codeField = new EditTextBoldCursor[this.length];
                    final int i8 = 0;
                    while (i8 < this.length) {
                        this.codeField[i8] = new EditTextBoldCursor(getContext());
                        this.codeField[i8].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                        this.codeField[i8].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                        this.codeField[i8].setCursorSize(AndroidUtilities.dp(20.0f));
                        this.codeField[i8].setCursorWidth(1.5f);
                        Drawable mutate = getResources().getDrawable(R.drawable.search_dark_activated).mutate();
                        mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.MULTIPLY));
                        this.codeField[i8].setBackgroundDrawable(mutate);
                        this.codeField[i8].setImeOptions(268435461);
                        this.codeField[i8].setTextSize(1, 20.0f);
                        this.codeField[i8].setMaxLines(1);
                        this.codeField[i8].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                        this.codeField[i8].setPadding(0, 0, 0, 0);
                        this.codeField[i8].setBackground(drawable);
                        this.codeField[i8].setGravity(49);
                        if (this.currentType == 3) {
                            this.codeField[i8].setEnabled(false);
                            this.codeField[i8].setInputType(0);
                            this.codeField[i8].setVisibility(8);
                        } else {
                            this.codeField[i8].setInputType(3);
                        }
                        this.codeFieldContainer.addView(this.codeField[i8], LayoutHelper.createLinear(34, 36, 1, 0, 0, i8 != this.length - 1 ? 7 : 0, 0));
                        this.codeField[i8].addTextChangedListener(new TextWatcher() {
                            /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivitySmsView.AnonymousClass3 */

                            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                            }

                            public void afterTextChanged(Editable editable) {
                                int length;
                                if (!LoginActivitySmsView.this.ignoreOnTextChange && (length = editable.length()) >= 1) {
                                    if (length > 1) {
                                        String obj = editable.toString();
                                        LoginActivitySmsView.this.ignoreOnTextChange = true;
                                        for (int i = 0; i < Math.min(LoginActivitySmsView.this.length - i8, length); i++) {
                                            if (i == 0) {
                                                editable.replace(0, length, obj.substring(i, i + 1));
                                            } else {
                                                LoginActivitySmsView.this.codeField[i8 + i].setText(obj.substring(i, i + 1));
                                            }
                                        }
                                        LoginActivitySmsView.this.ignoreOnTextChange = false;
                                    }
                                    if (i8 != LoginActivitySmsView.this.length - 1) {
                                        LoginActivitySmsView.this.codeField[i8 + 1].setSelection(LoginActivitySmsView.this.codeField[i8 + 1].length());
                                        LoginActivitySmsView.this.codeField[i8 + 1].requestFocus();
                                    }
                                    if ((i8 == LoginActivitySmsView.this.length - 1 || (i8 == LoginActivitySmsView.this.length - 2 && length >= 2)) && LoginActivitySmsView.this.getCode().length() == LoginActivitySmsView.this.length) {
                                        LoginActivitySmsView.this.onNextPressed();
                                    }
                                }
                            }
                        });
                        this.codeField[i8].setOnKeyListener(new View.OnKeyListener(i8) {
                            /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$NtIIRUcKfKa5rGaJNZfBj8CcPsM */
                            private final /* synthetic */ int f$1;

                            {
                                this.f$1 = r2;
                            }

                            public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                                return HloginActivity.LoginActivitySmsView.this.lambda$setParams$4$HloginActivity$LoginActivitySmsView(this.f$1, view, i, keyEvent);
                            }
                        });
                        this.codeField[i8].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                            /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$J3mJUSHA3B4ZLC4uPpKOfeDem14 */

                            public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                                return HloginActivity.LoginActivitySmsView.this.lambda$setParams$5$HloginActivity$LoginActivitySmsView(textView, i, keyEvent);
                            }
                        });
                        i8++;
                        drawable = null;
                    }
                }
                ProgressView progressView2 = this.progressView;
                if (progressView2 != null) {
                    progressView2.setVisibility(this.nextType != 0 ? 0 : 8);
                }
                if (this.phone != null) {
                    String format = PhoneFormat.getInstance().format(this.phone);
                    int i9 = this.currentType;
                    if (i9 == 1) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.getString("SentAppCode", R.string.SentAppCode));
                    } else if (i9 == 2) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(format)));
                    } else if (i9 == 3) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(format)));
                    } else if (i9 == 4) {
                        charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(format)));
                    }
                    this.confirmTextView.setText(charSequence);
                    if (this.currentType != 3) {
                        AndroidUtilities.showKeyboard(this.codeField[0]);
                        this.codeField[0].requestFocus();
                    } else {
                        AndroidUtilities.hideKeyboard(this.codeField[0]);
                    }
                    destroyTimer();
                    destroyCodeTimer();
                    this.lastCurrentTime = (double) System.currentTimeMillis();
                    int i10 = this.currentType;
                    if (i10 == 1) {
                        this.problemText.setVisibility(0);
                        this.timeText.setVisibility(8);
                    } else if (i10 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
                        this.problemText.setVisibility(8);
                        this.timeText.setVisibility(0);
                        int i11 = this.nextType;
                        if (i11 == 4) {
                            this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
                        } else if (i11 == 2) {
                            this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0));
                        }
                        String obtainLoginPhoneCall = this.isRestored ? AndroidUtilities.obtainLoginPhoneCall(this.pattern) : null;
                        if (obtainLoginPhoneCall != null) {
                            this.ignoreOnTextChange = true;
                            this.codeField[0].setText(obtainLoginPhoneCall);
                            this.ignoreOnTextChange = false;
                            onNextPressed();
                            return;
                        }
                        String str2 = this.catchedPhone;
                        if (str2 != null) {
                            this.ignoreOnTextChange = true;
                            this.codeField[0].setText(str2);
                            this.ignoreOnTextChange = false;
                            onNextPressed();
                            return;
                        }
                        createTimer();
                    } else if (this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) {
                        this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
                        this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
                        TextView textView = this.timeText;
                        if (this.time >= 1000) {
                            i6 = 0;
                        }
                        textView.setVisibility(i6);
                        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
                        String string2 = sharedPreferences.getString("sms_hash", null);
                        if (!TextUtils.isEmpty(string2) && (string = sharedPreferences.getString("sms_hash_code", null)) != null) {
                            if (string.contains(string2 + LogUtils.VERTICAL)) {
                                str = string.substring(string.indexOf(124) + 1);
                                if (str == null) {
                                    this.codeField[0].setText(str);
                                    onNextPressed();
                                    return;
                                }
                                createTimer();
                                return;
                            }
                        }
                        str = null;
                        if (str == null) {
                        }
                    } else if (this.currentType == 4 && this.nextType == 2) {
                        this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
                        this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
                        TextView textView2 = this.timeText;
                        if (this.time >= 1000) {
                            i6 = 0;
                        }
                        textView2.setVisibility(i6);
                        createTimer();
                    } else {
                        this.timeText.setVisibility(8);
                        this.problemText.setVisibility(8);
                        createCodeTimer();
                    }
                }
            }
        }

        public /* synthetic */ boolean lambda$setParams$4$HloginActivity$LoginActivitySmsView(int i, View view, int i2, KeyEvent keyEvent) {
            if (i2 != 67 || this.codeField[i].length() != 0 || i <= 0) {
                return false;
            }
            EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
            int i3 = i - 1;
            editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length());
            this.codeField[i3].requestFocus();
            this.codeField[i3].dispatchKeyEvent(keyEvent);
            return true;
        }

        public /* synthetic */ boolean lambda$setParams$5$HloginActivity$LoginActivitySmsView(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void createCodeTimer() {
            if (this.codeTimer == null) {
                this.codeTime = 15000;
                this.codeTimer = new Timer();
                this.lastCodeTime = (double) System.currentTimeMillis();
                this.codeTimer.schedule(new TimerTask() {
                    /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivitySmsView.AnonymousClass4 */

                    public void run() {
                        AndroidUtilities.runOnUIThread(new Runnable() {
                            /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$4$MdIS4bb213T6VNRvTtURy4Luq6g */

                            public final void run() {
                                HloginActivity.LoginActivitySmsView.AnonymousClass4.this.lambda$run$0$HloginActivity$LoginActivitySmsView$4();
                            }
                        });
                    }

                    public /* synthetic */ void lambda$run$0$HloginActivity$LoginActivitySmsView$4() {
                        double currentTimeMillis = (double) System.currentTimeMillis();
                        double d = LoginActivitySmsView.this.lastCodeTime;
                        Double.isNaN(currentTimeMillis);
                        double d2 = currentTimeMillis - d;
                        LoginActivitySmsView.this.lastCodeTime = currentTimeMillis;
                        LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this;
                        double d3 = (double) loginActivitySmsView.codeTime;
                        Double.isNaN(d3);
                        loginActivitySmsView.codeTime = (int) (d3 - d2);
                        if (LoginActivitySmsView.this.codeTime <= 1000) {
                            LoginActivitySmsView.this.problemText.setVisibility(0);
                            LoginActivitySmsView.this.timeText.setVisibility(8);
                            LoginActivitySmsView.this.destroyCodeTimer();
                        }
                    }
                }, 0, 1000);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void destroyCodeTimer() {
            try {
                synchronized (this.timerSync) {
                    if (this.codeTimer != null) {
                        this.codeTimer.cancel();
                        this.codeTimer = null;
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        private void createTimer() {
            if (this.timeTimer == null) {
                Timer timer = new Timer();
                this.timeTimer = timer;
                timer.schedule(new TimerTask() {
                    /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivitySmsView.AnonymousClass5 */

                    public void run() {
                        if (LoginActivitySmsView.this.timeTimer != null) {
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$5$3jG69681Aao8dW4Wu9xHr1fci6w */

                                public final void run() {
                                    HloginActivity.LoginActivitySmsView.AnonymousClass5.this.lambda$run$2$HloginActivity$LoginActivitySmsView$5();
                                }
                            });
                        }
                    }

                    public /* synthetic */ void lambda$run$2$HloginActivity$LoginActivitySmsView$5() {
                        double currentTimeMillis = (double) System.currentTimeMillis();
                        double d = LoginActivitySmsView.this.lastCurrentTime;
                        Double.isNaN(currentTimeMillis);
                        double d2 = currentTimeMillis - d;
                        LoginActivitySmsView.this.lastCurrentTime = currentTimeMillis;
                        LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this;
                        double d3 = (double) loginActivitySmsView.time;
                        Double.isNaN(d3);
                        loginActivitySmsView.time = (int) (d3 - d2);
                        if (LoginActivitySmsView.this.time >= 1000) {
                            int i = (LoginActivitySmsView.this.time / 1000) / 60;
                            int i2 = (LoginActivitySmsView.this.time / 1000) - (i * 60);
                            if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 3) {
                                LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(i), Integer.valueOf(i2)));
                            } else if (LoginActivitySmsView.this.nextType == 2) {
                                LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(i), Integer.valueOf(i2)));
                            }
                            if (LoginActivitySmsView.this.progressView != null) {
                                LoginActivitySmsView.this.progressView.setProgress(1.0f - (((float) LoginActivitySmsView.this.time) / ((float) LoginActivitySmsView.this.timeout)));
                                return;
                            }
                            return;
                        }
                        if (LoginActivitySmsView.this.progressView != null) {
                            LoginActivitySmsView.this.progressView.setProgress(1.0f);
                        }
                        LoginActivitySmsView.this.destroyTimer();
                        if (LoginActivitySmsView.this.currentType == 3) {
                            AndroidUtilities.setWaitingForCall(false);
                            NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
                            LoginActivitySmsView.this.waitingForEvent = false;
                            LoginActivitySmsView.this.destroyCodeTimer();
                            LoginActivitySmsView.this.resendCode();
                        } else if (LoginActivitySmsView.this.currentType != 2 && LoginActivitySmsView.this.currentType != 4) {
                        } else {
                            if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 2) {
                                if (LoginActivitySmsView.this.nextType == 4) {
                                    LoginActivitySmsView.this.timeText.setText(LocaleController.getString("Calling", R.string.Calling));
                                } else {
                                    LoginActivitySmsView.this.timeText.setText(LocaleController.getString("SendingSms", R.string.SendingSms));
                                }
                                LoginActivitySmsView.this.createCodeTimer();
                                TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
                                tL_auth_resendCode.phone_number = LoginActivitySmsView.this.requestPhone;
                                tL_auth_resendCode.phone_code_hash = LoginActivitySmsView.this.phoneHash;
                                ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
                                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$5$m0Kw_Yu07qZ3VrVSDFPDsFxbpg4 */

                                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                        HloginActivity.LoginActivitySmsView.AnonymousClass5.this.lambda$null$1$HloginActivity$LoginActivitySmsView$5(tLObject, tL_error);
                                    }
                                }, 10);
                            } else if (LoginActivitySmsView.this.nextType == 3) {
                                AndroidUtilities.setWaitingForSms(false);
                                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
                                LoginActivitySmsView.this.waitingForEvent = false;
                                LoginActivitySmsView.this.destroyCodeTimer();
                                LoginActivitySmsView.this.resendCode();
                            }
                        }
                    }

                    public /* synthetic */ void lambda$null$1$HloginActivity$LoginActivitySmsView$5(TLObject tLObject, TLRPC.TL_error tL_error) {
                        if (tL_error != null && tL_error.text != null) {
                            AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$5$bHQJyehJC0vbBaKr8cE1jRLaGb4 */
                                private final /* synthetic */ TLRPC.TL_error f$1;

                                {
                                    this.f$1 = r2;
                                }

                                public final void run() {
                                    HloginActivity.LoginActivitySmsView.AnonymousClass5.this.lambda$null$0$HloginActivity$LoginActivitySmsView$5(this.f$1);
                                }
                            });
                        }
                    }

                    public /* synthetic */ void lambda$null$0$HloginActivity$LoginActivitySmsView$5(TLRPC.TL_error tL_error) {
                        LoginActivitySmsView.this.lastError = tL_error.text;
                    }
                }, 0, 1000);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void destroyTimer() {
            try {
                synchronized (this.timerSync) {
                    if (this.timeTimer != null) {
                        this.timeTimer.cancel();
                        this.timeTimer = null;
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private String getCode() {
            if (this.codeField == null) {
                return "";
            }
            StringBuilder sb = new StringBuilder();
            int i = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
                if (i >= editTextBoldCursorArr.length) {
                    return sb.toString();
                }
                sb.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[i].getText().toString()));
                i++;
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (!this.nextPressed && HloginActivity.this.currentViewNum >= 1 && HloginActivity.this.currentViewNum <= 4) {
                String code = getCode();
                if (TextUtils.isEmpty(code)) {
                    AndroidUtilities.shakeView(this.codeFieldContainer, 2.0f, 0);
                    return;
                }
                this.nextPressed = true;
                int i = this.currentType;
                if (i == 2) {
                    AndroidUtilities.setWaitingForSms(false);
                    NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
                } else if (i == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
                }
                this.waitingForEvent = false;
                TLRPC.TL_auth_signIn tL_auth_signIn = new TLRPC.TL_auth_signIn();
                tL_auth_signIn.phone_number = this.requestPhone;
                tL_auth_signIn.phone_code = code;
                tL_auth_signIn.phone_code_hash = this.phoneHash;
                destroyTimer();
                HloginActivity.this.needShowProgress(ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_signIn, new RequestDelegate(tL_auth_signIn) {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$lBEdff_Dh8UmIpZnZ46j8bqCXWI */
                    private final /* synthetic */ TLRPC.TL_auth_signIn f$1;

                    {
                        this.f$1 = r2;
                    }

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        HloginActivity.LoginActivitySmsView.this.lambda$onNextPressed$9$HloginActivity$LoginActivitySmsView(this.f$1, tLObject, tL_error);
                    }
                }, 10));
            }
        }

        public /* synthetic */ void lambda$onNextPressed$9$HloginActivity$LoginActivitySmsView(TLRPC.TL_auth_signIn tL_auth_signIn, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject, tL_auth_signIn) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$y58QmHtUQvN3Ra2AGJtFbnJeqos */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLObject f$2;
                private final /* synthetic */ TLRPC.TL_auth_signIn f$3;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                }

                public final void run() {
                    HloginActivity.LoginActivitySmsView.this.lambda$null$8$HloginActivity$LoginActivitySmsView(this.f$1, this.f$2, this.f$3);
                }
            });
        }

        public /* synthetic */ void lambda$null$8$HloginActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, TLObject tLObject, TLRPC.TL_auth_signIn tL_auth_signIn) {
            EditTextBoldCursor[] editTextBoldCursorArr;
            int i;
            int i2;
            boolean z = false;
            if (tL_error == null) {
                this.nextPressed = false;
                HloginActivity.this.needHideProgress(false);
                destroyTimer();
                destroyCodeTimer();
                if (tLObject instanceof TLRPC.TL_auth_authorizationSignUpRequired) {
                    TLRPC.TL_auth_authorizationSignUpRequired tL_auth_authorizationSignUpRequired = (TLRPC.TL_auth_authorizationSignUpRequired) tLObject;
                    if (tL_auth_authorizationSignUpRequired.terms_of_service != null) {
                        HloginActivity.this.currentTermsOfService = tL_auth_authorizationSignUpRequired.terms_of_service;
                    }
                    Bundle bundle = new Bundle();
                    bundle.putString("phoneFormated", this.requestPhone);
                    bundle.putString("phoneHash", this.phoneHash);
                    bundle.putString("code", tL_auth_signIn.phone_code);
                    HloginActivity.this.setPage(5, true, bundle, false);
                } else {
                    HloginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) tLObject);
                }
            } else {
                this.lastError = tL_error.text;
                if (tL_error.text.contains("SESSION_PASSWORD_NEEDED")) {
                    ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate(tL_auth_signIn) {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$RgRSfiKD6ki2vPbzaEBEFXLN1c */
                        private final /* synthetic */ TLRPC.TL_auth_signIn f$1;

                        {
                            this.f$1 = r2;
                        }

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            HloginActivity.LoginActivitySmsView.this.lambda$null$7$HloginActivity$LoginActivitySmsView(this.f$1, tLObject, tL_error);
                        }
                    }, 10);
                    destroyTimer();
                    destroyCodeTimer();
                } else {
                    HloginActivity.this.needHideProgress(false);
                    if ((this.currentType == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) || (this.currentType == 4 && this.nextType == 2))) {
                        createTimer();
                    }
                    int i3 = this.currentType;
                    if (i3 == 2) {
                        AndroidUtilities.setWaitingForSms(true);
                        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
                    } else if (i3 == 3) {
                        AndroidUtilities.setWaitingForCall(true);
                        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
                    }
                    this.waitingForEvent = true;
                    if (this.currentType != 3) {
                        if (tL_error.text.contains("PHONE_NUMBER_INVALID")) {
                            HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
                        } else if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) {
                            HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
                            int i4 = 0;
                            while (true) {
                                editTextBoldCursorArr = this.codeField;
                                if (i4 >= editTextBoldCursorArr.length) {
                                    break;
                                }
                                editTextBoldCursorArr[i4].setText("");
                                i4++;
                            }
                            editTextBoldCursorArr[0].requestFocus();
                        } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                            onBackPressed(true);
                            HloginActivity.this.setPage(0, true, null, true);
                            HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
                        } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                            HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
                        } else {
                            HloginActivity hloginActivity = HloginActivity.this;
                            String string = LocaleController.getString("AppName", R.string.AppName);
                            hloginActivity.needShowAlert(string, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + tL_error.text);
                        }
                    }
                    if (z && this.currentType == 3) {
                        AndroidUtilities.endIncomingCall();
                        return;
                    }
                }
            }
            z = true;
            if (z) {
            }
        }

        public /* synthetic */ void lambda$null$7$HloginActivity$LoginActivitySmsView(TLRPC.TL_auth_signIn tL_auth_signIn, TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject, tL_auth_signIn) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$9kg_ZMDfA0GhgMILoxkThp5su9A */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLObject f$2;
                private final /* synthetic */ TLRPC.TL_auth_signIn f$3;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                    this.f$3 = r4;
                }

                public final void run() {
                    HloginActivity.LoginActivitySmsView.this.lambda$null$6$HloginActivity$LoginActivitySmsView(this.f$1, this.f$2, this.f$3);
                }
            });
        }

        public /* synthetic */ void lambda$null$6$HloginActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, TLObject tLObject, TLRPC.TL_auth_signIn tL_auth_signIn) {
            this.nextPressed = false;
            HloginActivity.this.needHideProgress(false);
            if (tL_error == null) {
                TLRPC.TL_account_password tL_account_password = (TLRPC.TL_account_password) tLObject;
                if (!TwoStepVerificationActivity.canHandleCurrentPassword(tL_account_password, true)) {
                    AlertsCreator.showUpdateAppAlert(HloginActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                    return;
                }
                Bundle bundle = new Bundle();
                if (tL_account_password.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
                    TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) tL_account_password.current_algo;
                    bundle.putString("current_salt1", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt1));
                    bundle.putString("current_salt2", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt2));
                    bundle.putString("current_p", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.p));
                    bundle.putInt("current_g", tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.g);
                    bundle.putString("current_srp_B", Utilities.bytesToHex(tL_account_password.srp_B));
                    bundle.putLong("current_srp_id", tL_account_password.srp_id);
                    bundle.putInt("passwordType", 1);
                }
                String str = "";
                bundle.putString(TrackReferenceTypeBox.TYPE1, tL_account_password.hint != null ? tL_account_password.hint : str);
                if (tL_account_password.email_unconfirmed_pattern != null) {
                    str = tL_account_password.email_unconfirmed_pattern;
                }
                bundle.putString("email_unconfirmed_pattern", str);
                bundle.putString("phoneFormated", this.requestPhone);
                bundle.putString("phoneHash", this.phoneHash);
                bundle.putString("code", tL_auth_signIn.phone_code);
                bundle.putInt("has_recovery", tL_account_password.has_recovery ? 1 : 0);
                HloginActivity.this.setPage(6, true, bundle, false);
                return;
            }
            HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            if (!z) {
                XDialog.Builder builder = new XDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("StopVerification", R.string.StopVerification));
                builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null);
                builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$Q1KAiMTu94EGdNoKo2kyQ6M2iDM */

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivitySmsView.this.lambda$onBackPressed$10$HloginActivity$LoginActivitySmsView(dialogInterface, i);
                    }
                });
                HloginActivity.this.showDialog(builder.create());
                return false;
            }
            this.nextPressed = false;
            HloginActivity.this.needHideProgress(true);
            TLRPC.TL_auth_cancelCode tL_auth_cancelCode = new TLRPC.TL_auth_cancelCode();
            tL_auth_cancelCode.phone_number = this.requestPhone;
            tL_auth_cancelCode.phone_code_hash = this.phoneHash;
            ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_cancelCode, $$Lambda$HloginActivity$LoginActivitySmsView$VF2VgaGjLTCIyjPDF927d0B8rnI.INSTANCE, 10);
            destroyTimer();
            destroyCodeTimer();
            this.currentParams = null;
            int i = this.currentType;
            if (i == 2) {
                AndroidUtilities.setWaitingForSms(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
            } else if (i == 3) {
                AndroidUtilities.setWaitingForCall(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
            }
            this.waitingForEvent = false;
            return true;
        }

        public /* synthetic */ void lambda$onBackPressed$10$HloginActivity$LoginActivitySmsView(DialogInterface dialogInterface, int i) {
            onBackPressed(true);
            HloginActivity.this.setPage(0, true, null, true);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onDestroyActivity() {
            super.onDestroyActivity();
            int i = this.currentType;
            if (i == 2) {
                AndroidUtilities.setWaitingForSms(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
            } else if (i == 3) {
                AndroidUtilities.setWaitingForCall(false);
                NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
            }
            this.waitingForEvent = false;
            destroyTimer();
            destroyCodeTimer();
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            if (this.currentType != 3) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivitySmsView$RBc_F89KJMkRJakq17rW7JaILjY */

                    public final void run() {
                        HloginActivity.LoginActivitySmsView.this.lambda$onShow$12$HloginActivity$LoginActivitySmsView();
                    }
                }, 100);
            }
        }

        public /* synthetic */ void lambda$onShow$12$HloginActivity$LoginActivitySmsView() {
            EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
            if (editTextBoldCursorArr != null) {
                for (int length2 = editTextBoldCursorArr.length - 1; length2 >= 0; length2--) {
                    if (length2 == 0 || this.codeField[length2].length() != 0) {
                        this.codeField[length2].requestFocus();
                        EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
                        editTextBoldCursorArr2[length2].setSelection(editTextBoldCursorArr2[length2].length());
                        AndroidUtilities.showKeyboard(this.codeField[length2]);
                        return;
                    }
                }
            }
        }

        @Override // im.guobwnxjuc.messenger.NotificationCenter.NotificationCenterDelegate
        public void didReceivedNotification(int i, int i2, Object... objArr) {
            if (this.waitingForEvent && this.codeField != null) {
                if (i == NotificationCenter.didReceiveSmsCode) {
                    this.codeField[0].setText("" + objArr[0]);
                    onNextPressed();
                } else if (i == NotificationCenter.didReceiveCall) {
                    String str = "" + objArr[0];
                    if (AndroidUtilities.checkPhonePattern(this.pattern, str)) {
                        if (!this.pattern.equals("*")) {
                            this.catchedPhone = str;
                            AndroidUtilities.endIncomingCall();
                        }
                        this.ignoreOnTextChange = true;
                        this.codeField[0].setText(str);
                        this.ignoreOnTextChange = false;
                        onNextPressed();
                    }
                }
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            String code = getCode();
            if (code.length() != 0) {
                bundle.putString("smsview_code_" + this.currentType, code);
            }
            String str = this.catchedPhone;
            if (str != null) {
                bundle.putString("catchedPhone", str);
            }
            if (this.currentParams != null) {
                bundle.putBundle("smsview_params_" + this.currentType, this.currentParams);
            }
            int i = this.time;
            if (i != 0) {
                bundle.putInt("time", i);
            }
            int i2 = this.openTime;
            if (i2 != 0) {
                bundle.putInt("open", i2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            EditTextBoldCursor[] editTextBoldCursorArr;
            Bundle bundle2 = bundle.getBundle("smsview_params_" + this.currentType);
            this.currentParams = bundle2;
            if (bundle2 != null) {
                setParams(bundle2, true);
            }
            String string = bundle.getString("catchedPhone");
            if (string != null) {
                this.catchedPhone = string;
            }
            String string2 = bundle.getString("smsview_code_" + this.currentType);
            if (!(string2 == null || (editTextBoldCursorArr = this.codeField) == null)) {
                editTextBoldCursorArr[0].setText(string2);
            }
            int i = bundle.getInt("time");
            if (i != 0) {
                this.time = i;
            }
            int i2 = bundle.getInt("open");
            if (i2 != 0) {
                this.openTime = i2;
            }
        }
    }

    public class LoginActivityPasswordView extends SlideView {
        private TextView cancelButton;
        private EditTextBoldCursor codeField;
        private TextView confirmTextView;
        private Bundle currentParams;
        private int current_g;
        private byte[] current_p;
        private byte[] current_salt1;
        private byte[] current_salt2;
        private byte[] current_srp_B;
        private long current_srp_id;
        private String email_unconfirmed_pattern;
        private boolean has_recovery;
        private String hint;
        private boolean nextPressed;
        private int passwordType;
        private String phoneCode;
        private String phoneHash;
        private String requestPhone;
        private TextView resetAccountButton;
        private TextView resetAccountText;

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public LoginActivityPasswordView(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.confirmTextView = textView;
            textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.confirmTextView.setTextSize(1, 14.0f);
            int i = 5;
            this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.confirmTextView.setText(LocaleController.getString("LoginPasswordText", R.string.LoginPasswordText));
            addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.codeField = editTextBoldCursor;
            editTextBoldCursor.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.codeField.setCursorWidth(1.5f);
            this.codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
            this.codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
            this.codeField.setImeOptions(268435461);
            this.codeField.setTextSize(1, 18.0f);
            this.codeField.setMaxLines(1);
            this.codeField.setPadding(0, 0, 0, 0);
            this.codeField.setInputType(TsExtractor.TS_STREAM_TYPE_AC3);
            this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.codeField.setTypeface(Typeface.DEFAULT);
            this.codeField.setGravity(LocaleController.isRTL ? 5 : 3);
            addView(this.codeField, LayoutHelper.createLinear(-1, 36, 1, 0, 20, 0, 0));
            this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$jmAzVANv6Z3GN7AT9VjVcn6RbFc */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.LoginActivityPasswordView.this.lambda$new$0$HloginActivity$LoginActivityPasswordView(textView, i, keyEvent);
                }
            });
            TextView textView2 = new TextView(context);
            this.cancelButton = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            this.cancelButton.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
            this.cancelButton.setTextSize(1, 14.0f);
            this.cancelButton.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.cancelButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.cancelButton, LayoutHelper.createLinear(-1, -2, (LocaleController.isRTL ? 5 : 3) | 48));
            this.cancelButton.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$uO8NPfyHK4D6MRwh_i6Annl2_Ao */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityPasswordView.this.lambda$new$4$HloginActivity$LoginActivityPasswordView(view);
                }
            });
            TextView textView3 = new TextView(context);
            this.resetAccountButton = textView3;
            textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText6));
            this.resetAccountButton.setVisibility(8);
            this.resetAccountButton.setText(LocaleController.getString("ResetMyAccount", R.string.ResetMyAccount));
            this.resetAccountButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.resetAccountButton.setTextSize(1, 14.0f);
            this.resetAccountButton.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.resetAccountButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.resetAccountButton, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 34, 0, 0));
            this.resetAccountButton.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$a1XHNACnWRjZe7VlLdqo6YTdaw */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityPasswordView.this.lambda$new$8$HloginActivity$LoginActivityPasswordView(view);
                }
            });
            TextView textView4 = new TextView(context);
            this.resetAccountText = textView4;
            textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.resetAccountText.setVisibility(8);
            this.resetAccountText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.resetAccountText.setText(LocaleController.getString("ResetMyAccountText", R.string.ResetMyAccountText));
            this.resetAccountText.setTextSize(1, 14.0f);
            this.resetAccountText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.resetAccountText, LayoutHelper.createLinear(-2, -2, (!LocaleController.isRTL ? 3 : i) | 48, 0, 7, 0, 14));
        }

        public /* synthetic */ boolean lambda$new$0$HloginActivity$LoginActivityPasswordView(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        public /* synthetic */ void lambda$new$4$HloginActivity$LoginActivityPasswordView(View view) {
            if (HloginActivity.this.doneProgressView.getTag() == null) {
                if (this.has_recovery) {
                    HloginActivity.this.needShowProgress(0);
                    ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(new TLRPC.TL_auth_requestPasswordRecovery(), new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$TUQFZCuk88MTXhRvlRwqaOIVOT0 */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            HloginActivity.LoginActivityPasswordView.this.lambda$null$3$HloginActivity$LoginActivityPasswordView(tLObject, tL_error);
                        }
                    }, 10);
                    return;
                }
                this.resetAccountText.setVisibility(0);
                this.resetAccountButton.setVisibility(0);
                AndroidUtilities.hideKeyboard(this.codeField);
                HloginActivity.this.needShowAlert(LocaleController.getString("RestorePasswordNoEitle", R.string.RestorePasswordNoEmailTitle), LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
            }
        }

        public /* synthetic */ void lambda$null$3$HloginActivity$LoginActivityPasswordView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$CFen6Z_e06MT0vUZrmIYE0dNo */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLObject f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$2$HloginActivity$LoginActivityPasswordView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$2$HloginActivity$LoginActivityPasswordView(TLRPC.TL_error tL_error, TLObject tLObject) {
            String str;
            HloginActivity.this.needHideProgress(false);
            if (tL_error == null) {
                TLRPC.TL_auth_passwordRecovery tL_auth_passwordRecovery = (TLRPC.TL_auth_passwordRecovery) tLObject;
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setMessage(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, tL_auth_passwordRecovery.email_pattern));
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(tL_auth_passwordRecovery) {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$8mDQrMeGzWg9XNKoZhdAq3Mdvc */
                    private final /* synthetic */ TLRPC.TL_auth_passwordRecovery f$1;

                    {
                        this.f$1 = r2;
                    }

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivityPasswordView.this.lambda$null$1$HloginActivity$LoginActivityPasswordView(this.f$1, dialogInterface, i);
                    }
                });
                Dialog showDialog = HloginActivity.this.showDialog(builder.create());
                if (showDialog != null) {
                    showDialog.setCanceledOnTouchOutside(false);
                    showDialog.setCancelable(false);
                }
            } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                int intValue = Utilities.parseInt(tL_error.text).intValue();
                if (intValue < 60) {
                    str = LocaleController.formatPluralString("Seconds", intValue);
                } else {
                    str = LocaleController.formatPluralString("Minutes", intValue / 60);
                }
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
            } else {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            }
        }

        public /* synthetic */ void lambda$null$1$HloginActivity$LoginActivityPasswordView(TLRPC.TL_auth_passwordRecovery tL_auth_passwordRecovery, DialogInterface dialogInterface, int i) {
            Bundle bundle = new Bundle();
            bundle.putString("email_unconfirmed_pattern", tL_auth_passwordRecovery.email_pattern);
            HloginActivity.this.setPage(7, true, bundle, false);
        }

        public /* synthetic */ void lambda$new$8$HloginActivity$LoginActivityPasswordView(View view) {
            if (HloginActivity.this.doneProgressView.getTag() == null) {
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setMessage(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
                builder.setTitle(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
                builder.setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$8HoiiTTrbWJmkL7tCbpN6mSdZU */

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivityPasswordView.this.lambda$null$7$HloginActivity$LoginActivityPasswordView(dialogInterface, i);
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                HloginActivity.this.showDialog(builder.create());
            }
        }

        public /* synthetic */ void lambda$null$7$HloginActivity$LoginActivityPasswordView(DialogInterface dialogInterface, int i) {
            HloginActivity.this.needShowProgress(0);
            TLRPC.TL_account_deleteAccount tL_account_deleteAccount = new TLRPC.TL_account_deleteAccount();
            tL_account_deleteAccount.reason = "Forgot password";
            ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_account_deleteAccount, new RequestDelegate() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$LSdNckTyeAJhV1qU2cImwd5NE */

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$6$HloginActivity$LoginActivityPasswordView(tLObject, tL_error);
                }
            }, 10);
        }

        public /* synthetic */ void lambda$null$6$HloginActivity$LoginActivityPasswordView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$4nHA06w99cnk_TqHBTe6vRzDIQ */
                private final /* synthetic */ TLRPC.TL_error f$1;

                {
                    this.f$1 = r2;
                }

                public final void run() {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$5$HloginActivity$LoginActivityPasswordView(this.f$1);
                }
            });
        }

        public /* synthetic */ void lambda$null$5$HloginActivity$LoginActivityPasswordView(TLRPC.TL_error tL_error) {
            HloginActivity.this.needHideProgress(false);
            if (tL_error == null) {
                Bundle bundle = new Bundle();
                bundle.putString("phoneFormated", this.requestPhone);
                bundle.putString("phoneHash", this.phoneHash);
                bundle.putString("code", this.phoneCode);
                HloginActivity.this.setPage(5, true, bundle, false);
            } else if (tL_error.text.equals("2FA_RECENT_CONFIRM")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
            } else if (tL_error.text.startsWith("2FA_CONFIRM_WAIT_")) {
                Bundle bundle2 = new Bundle();
                bundle2.putString("phoneFormated", this.requestPhone);
                bundle2.putString("phoneHash", this.phoneHash);
                bundle2.putString("code", this.phoneCode);
                bundle2.putInt("startTime", ConnectionsManager.getInstance(HloginActivity.this.currentAccount).getCurrentTime());
                bundle2.putInt("waitTime", Utilities.parseInt(tL_error.text.replace("2FA_CONFIRM_WAIT_", "")).intValue());
                HloginActivity.this.setPage(8, true, bundle2, false);
            } else {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            return LocaleController.getString("LoginPassword", R.string.LoginPassword);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            if (bundle != null) {
                boolean z2 = false;
                if (bundle.isEmpty()) {
                    this.resetAccountButton.setVisibility(0);
                    this.resetAccountText.setVisibility(0);
                    AndroidUtilities.hideKeyboard(this.codeField);
                    return;
                }
                this.resetAccountButton.setVisibility(8);
                this.resetAccountText.setVisibility(8);
                this.codeField.setText("");
                this.currentParams = bundle;
                this.current_salt1 = Utilities.hexToBytes(bundle.getString("current_salt1"));
                this.current_salt2 = Utilities.hexToBytes(this.currentParams.getString("current_salt2"));
                this.current_p = Utilities.hexToBytes(this.currentParams.getString("current_p"));
                this.current_g = this.currentParams.getInt("current_g");
                this.current_srp_B = Utilities.hexToBytes(this.currentParams.getString("current_srp_B"));
                this.current_srp_id = this.currentParams.getLong("current_srp_id");
                this.passwordType = this.currentParams.getInt("passwordType");
                this.hint = this.currentParams.getString(TrackReferenceTypeBox.TYPE1);
                if (this.currentParams.getInt("has_recovery") == 1) {
                    z2 = true;
                }
                this.has_recovery = z2;
                this.email_unconfirmed_pattern = this.currentParams.getString("email_unconfirmed_pattern");
                this.requestPhone = bundle.getString("phoneFormated");
                this.phoneHash = bundle.getString("phoneHash");
                this.phoneCode = bundle.getString("code");
                String str = this.hint;
                if (str == null || str.length() <= 0) {
                    this.codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
                } else {
                    this.codeField.setHint(this.hint);
                }
            }
        }

        private void onPasscodeError(boolean z) {
            if (HloginActivity.this.getParentActivity() != null) {
                Vibrator vibrator = (Vibrator) HloginActivity.this.getParentActivity().getSystemService("vibrator");
                if (vibrator != null) {
                    vibrator.vibrate(200);
                }
                if (z) {
                    this.codeField.setText("");
                }
                AndroidUtilities.shakeView(this.confirmTextView, 2.0f, 0);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (!this.nextPressed) {
                String obj = this.codeField.getText().toString();
                if (obj.length() == 0) {
                    onPasscodeError(false);
                    return;
                }
                this.nextPressed = true;
                HloginActivity.this.needShowProgress(0);
                Utilities.globalQueue.postRunnable(new Runnable(obj) {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$cWmmzkU53MAforuKV25XsJbpsE */
                    private final /* synthetic */ String f$1;

                    {
                        this.f$1 = r2;
                    }

                    public final void run() {
                        HloginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$13$HloginActivity$LoginActivityPasswordView(this.f$1);
                    }
                });
            }
        }

        public /* synthetic */ void lambda$onNextPressed$13$HloginActivity$LoginActivityPasswordView(String str) {
            TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
            if (this.passwordType == 1) {
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = new TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow();
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt1 = this.current_salt1;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt2 = this.current_salt2;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.g = this.current_g;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.p = this.current_p;
            } else {
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = null;
            }
            boolean z = tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
            byte[] x = z ? SRPHelper.getX(AndroidUtilities.getStringBytes(str), tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) : null;
            TLRPC.TL_auth_checkPassword tL_auth_checkPassword = new TLRPC.TL_auth_checkPassword();
            $$Lambda$HloginActivity$LoginActivityPasswordView$wZ_hJu6BeFZX1MomAL6BQd96cY0 r4 = new RequestDelegate() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$wZ_hJu6BeFZX1MomAL6BQd96cY0 */

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$12$HloginActivity$LoginActivityPasswordView(tLObject, tL_error);
                }
            };
            if (z) {
                TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2 = tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2.salt1 = this.current_salt1;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2.salt2 = this.current_salt2;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2.g = this.current_g;
                tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2.p = this.current_p;
                tL_auth_checkPassword.password = SRPHelper.startCheck(x, this.current_srp_id, this.current_srp_B, tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow2);
                if (tL_auth_checkPassword.password == null) {
                    TLRPC.TL_error tL_error = new TLRPC.TL_error();
                    tL_error.text = "PASSWORD_HASH_INVALID";
                    r4.run(null, tL_error);
                    return;
                }
                ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_checkPassword, r4, 10);
            }
        }

        public /* synthetic */ void lambda$null$12$HloginActivity$LoginActivityPasswordView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$XJM8VtHzzWY388cNDEstd7K1QY */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLObject f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$11$HloginActivity$LoginActivityPasswordView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$11$HloginActivity$LoginActivityPasswordView(TLRPC.TL_error tL_error, TLObject tLObject) {
            String str;
            this.nextPressed = false;
            if (tL_error == null || !"SRP_ID_INVALID".equals(tL_error.text)) {
                HloginActivity.this.needHideProgress(false);
                if (tLObject instanceof TLRPC.TL_auth_authorization) {
                    HloginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) tLObject);
                } else if (tL_error.text.equals("PASSWORD_HASH_INVALID")) {
                    onPasscodeError(true);
                } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                    int intValue = Utilities.parseInt(tL_error.text).intValue();
                    if (intValue < 60) {
                        str = LocaleController.formatPluralString("Seconds", intValue);
                    } else {
                        str = LocaleController.formatPluralString("Minutes", intValue / 60);
                    }
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
                } else {
                    HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
                }
            } else {
                ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(new TLRPC.TL_account_getPassword(), new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$OLyIFZ9K0F60CLrxCkbMFmvJNt8 */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        HloginActivity.LoginActivityPasswordView.this.lambda$null$10$HloginActivity$LoginActivityPasswordView(tLObject, tL_error);
                    }
                }, 8);
            }
        }

        public /* synthetic */ void lambda$null$10$HloginActivity$LoginActivityPasswordView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$DfTAxH9q4ybkELGuHcPPrVmXxXc */
                private final /* synthetic */ TLRPC.TL_error f$1;
                private final /* synthetic */ TLObject f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.LoginActivityPasswordView.this.lambda$null$9$HloginActivity$LoginActivityPasswordView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$9$HloginActivity$LoginActivityPasswordView(TLRPC.TL_error tL_error, TLObject tLObject) {
            if (tL_error == null) {
                TLRPC.TL_account_password tL_account_password = (TLRPC.TL_account_password) tLObject;
                this.current_srp_B = tL_account_password.srp_B;
                this.current_srp_id = tL_account_password.srp_id;
                onNextPressed();
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            this.nextPressed = false;
            HloginActivity.this.needHideProgress(true);
            this.currentParams = null;
            return true;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityPasswordView$eeIbh8TxzE3XVXDlpx4cqbLE4XI */

                public final void run() {
                    HloginActivity.LoginActivityPasswordView.this.lambda$onShow$14$HloginActivity$LoginActivityPasswordView();
                }
            }, 100);
        }

        public /* synthetic */ void lambda$onShow$14$HloginActivity$LoginActivityPasswordView() {
            EditTextBoldCursor editTextBoldCursor = this.codeField;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.codeField;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
                AndroidUtilities.showKeyboard(this.codeField);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            String obj = this.codeField.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("passview_code", obj);
            }
            Bundle bundle2 = this.currentParams;
            if (bundle2 != null) {
                bundle.putBundle("passview_params", bundle2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("passview_params");
            this.currentParams = bundle2;
            if (bundle2 != null) {
                setParams(bundle2, true);
            }
            String string = bundle.getString("passview_code");
            if (string != null) {
                this.codeField.setText(string);
            }
        }
    }

    public class LoginActivityResetWaitView extends SlideView {
        private TextView confirmTextView;
        private Bundle currentParams;
        private String phoneCode;
        private String phoneHash;
        private String requestPhone;
        private TextView resetAccountButton;
        private TextView resetAccountText;
        private TextView resetAccountTime;
        private int startTime;
        private Runnable timeRunnable;
        private int waitTime;

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public LoginActivityResetWaitView(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.confirmTextView = textView;
            textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.confirmTextView.setTextSize(1, 14.0f);
            int i = 5;
            this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
            TextView textView2 = new TextView(context);
            this.resetAccountText = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.resetAccountText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.resetAccountText.setText(LocaleController.getString("ResetAccountStatus", R.string.ResetAccountStatus));
            this.resetAccountText.setTextSize(1, 14.0f);
            this.resetAccountText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.resetAccountText, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 24, 0, 0));
            TextView textView3 = new TextView(context);
            this.resetAccountTime = textView3;
            textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.resetAccountTime.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.resetAccountTime.setTextSize(1, 14.0f);
            this.resetAccountTime.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.resetAccountTime, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 2, 0, 0));
            TextView textView4 = new TextView(context);
            this.resetAccountButton = textView4;
            textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.resetAccountButton.setText(LocaleController.getString("ResetAccountButton", R.string.ResetAccountButton));
            this.resetAccountButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.resetAccountButton.setTextSize(1, 14.0f);
            this.resetAccountButton.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.resetAccountButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.resetAccountButton, LayoutHelper.createLinear(-2, -2, (!LocaleController.isRTL ? 3 : i) | 48, 0, 7, 0, 0));
            this.resetAccountButton.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityResetWaitView$On_vQdhT1TwaTtOUP3hWSeVvd_0 */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityResetWaitView.this.lambda$new$3$HloginActivity$LoginActivityResetWaitView(view);
                }
            });
        }

        public /* synthetic */ void lambda$new$3$HloginActivity$LoginActivityResetWaitView(View view) {
            if (HloginActivity.this.doneProgressView.getTag() == null && Math.abs(ConnectionsManager.getInstance(HloginActivity.this.currentAccount).getCurrentTime() - this.startTime) >= this.waitTime) {
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setMessage(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
                builder.setTitle(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
                builder.setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityResetWaitView$yJT4SAseV8KTfRKYYriLw04fm6M */

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivityResetWaitView.this.lambda$null$2$HloginActivity$LoginActivityResetWaitView(dialogInterface, i);
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                HloginActivity.this.showDialog(builder.create());
            }
        }

        public /* synthetic */ void lambda$null$2$HloginActivity$LoginActivityResetWaitView(DialogInterface dialogInterface, int i) {
            HloginActivity.this.needShowProgress(0);
            TLRPC.TL_account_deleteAccount tL_account_deleteAccount = new TLRPC.TL_account_deleteAccount();
            tL_account_deleteAccount.reason = "Forgot password";
            ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_account_deleteAccount, new RequestDelegate() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityResetWaitView$YTI1HZW34zSPU2v9xcgQwX5Tok */

                @Override // im.guobwnxjuc.tgnet.RequestDelegate
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    HloginActivity.LoginActivityResetWaitView.this.lambda$null$1$HloginActivity$LoginActivityResetWaitView(tLObject, tL_error);
                }
            }, 10);
        }

        public /* synthetic */ void lambda$null$1$HloginActivity$LoginActivityResetWaitView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityResetWaitView$XTKAn8VQcSOgYW_q1PXLnS8aLo */
                private final /* synthetic */ TLRPC.TL_error f$1;

                {
                    this.f$1 = r2;
                }

                public final void run() {
                    HloginActivity.LoginActivityResetWaitView.this.lambda$null$0$HloginActivity$LoginActivityResetWaitView(this.f$1);
                }
            });
        }

        public /* synthetic */ void lambda$null$0$HloginActivity$LoginActivityResetWaitView(TLRPC.TL_error tL_error) {
            HloginActivity.this.needHideProgress(false);
            if (tL_error == null) {
                Bundle bundle = new Bundle();
                bundle.putString("phoneFormated", this.requestPhone);
                bundle.putString("phoneHash", this.phoneHash);
                bundle.putString("code", this.phoneCode);
                HloginActivity.this.setPage(5, true, bundle, false);
            } else if (tL_error.text.equals("2FA_RECENT_CONFIRM")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
            } else {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            return LocaleController.getString("ResetAccount", R.string.ResetAccount);
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void updateTimeText() {
            int max = Math.max(0, this.waitTime - (ConnectionsManager.getInstance(HloginActivity.this.currentAccount).getCurrentTime() - this.startTime));
            int i = max / CacheConstants.DAY;
            int i2 = max - (CacheConstants.DAY * i);
            int i3 = i2 / CacheConstants.HOUR;
            int i4 = (i2 - (i3 * CacheConstants.HOUR)) / 60;
            int i5 = max % 60;
            if (i != 0) {
                TextView textView = this.resetAccountTime;
                textView.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("DaysBold", i) + " " + LocaleController.formatPluralString("HoursBold", i3) + " " + LocaleController.formatPluralString("MinutesBold", i4)));
            } else {
                TextView textView2 = this.resetAccountTime;
                textView2.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("HoursBold", i3) + " " + LocaleController.formatPluralString("MinutesBold", i4) + " " + LocaleController.formatPluralString("SecondsBold", i5)));
            }
            if (max > 0) {
                this.resetAccountButton.setTag(Theme.key_windowBackgroundWhiteGrayText6);
                this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
                return;
            }
            this.resetAccountButton.setTag(Theme.key_windowBackgroundWhiteRedText6);
            this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText6));
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            if (bundle != null) {
                this.currentParams = bundle;
                this.requestPhone = bundle.getString("phoneFormated");
                this.phoneHash = bundle.getString("phoneHash");
                this.phoneCode = bundle.getString("code");
                this.startTime = bundle.getInt("startTime");
                this.waitTime = bundle.getInt("waitTime");
                TextView textView = this.confirmTextView;
                PhoneFormat instance = PhoneFormat.getInstance();
                textView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("ResetAccountInfo", R.string.ResetAccountInfo, LocaleController.addNbsp(instance.format(Marker.ANY_NON_NULL_MARKER + this.requestPhone)))));
                updateTimeText();
                AnonymousClass1 r6 = new Runnable() {
                    /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityResetWaitView.AnonymousClass1 */

                    public void run() {
                        if (LoginActivityResetWaitView.this.timeRunnable == this) {
                            LoginActivityResetWaitView.this.updateTimeText();
                            AndroidUtilities.runOnUIThread(LoginActivityResetWaitView.this.timeRunnable, 1000);
                        }
                    }
                };
                this.timeRunnable = r6;
                AndroidUtilities.runOnUIThread(r6, 1000);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            HloginActivity.this.needHideProgress(true);
            AndroidUtilities.cancelRunOnUIThread(this.timeRunnable);
            this.timeRunnable = null;
            this.currentParams = null;
            return true;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            Bundle bundle2 = this.currentParams;
            if (bundle2 != null) {
                bundle.putBundle("resetview_params", bundle2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("resetview_params");
            this.currentParams = bundle2;
            if (bundle2 != null) {
                setParams(bundle2, true);
            }
        }
    }

    public class LoginActivityRecoverView extends SlideView {
        private TextView cancelButton;
        private EditTextBoldCursor codeField;
        private TextView confirmTextView;
        private Bundle currentParams;
        private String email_unconfirmed_pattern;
        private boolean nextPressed;

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public LoginActivityRecoverView(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.confirmTextView = textView;
            textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.confirmTextView.setTextSize(1, 14.0f);
            int i = 5;
            this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.confirmTextView.setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo));
            addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.codeField = editTextBoldCursor;
            editTextBoldCursor.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.codeField.setCursorWidth(1.5f);
            this.codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
            this.codeField.setHint(LocaleController.getString("PasswordCode", R.string.PasswordCode));
            this.codeField.setImeOptions(268435461);
            this.codeField.setTextSize(1, 18.0f);
            this.codeField.setMaxLines(1);
            this.codeField.setPadding(0, 0, 0, 0);
            this.codeField.setInputType(3);
            this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.codeField.setTypeface(Typeface.DEFAULT);
            this.codeField.setGravity(LocaleController.isRTL ? 5 : 3);
            addView(this.codeField, LayoutHelper.createLinear(-1, 36, 1, 0, 20, 0, 0));
            this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$KcuK6iTfTbXeiR9CR1wJLudsS8g */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.LoginActivityRecoverView.this.lambda$new$0$HloginActivity$LoginActivityRecoverView(textView, i, keyEvent);
                }
            });
            TextView textView2 = new TextView(context);
            this.cancelButton = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 80);
            this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            this.cancelButton.setTextSize(1, 14.0f);
            this.cancelButton.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.cancelButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.cancelButton, LayoutHelper.createLinear(-2, -2, (!LocaleController.isRTL ? 3 : i) | 80, 0, 0, 0, 14));
            this.cancelButton.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$YFPhTePL1cfZ_CqYyfqDjqyCVXU */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityRecoverView.this.lambda$new$2$HloginActivity$LoginActivityRecoverView(view);
                }
            });
        }

        public /* synthetic */ boolean lambda$new$0$HloginActivity$LoginActivityRecoverView(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        public /* synthetic */ void lambda$new$2$HloginActivity$LoginActivityRecoverView(View view) {
            AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
            builder.setMessage(LocaleController.getString("RestoreEmailTroubleText", R.string.RestoreEmailTroubleText));
            builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$aRodDnfoFWDD_s7XlVVcntI8nuY */

                public final void onClick(DialogInterface dialogInterface, int i) {
                    HloginActivity.LoginActivityRecoverView.this.lambda$null$1$HloginActivity$LoginActivityRecoverView(dialogInterface, i);
                }
            });
            Dialog showDialog = HloginActivity.this.showDialog(builder.create());
            if (showDialog != null) {
                showDialog.setCanceledOnTouchOutside(false);
                showDialog.setCancelable(false);
            }
        }

        public /* synthetic */ void lambda$null$1$HloginActivity$LoginActivityRecoverView(DialogInterface dialogInterface, int i) {
            HloginActivity.this.setPage(6, true, new Bundle(), true);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            return LocaleController.getString("LoginPassword", R.string.LoginPassword);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            if (bundle != null) {
                this.codeField.setText("");
                this.currentParams = bundle;
                String string = bundle.getString("email_unconfirmed_pattern");
                this.email_unconfirmed_pattern = string;
                this.cancelButton.setText(LocaleController.formatString("RestoreEmailTrouble", R.string.RestoreEmailTrouble, string));
                AndroidUtilities.showKeyboard(this.codeField);
                this.codeField.requestFocus();
            }
        }

        private void onPasscodeError(boolean z) {
            if (HloginActivity.this.getParentActivity() != null) {
                Vibrator vibrator = (Vibrator) HloginActivity.this.getParentActivity().getSystemService("vibrator");
                if (vibrator != null) {
                    vibrator.vibrate(200);
                }
                if (z) {
                    this.codeField.setText("");
                }
                AndroidUtilities.shakeView(this.confirmTextView, 2.0f, 0);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (!this.nextPressed) {
                if (this.codeField.getText().toString().length() == 0) {
                    onPasscodeError(false);
                    return;
                }
                this.nextPressed = true;
                String obj = this.codeField.getText().toString();
                if (obj.length() == 0) {
                    onPasscodeError(false);
                    return;
                }
                HloginActivity.this.needShowProgress(0);
                TLRPC.TL_auth_recoverPassword tL_auth_recoverPassword = new TLRPC.TL_auth_recoverPassword();
                tL_auth_recoverPassword.code = obj;
                ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_recoverPassword, new RequestDelegate() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$plCMtuFu2IfxQteXcHpqR9JgiY0 */

                    @Override // im.guobwnxjuc.tgnet.RequestDelegate
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        HloginActivity.LoginActivityRecoverView.this.lambda$onNextPressed$5$HloginActivity$LoginActivityRecoverView(tLObject, tL_error);
                    }
                }, 10);
            }
        }

        public /* synthetic */ void lambda$onNextPressed$5$HloginActivity$LoginActivityRecoverView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tLObject, tL_error) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$GiCzdg71tWvbyQuLSXFydee0Ew */
                private final /* synthetic */ TLObject f$1;
                private final /* synthetic */ TLRPC.TL_error f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.LoginActivityRecoverView.this.lambda$null$4$HloginActivity$LoginActivityRecoverView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$null$4$HloginActivity$LoginActivityRecoverView(TLObject tLObject, TLRPC.TL_error tL_error) {
            String str;
            HloginActivity.this.needHideProgress(false);
            this.nextPressed = false;
            if (tLObject instanceof TLRPC.TL_auth_authorization) {
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener(tLObject) {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$4RSmiSCd6WegoM9Qk0QpQ72vK8 */
                    private final /* synthetic */ TLObject f$1;

                    {
                        this.f$1 = r2;
                    }

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivityRecoverView.this.lambda$null$3$HloginActivity$LoginActivityRecoverView(this.f$1, dialogInterface, i);
                    }
                });
                builder.setMessage(LocaleController.getString("PasswordReset", R.string.PasswordReset));
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                Dialog showDialog = HloginActivity.this.showDialog(builder.create());
                if (showDialog != null) {
                    showDialog.setCanceledOnTouchOutside(false);
                    showDialog.setCancelable(false);
                }
            } else if (tL_error.text.startsWith("CODE_INVALID")) {
                onPasscodeError(true);
            } else if (tL_error.text.startsWith("FLOOD_WAIT")) {
                int intValue = Utilities.parseInt(tL_error.text).intValue();
                if (intValue < 60) {
                    str = LocaleController.formatPluralString("Seconds", intValue);
                } else {
                    str = LocaleController.formatPluralString("Minutes", intValue / 60);
                }
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, str));
            } else {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            }
        }

        public /* synthetic */ void lambda$null$3$HloginActivity$LoginActivityRecoverView(TLObject tLObject, DialogInterface dialogInterface, int i) {
            HloginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) tLObject);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            HloginActivity.this.needHideProgress(true);
            this.currentParams = null;
            this.nextPressed = false;
            return true;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRecoverView$dVdl50b8WfX97jLJGwz1CRbgT5Q */

                public final void run() {
                    HloginActivity.LoginActivityRecoverView.this.lambda$onShow$6$HloginActivity$LoginActivityRecoverView();
                }
            }, 100);
        }

        public /* synthetic */ void lambda$onShow$6$HloginActivity$LoginActivityRecoverView() {
            EditTextBoldCursor editTextBoldCursor = this.codeField;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.codeField;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            String obj = this.codeField.getText().toString();
            if (!(obj == null || obj.length() == 0)) {
                bundle.putString("recoveryview_code", obj);
            }
            Bundle bundle2 = this.currentParams;
            if (bundle2 != null) {
                bundle.putBundle("recoveryview_params", bundle2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("recoveryview_params");
            this.currentParams = bundle2;
            if (bundle2 != null) {
                setParams(bundle2, true);
            }
            String string = bundle.getString("recoveryview_code");
            if (string != null) {
                this.codeField.setText(string);
            }
        }
    }

    public class LoginActivityRegisterView extends SlideView implements ImageUpdater.ImageUpdaterDelegate {
        private TLRPC.FileLocation avatar;
        private AnimatorSet avatarAnimation;
        private TLRPC.FileLocation avatarBig;
        private AvatarDrawable avatarDrawable;
        private ImageView avatarEditor;
        private BackupImageView avatarImage;
        private View avatarOverlay;
        private RadialProgressView avatarProgressView;
        private boolean createAfterUpload;
        private Bundle currentParams;
        private EditTextBoldCursor firstNameField;
        private ImageUpdater imageUpdater;
        private EditTextBoldCursor lastNameField;
        private boolean nextPressed = false;
        private String phoneCode;
        private String phoneHash;
        private TextView privacyView;
        private String requestPhone;
        private TextView textView;
        private TLRPC.InputFile uploadedAvatar;
        private TextView wrongNumber;

        @Override // im.guobwnxjuc.ui.components.ImageUpdater.ImageUpdaterDelegate
        public /* synthetic */ void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList, boolean z, int i) {
            ImageUpdater.ImageUpdaterDelegate.CC.$default$didSelectPhotos(this, arrayList, z, i);
        }

        @Override // im.guobwnxjuc.ui.components.ImageUpdater.ImageUpdaterDelegate
        public /* synthetic */ String getInitialSearchString() {
            return ImageUpdater.ImageUpdaterDelegate.CC.$default$getInitialSearchString(this);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean needBackButton() {
            return true;
        }

        public class LinkSpan extends ClickableSpan {
            public LinkSpan() {
            }

            public void updateDrawState(TextPaint textPaint) {
                super.updateDrawState(textPaint);
                textPaint.setUnderlineText(false);
            }

            public void onClick(View view) {
                LoginActivityRegisterView.this.showTermsOfService(false);
            }
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private void showTermsOfService(boolean z) {
            if (HloginActivity.this.currentTermsOfService != null) {
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService));
                if (z) {
                    builder.setPositiveButton(LocaleController.getString("Accept", R.string.Accept), new DialogInterface.OnClickListener() {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$KiWkHNr_klXhNDCL4BkcVg6Ek */

                        public final void onClick(DialogInterface dialogInterface, int i) {
                            HloginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$0$HloginActivity$LoginActivityRegisterView(dialogInterface, i);
                        }
                    });
                    builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$NUxn1SB9CuUI0CGD7X4E6CY4v1k */

                        public final void onClick(DialogInterface dialogInterface, int i) {
                            HloginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$3$HloginActivity$LoginActivityRegisterView(dialogInterface, i);
                        }
                    });
                } else {
                    builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
                }
                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(HloginActivity.this.currentTermsOfService.text);
                MessageObject.addEntitiesToText(spannableStringBuilder, HloginActivity.this.currentTermsOfService.entities, false, 0, false, false, false);
                builder.setMessage(spannableStringBuilder);
                HloginActivity.this.showDialog(builder.create());
            }
        }

        public /* synthetic */ void lambda$showTermsOfService$0$HloginActivity$LoginActivityRegisterView(DialogInterface dialogInterface, int i) {
            HloginActivity.this.currentTermsOfService.popup = false;
            onNextPressed();
        }

        public /* synthetic */ void lambda$showTermsOfService$3$HloginActivity$LoginActivityRegisterView(DialogInterface dialogInterface, int i) {
            AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
            builder.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService));
            builder.setMessage(LocaleController.getString("TosDecline", R.string.TosDecline));
            builder.setPositiveButton(LocaleController.getString("SignUp", R.string.SignUp), new DialogInterface.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$DCZcEsdk3HBDg0StLSjYLTLM */

                public final void onClick(DialogInterface dialogInterface, int i) {
                    HloginActivity.LoginActivityRegisterView.this.lambda$null$1$HloginActivity$LoginActivityRegisterView(dialogInterface, i);
                }
            });
            builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$Q2fPtbn7x2XSwn8Ft36jIvpWJlA */

                public final void onClick(DialogInterface dialogInterface, int i) {
                    HloginActivity.LoginActivityRegisterView.this.lambda$null$2$HloginActivity$LoginActivityRegisterView(dialogInterface, i);
                }
            });
            HloginActivity.this.showDialog(builder.create());
        }

        public /* synthetic */ void lambda$null$1$HloginActivity$LoginActivityRegisterView(DialogInterface dialogInterface, int i) {
            HloginActivity.this.currentTermsOfService.popup = false;
            onNextPressed();
        }

        public /* synthetic */ void lambda$null$2$HloginActivity$LoginActivityRegisterView(DialogInterface dialogInterface, int i) {
            onBackPressed(true);
            HloginActivity.this.setPage(0, true, null, true);
        }

        public LoginActivityRegisterView(Context context) {
            super(context);
            setOrientation(1);
            ImageUpdater imageUpdater2 = new ImageUpdater();
            this.imageUpdater = imageUpdater2;
            imageUpdater2.setSearchAvailable(false);
            this.imageUpdater.setUploadAfterSelect(false);
            this.imageUpdater.parentFragment = HloginActivity.this;
            this.imageUpdater.delegate = this;
            TextView textView2 = new TextView(context);
            this.textView = textView2;
            textView2.setText(LocaleController.getString("RegisterText2", R.string.RegisterText2));
            this.textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.textView.setGravity(LocaleController.isRTL ? 5 : 3);
            this.textView.setTextSize(1, 14.0f);
            addView(this.textView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 0, 0, 0));
            FrameLayout frameLayout = new FrameLayout(context);
            addView(frameLayout, LayoutHelper.createLinear(-1, -2, 0.0f, 21.0f, 0.0f, 0.0f));
            this.avatarDrawable = new AvatarDrawable();
            AnonymousClass1 r10 = new BackupImageView(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityRegisterView.AnonymousClass1 */

                public void invalidate() {
                    if (LoginActivityRegisterView.this.avatarOverlay != null) {
                        LoginActivityRegisterView.this.avatarOverlay.invalidate();
                    }
                    super.invalidate();
                }

                public void invalidate(int i, int i2, int i3, int i4) {
                    if (LoginActivityRegisterView.this.avatarOverlay != null) {
                        LoginActivityRegisterView.this.avatarOverlay.invalidate();
                    }
                    super.invalidate(i, i2, i3, i4);
                }
            };
            this.avatarImage = r10;
            r10.setRoundRadius(AndroidUtilities.dp(32.0f));
            this.avatarDrawable.setInfo(5, null, null);
            this.avatarImage.setImageDrawable(this.avatarDrawable);
            frameLayout.addView(this.avatarImage, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            final Paint paint = new Paint(1);
            paint.setColor(1426063360);
            AnonymousClass2 r11 = new View(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityRegisterView.AnonymousClass2 */

                /* access modifiers changed from: protected */
                public void onDraw(Canvas canvas) {
                    if (LoginActivityRegisterView.this.avatarImage != null && LoginActivityRegisterView.this.avatarProgressView.getVisibility() == 0) {
                        paint.setAlpha((int) (LoginActivityRegisterView.this.avatarImage.getImageReceiver().getCurrentAlpha() * 85.0f * LoginActivityRegisterView.this.avatarProgressView.getAlpha()));
                        canvas.drawCircle((float) (getMeasuredWidth() / 2), (float) (getMeasuredHeight() / 2), (float) AndroidUtilities.dp(32.0f), paint);
                    }
                }
            };
            this.avatarOverlay = r11;
            frameLayout.addView(r11, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            this.avatarOverlay.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$eY6tiFTqjRC3O1d4ZrB7gwojfgw */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityRegisterView.this.lambda$new$5$HloginActivity$LoginActivityRegisterView(view);
                }
            });
            AnonymousClass3 r102 = new ImageView(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityRegisterView.AnonymousClass3 */

                public void invalidate(int i, int i2, int i3, int i4) {
                    super.invalidate(i, i2, i3, i4);
                    LoginActivityRegisterView.this.avatarOverlay.invalidate();
                }

                public void invalidate() {
                    super.invalidate();
                    LoginActivityRegisterView.this.avatarOverlay.invalidate();
                }
            };
            this.avatarEditor = r102;
            r102.setScaleType(ImageView.ScaleType.CENTER);
            this.avatarEditor.setImageResource(R.drawable.actions_setphoto);
            this.avatarEditor.setEnabled(false);
            this.avatarEditor.setClickable(false);
            this.avatarEditor.setPadding(AndroidUtilities.dp(2.0f), 0, 0, 0);
            frameLayout.addView(this.avatarEditor, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            AnonymousClass4 r103 = new RadialProgressView(context, HloginActivity.this) {
                /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityRegisterView.AnonymousClass4 */

                @Override // im.guobwnxjuc.ui.components.RadialProgressView
                public void setAlpha(float f) {
                    super.setAlpha(f);
                    LoginActivityRegisterView.this.avatarOverlay.invalidate();
                }
            };
            this.avatarProgressView = r103;
            r103.setSize(AndroidUtilities.dp(30.0f));
            this.avatarProgressView.setProgressColor(-1);
            frameLayout.addView(this.avatarProgressView, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            showAvatarProgress(false, false);
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.firstNameField = editTextBoldCursor;
            editTextBoldCursor.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.firstNameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.firstNameField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
            this.firstNameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.firstNameField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.firstNameField.setCursorWidth(1.5f);
            this.firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
            this.firstNameField.setImeOptions(268435461);
            this.firstNameField.setTextSize(1, 17.0f);
            this.firstNameField.setMaxLines(1);
            this.firstNameField.setInputType(8192);
            frameLayout.addView(this.firstNameField, LayoutHelper.createFrame(-1.0f, 36.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 0.0f : 85.0f, 0.0f, LocaleController.isRTL ? 85.0f : 0.0f, 0.0f));
            this.firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$RKSm9Gqmt0wOfIHfCk9ubQAFivI */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.LoginActivityRegisterView.this.lambda$new$6$HloginActivity$LoginActivityRegisterView(textView, i, keyEvent);
                }
            });
            EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
            this.lastNameField = editTextBoldCursor2;
            editTextBoldCursor2.setHint(LocaleController.getString("LastName", R.string.LastName));
            this.lastNameField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
            this.lastNameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.lastNameField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
            this.lastNameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            this.lastNameField.setCursorSize(AndroidUtilities.dp(20.0f));
            this.lastNameField.setCursorWidth(1.5f);
            this.lastNameField.setImeOptions(268435462);
            this.lastNameField.setTextSize(1, 17.0f);
            this.lastNameField.setMaxLines(1);
            this.lastNameField.setInputType(8192);
            frameLayout.addView(this.lastNameField, LayoutHelper.createFrame(-1.0f, 36.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 0.0f : 85.0f, 51.0f, LocaleController.isRTL ? 85.0f : 0.0f, 0.0f));
            this.lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$T2p4cC7Tjjphk4QXDvKdRGVWoGs */

                public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                    return HloginActivity.LoginActivityRegisterView.this.lambda$new$7$HloginActivity$LoginActivityRegisterView(textView, i, keyEvent);
                }
            });
            TextView textView3 = new TextView(context);
            this.wrongNumber = textView3;
            textView3.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
            this.wrongNumber.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
            this.wrongNumber.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
            this.wrongNumber.setTextSize(1, 14.0f);
            this.wrongNumber.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            this.wrongNumber.setPadding(0, AndroidUtilities.dp(24.0f), 0, 0);
            this.wrongNumber.setVisibility(8);
            addView(this.wrongNumber, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 20, 0, 0));
            this.wrongNumber.setOnClickListener(new View.OnClickListener() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$QE6eki6ARBJOGc3kMuc3ENeZ8_M */

                public final void onClick(View view) {
                    HloginActivity.LoginActivityRegisterView.this.lambda$new$8$HloginActivity$LoginActivityRegisterView(view);
                }
            });
            TextView textView4 = new TextView(context);
            this.privacyView = textView4;
            textView4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
            this.privacyView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
            this.privacyView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkText));
            this.privacyView.setTextSize(1, 14.0f);
            this.privacyView.setGravity(81);
            this.privacyView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.privacyView, LayoutHelper.createLinear(-2, -1, 81, 0, 28, 0, 16));
            String string = LocaleController.getString("TermsOfServiceLogin", R.string.TermsOfServiceLogin);
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
            int indexOf = string.indexOf(42);
            int lastIndexOf = string.lastIndexOf(42);
            if (!(indexOf == -1 || lastIndexOf == -1 || indexOf == lastIndexOf)) {
                spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) "");
                spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) "");
                spannableStringBuilder.setSpan(new LinkSpan(), indexOf, lastIndexOf - 1, 33);
            }
            this.privacyView.setText(spannableStringBuilder);
        }

        public /* synthetic */ void lambda$new$5$HloginActivity$LoginActivityRegisterView(View view) {
            this.imageUpdater.openMenu(this.avatar != null, new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$5GN7b7RBUo_mYaDhqGR9BAZ6LIU */

                public final void run() {
                    HloginActivity.LoginActivityRegisterView.this.lambda$null$4$HloginActivity$LoginActivityRegisterView();
                }
            });
        }

        public /* synthetic */ void lambda$null$4$HloginActivity$LoginActivityRegisterView() {
            this.avatar = null;
            this.avatarBig = null;
            this.uploadedAvatar = null;
            showAvatarProgress(false, true);
            this.avatarImage.setImage((ImageLocation) null, (String) null, this.avatarDrawable, (Object) null);
            this.avatarEditor.setImageResource(R.drawable.actions_setphoto);
        }

        public /* synthetic */ boolean lambda$new$6$HloginActivity$LoginActivityRegisterView(TextView textView2, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            this.lastNameField.requestFocus();
            return true;
        }

        public /* synthetic */ boolean lambda$new$7$HloginActivity$LoginActivityRegisterView(TextView textView2, int i, KeyEvent keyEvent) {
            if (i != 6 && i != 5) {
                return false;
            }
            onNextPressed();
            return true;
        }

        public /* synthetic */ void lambda$new$8$HloginActivity$LoginActivityRegisterView(View view) {
            if (HloginActivity.this.doneProgressView.getTag() == null) {
                onBackPressed(false);
            }
        }

        @Override // im.guobwnxjuc.ui.components.ImageUpdater.ImageUpdaterDelegate
        public void didUploadPhoto(TLRPC.InputFile inputFile, TLRPC.PhotoSize photoSize, TLRPC.PhotoSize photoSize2) {
            AndroidUtilities.runOnUIThread(new Runnable(photoSize2, photoSize) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$T5IASu7VcMq_ICfMyZl8Qtdg8o */
                private final /* synthetic */ TLRPC.PhotoSize f$1;
                private final /* synthetic */ TLRPC.PhotoSize f$2;

                {
                    this.f$1 = r2;
                    this.f$2 = r3;
                }

                public final void run() {
                    HloginActivity.LoginActivityRegisterView.this.lambda$didUploadPhoto$9$HloginActivity$LoginActivityRegisterView(this.f$1, this.f$2);
                }
            });
        }

        public /* synthetic */ void lambda$didUploadPhoto$9$HloginActivity$LoginActivityRegisterView(TLRPC.PhotoSize photoSize, TLRPC.PhotoSize photoSize2) {
            this.avatar = photoSize.location;
            this.avatarBig = photoSize2.location;
            this.avatarImage.setImage(ImageLocation.getForLocal(this.avatar), "50_50", this.avatarDrawable, (Object) null);
        }

        private void showAvatarProgress(final boolean z, boolean z2) {
            if (this.avatarEditor != null) {
                AnimatorSet animatorSet = this.avatarAnimation;
                if (animatorSet != null) {
                    animatorSet.cancel();
                    this.avatarAnimation = null;
                }
                if (z2) {
                    this.avatarAnimation = new AnimatorSet();
                    if (z) {
                        this.avatarProgressView.setVisibility(0);
                        this.avatarAnimation.playTogether(ObjectAnimator.ofFloat(this.avatarEditor, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.avatarProgressView, View.ALPHA, 1.0f));
                    } else {
                        this.avatarEditor.setVisibility(0);
                        this.avatarAnimation.playTogether(ObjectAnimator.ofFloat(this.avatarEditor, View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.avatarProgressView, View.ALPHA, 0.0f));
                    }
                    this.avatarAnimation.setDuration(180L);
                    this.avatarAnimation.addListener(new AnimatorListenerAdapter() {
                        /* class im.guobwnxjuc.ui.hui.login.HloginActivity.LoginActivityRegisterView.AnonymousClass5 */

                        public void onAnimationEnd(Animator animator) {
                            if (LoginActivityRegisterView.this.avatarAnimation != null && LoginActivityRegisterView.this.avatarEditor != null) {
                                if (z) {
                                    LoginActivityRegisterView.this.avatarEditor.setVisibility(4);
                                } else {
                                    LoginActivityRegisterView.this.avatarProgressView.setVisibility(4);
                                }
                                LoginActivityRegisterView.this.avatarAnimation = null;
                            }
                        }

                        public void onAnimationCancel(Animator animator) {
                            LoginActivityRegisterView.this.avatarAnimation = null;
                        }
                    });
                    this.avatarAnimation.start();
                } else if (z) {
                    this.avatarEditor.setAlpha(1.0f);
                    this.avatarEditor.setVisibility(4);
                    this.avatarProgressView.setAlpha(1.0f);
                    this.avatarProgressView.setVisibility(0);
                } else {
                    this.avatarEditor.setAlpha(1.0f);
                    this.avatarEditor.setVisibility(0);
                    this.avatarProgressView.setAlpha(0.0f);
                    this.avatarProgressView.setVisibility(4);
                }
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public boolean onBackPressed(boolean z) {
            if (!z) {
                AlertDialog.Builder builder = new AlertDialog.Builder(HloginActivity.this.getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("AreYouSureRegistration", R.string.AreYouSureRegistration));
                builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                    /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$wYD1DWjqzkyCmMGtYPqAMA5J9fc */

                    public final void onClick(DialogInterface dialogInterface, int i) {
                        HloginActivity.LoginActivityRegisterView.this.lambda$onBackPressed$10$HloginActivity$LoginActivityRegisterView(dialogInterface, i);
                    }
                });
                builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null);
                HloginActivity.this.showDialog(builder.create());
                return false;
            }
            HloginActivity.this.needHideProgress(true);
            this.nextPressed = false;
            this.currentParams = null;
            return true;
        }

        public /* synthetic */ void lambda$onBackPressed$10$HloginActivity$LoginActivityRegisterView(DialogInterface dialogInterface, int i) {
            onBackPressed(true);
            HloginActivity.this.setPage(0, true, null, true);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public String getHeaderName() {
            return LocaleController.getString("YourName", R.string.YourName);
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onCancelPressed() {
            this.nextPressed = false;
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onShow() {
            super.onShow();
            AndroidUtilities.runOnUIThread(new Runnable() {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$k_GmsJPgZhFtOKTcPGUsloI3Uo */

                public final void run() {
                    HloginActivity.LoginActivityRegisterView.this.lambda$onShow$11$HloginActivity$LoginActivityRegisterView();
                }
            }, 100);
        }

        public /* synthetic */ void lambda$onShow$11$HloginActivity$LoginActivityRegisterView() {
            EditTextBoldCursor editTextBoldCursor = this.firstNameField;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.firstNameField;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void setParams(Bundle bundle, boolean z) {
            if (bundle != null) {
                this.firstNameField.setText("");
                this.lastNameField.setText("");
                this.requestPhone = bundle.getString("phoneFormated");
                this.phoneHash = bundle.getString("phoneHash");
                this.phoneCode = bundle.getString("code");
                this.currentParams = bundle;
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void onNextPressed() {
            if (!this.nextPressed) {
                if (HloginActivity.this.currentTermsOfService == null || !HloginActivity.this.currentTermsOfService.popup) {
                    this.nextPressed = true;
                    TLRPC.TL_auth_signUp tL_auth_signUp = new TLRPC.TL_auth_signUp();
                    tL_auth_signUp.phone_code_hash = this.phoneHash;
                    tL_auth_signUp.phone_number = this.requestPhone;
                    tL_auth_signUp.first_name = this.firstNameField.getText().toString();
                    tL_auth_signUp.last_name = this.lastNameField.getText().toString();
                    HloginActivity.this.needShowProgress(0);
                    ConnectionsManager.getInstance(HloginActivity.this.currentAccount).sendRequest(tL_auth_signUp, new RequestDelegate() {
                        /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$J2jN8JHM28KdDlKJAXYJSv9FmSA */

                        @Override // im.guobwnxjuc.tgnet.RequestDelegate
                        public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                            HloginActivity.LoginActivityRegisterView.this.lambda$onNextPressed$13$HloginActivity$LoginActivityRegisterView(tLObject, tL_error);
                        }
                    }, 10);
                    return;
                }
                showTermsOfService(true);
            }
        }

        public /* synthetic */ void lambda$onNextPressed$13$HloginActivity$LoginActivityRegisterView(TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable(tL_error) {
                /* class im.guobwnxjuc.ui.hui.login.$$Lambda$HloginActivity$LoginActivityRegisterView$GN56RpIMD9Thq1e3aIvsSsFo3I */
                private final /* synthetic */ TLRPC.TL_error f$1;

                {
                    this.f$1 = r2;
                }

                public final void run() {
                    HloginActivity.LoginActivityRegisterView.this.lambda$null$12$HloginActivity$LoginActivityRegisterView(this.f$1);
                }
            });
        }

        public /* synthetic */ void lambda$null$12$HloginActivity$LoginActivityRegisterView(TLRPC.TL_error tL_error) {
            this.nextPressed = false;
            HloginActivity.this.needHideProgress(false);
            if (TextUtils.isEmpty(this.firstNameField.getText().toString().trim())) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("EmptyNameTips", R.string.EmptyNameTips));
            } else if (tL_error.text.contains("PHONE_NUMBER_INVALID")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
            } else if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
            } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
            } else if (tL_error.text.contains("FIRSTNAME_INVALID")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidName", R.string.InvalidName));
            } else if (tL_error.text.contains("LASTNAME_INVALID")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidNickname", R.string.InvalidNickname));
            } else if (tL_error.text.contains("FIRSTNAME_LASTNAME_EMPTY")) {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("EmptyNameTips", R.string.EmptyNameTips));
            } else {
                HloginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void saveStateParams(Bundle bundle) {
            String obj = this.firstNameField.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("registerview_first", obj);
            }
            String obj2 = this.lastNameField.getText().toString();
            if (obj2.length() != 0) {
                bundle.putString("registerview_last", obj2);
            }
            if (HloginActivity.this.currentTermsOfService != null) {
                SerializedData serializedData = new SerializedData(HloginActivity.this.currentTermsOfService.getObjectSize());
                HloginActivity.this.currentTermsOfService.serializeToStream(serializedData);
                bundle.putString("terms", Base64.encodeToString(serializedData.toByteArray(), 0));
                serializedData.cleanup();
            }
            Bundle bundle2 = this.currentParams;
            if (bundle2 != null) {
                bundle.putBundle("registerview_params", bundle2);
            }
        }

        @Override // im.guobwnxjuc.ui.components.SlideView
        public void restoreStateParams(Bundle bundle) {
            byte[] decode;
            Bundle bundle2 = bundle.getBundle("registerview_params");
            this.currentParams = bundle2;
            if (bundle2 != null) {
                setParams(bundle2, true);
            }
            try {
                String string = bundle.getString("terms");
                if (!(string == null || (decode = Base64.decode(string, 0)) == null)) {
                    SerializedData serializedData = new SerializedData(decode);
                    HloginActivity.this.currentTermsOfService = TLRPC.TL_help_termsOfService.TLdeserialize(serializedData, serializedData.readInt32(false), false);
                    serializedData.cleanup();
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
            String string2 = bundle.getString("registerview_first");
            if (string2 != null) {
                this.firstNameField.setText(string2);
            }
            String string3 = bundle.getString("registerview_last");
            if (string3 != null) {
                this.lastNameField.setText(string3);
            }
        }
    }

    @Override // im.guobwnxjuc.ui.actionbar.BaseFragment
    public ThemeDescription[] getThemeDescriptions() {
        int i = 0;
        while (true) {
            SlideView[] slideViewArr = this.views;
            if (i >= slideViewArr.length) {
                PhoneView phoneView = (PhoneView) slideViewArr[0];
                LoginActivitySmsView loginActivitySmsView = (LoginActivitySmsView) slideViewArr[1];
                LoginActivitySmsView loginActivitySmsView2 = (LoginActivitySmsView) slideViewArr[2];
                LoginActivitySmsView loginActivitySmsView3 = (LoginActivitySmsView) slideViewArr[3];
                LoginActivitySmsView loginActivitySmsView4 = (LoginActivitySmsView) slideViewArr[4];
                LoginActivityRegisterView loginActivityRegisterView = (LoginActivityRegisterView) slideViewArr[5];
                LoginActivityPasswordView loginActivityPasswordView = (LoginActivityPasswordView) slideViewArr[6];
                LoginActivityRecoverView loginActivityRecoverView = (LoginActivityRecoverView) slideViewArr[7];
                LoginActivityResetWaitView loginActivityResetWaitView = (LoginActivityResetWaitView) slideViewArr[8];
                ArrayList arrayList = new ArrayList();
                arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
                arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
                arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
                arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
                arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
                arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
                arrayList.add(new ThemeDescription(phoneView.countryButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(phoneView.view, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhiteGrayLine));
                arrayList.add(new ThemeDescription(phoneView.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(phoneView.textView2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.codeField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.cancelButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.resetAccountButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteRedText6));
                arrayList.add(new ThemeDescription(loginActivityPasswordView.resetAccountText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.firstNameField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.firstNameField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.firstNameField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.firstNameField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.lastNameField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.lastNameField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.lastNameField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.lastNameField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.wrongNumber, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.privacyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityRegisterView.privacyView, ThemeDescription.FLAG_LINKCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteLinkText));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.codeField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                arrayList.add(new ThemeDescription(loginActivityRecoverView.cancelButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivityResetWaitView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityResetWaitView.resetAccountText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityResetWaitView.resetAccountTime, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityResetWaitView.resetAccountButton, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivityResetWaitView.resetAccountButton, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteRedText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                if (loginActivitySmsView.codeField != null) {
                    for (int i2 = 0; i2 < loginActivitySmsView.codeField.length; i2++) {
                        arrayList.add(new ThemeDescription(loginActivitySmsView.codeField[i2], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                        arrayList.add(new ThemeDescription(loginActivitySmsView.codeField[i2], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                    }
                }
                arrayList.add(new ThemeDescription(loginActivitySmsView.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivitySmsView.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
                arrayList.add(new ThemeDescription(loginActivitySmsView.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
                arrayList.add(new ThemeDescription(loginActivitySmsView.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivitySmsView.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                if (loginActivitySmsView2.codeField != null) {
                    for (int i3 = 0; i3 < loginActivitySmsView2.codeField.length; i3++) {
                        arrayList.add(new ThemeDescription(loginActivitySmsView2.codeField[i3], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                        arrayList.add(new ThemeDescription(loginActivitySmsView2.codeField[i3], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                    }
                }
                arrayList.add(new ThemeDescription(loginActivitySmsView2.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivitySmsView2.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                if (loginActivitySmsView3.codeField != null) {
                    for (int i4 = 0; i4 < loginActivitySmsView3.codeField.length; i4++) {
                        arrayList.add(new ThemeDescription(loginActivitySmsView3.codeField[i4], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                        arrayList.add(new ThemeDescription(loginActivitySmsView3.codeField[i4], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                    }
                }
                arrayList.add(new ThemeDescription(loginActivitySmsView3.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivitySmsView3.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                if (loginActivitySmsView4.codeField != null) {
                    for (int i5 = 0; i5 < loginActivitySmsView4.codeField.length; i5++) {
                        arrayList.add(new ThemeDescription(loginActivitySmsView4.codeField[i5], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                        arrayList.add(new ThemeDescription(loginActivitySmsView4.codeField[i5], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
                    }
                }
                arrayList.add(new ThemeDescription(loginActivitySmsView4.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
                arrayList.add(new ThemeDescription(loginActivitySmsView4.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
                return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]);
            } else if (slideViewArr[i] == null) {
                return new ThemeDescription[0];
            } else {
                i++;
            }
        }
    }
}