Telegram5 v10.6.2版本的 MD5 值为:423cae39e902ed9dd2cc7f4b4547b276
以下内容为反编译后的 LoginActivity.java 源代码,内容仅作参考
package org.telegram.ui;
import android.R;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
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.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.Layout;
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.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.text.style.ReplacementSpan;
import android.util.Base64;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Space;
import android.widget.TextView;
import android.widget.ViewSwitcher;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.dynamicanimation.animation.DynamicAnimation;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.safetynet.SafetyNet;
import com.google.android.gms.safetynet.SafetyNetApi$AttestationResponse;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import j$.util.Comparator$CC;
import j$.util.function.Function;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.AuthTokensHelper;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.CallReceiver;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.GenericProvider;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.PushListenerController;
import org.telegram.messenger.SRPHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC$FileLocation;
import org.telegram.tgnet.TLRPC$InputFile;
import org.telegram.tgnet.TLRPC$PasswordKdfAlgo;
import org.telegram.tgnet.TLRPC$PhotoSize;
import org.telegram.tgnet.TLRPC$TL_account_changePhone;
import org.telegram.tgnet.TLRPC$TL_account_confirmPhone;
import org.telegram.tgnet.TLRPC$TL_account_deleteAccount;
import org.telegram.tgnet.TLRPC$TL_account_emailVerified;
import org.telegram.tgnet.TLRPC$TL_account_emailVerifiedLogin;
import org.telegram.tgnet.TLRPC$TL_account_getPassword;
import org.telegram.tgnet.TLRPC$TL_account_passwordInputSettings;
import org.telegram.tgnet.TLRPC$TL_account_sendChangePhoneCode;
import org.telegram.tgnet.TLRPC$TL_account_sendVerifyEmailCode;
import org.telegram.tgnet.TLRPC$TL_account_sentEmailCode;
import org.telegram.tgnet.TLRPC$TL_account_verifyEmail;
import org.telegram.tgnet.TLRPC$TL_auth_authorization;
import org.telegram.tgnet.TLRPC$TL_auth_authorizationSignUpRequired;
import org.telegram.tgnet.TLRPC$TL_auth_cancelCode;
import org.telegram.tgnet.TLRPC$TL_auth_checkPassword;
import org.telegram.tgnet.TLRPC$TL_auth_checkRecoveryPassword;
import org.telegram.tgnet.TLRPC$TL_auth_codeTypeCall;
import org.telegram.tgnet.TLRPC$TL_auth_codeTypeFlashCall;
import org.telegram.tgnet.TLRPC$TL_auth_codeTypeFragmentSms;
import org.telegram.tgnet.TLRPC$TL_auth_codeTypeMissedCall;
import org.telegram.tgnet.TLRPC$TL_auth_codeTypeSms;
import org.telegram.tgnet.TLRPC$TL_auth_loggedOut;
import org.telegram.tgnet.TLRPC$TL_auth_passwordRecovery;
import org.telegram.tgnet.TLRPC$TL_auth_recoverPassword;
import org.telegram.tgnet.TLRPC$TL_auth_requestFirebaseSms;
import org.telegram.tgnet.TLRPC$TL_auth_requestPasswordRecovery;
import org.telegram.tgnet.TLRPC$TL_auth_resendCode;
import org.telegram.tgnet.TLRPC$TL_auth_resetLoginEmail;
import org.telegram.tgnet.TLRPC$TL_auth_sendCode;
import org.telegram.tgnet.TLRPC$TL_auth_sentCode;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeSuccess;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeApp;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeCall;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeEmailCode;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeFirebaseSms;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeFlashCall;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeFragmentSms;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeMissedCall;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeSetUpEmailRequired;
import org.telegram.tgnet.TLRPC$TL_auth_sentCodeTypeSms;
import org.telegram.tgnet.TLRPC$TL_auth_signIn;
import org.telegram.tgnet.TLRPC$TL_auth_signUp;
import org.telegram.tgnet.TLRPC$TL_boolTrue;
import org.telegram.tgnet.TLRPC$TL_codeSettings;
import org.telegram.tgnet.TLRPC$TL_emailVerificationCode;
import org.telegram.tgnet.TLRPC$TL_emailVerificationGoogle;
import org.telegram.tgnet.TLRPC$TL_emailVerifyPurposeLoginChange;
import org.telegram.tgnet.TLRPC$TL_emailVerifyPurposeLoginSetup;
import org.telegram.tgnet.TLRPC$TL_error;
import org.telegram.tgnet.TLRPC$TL_help_countriesList;
import org.telegram.tgnet.TLRPC$TL_help_country;
import org.telegram.tgnet.TLRPC$TL_help_countryCode;
import org.telegram.tgnet.TLRPC$TL_help_getCountriesList;
import org.telegram.tgnet.TLRPC$TL_help_termsOfService;
import org.telegram.tgnet.TLRPC$TL_inputCheckPasswordSRP;
import org.telegram.tgnet.TLRPC$TL_nearestDc;
import org.telegram.tgnet.TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
import org.telegram.tgnet.TLRPC$User;
import org.telegram.tgnet.TLRPC$VideoSize;
import org.telegram.tgnet.TLRPC$account_Password;
import org.telegram.tgnet.TLRPC$auth_Authorization;
import org.telegram.tgnet.TLRPC$auth_CodeType;
import org.telegram.tgnet.TLRPC$auth_SentCode;
import org.telegram.tgnet.TLRPC$auth_SentCodeType;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.CheckBoxCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AnimatedPhoneNumberEditText;
import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.CustomPhoneKeyboardView;
import org.telegram.ui.Components.Easings;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.ImageUpdater;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.LinkPath;
import org.telegram.ui.Components.LoadingDrawable;
import org.telegram.ui.Components.LoginOrView;
import org.telegram.ui.Components.OutlineTextContainerView;
import org.telegram.ui.Components.ProxyDrawable;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Components.RadialProgressView;
import org.telegram.ui.Components.SimpleThemeDescription;
import org.telegram.ui.Components.SizeNotifierFrameLayout;
import org.telegram.ui.Components.SlideView;
import org.telegram.ui.Components.TextStyleSpan;
import org.telegram.ui.Components.TextViewSwitcher;
import org.telegram.ui.Components.TransformableLoginButtonView;
import org.telegram.ui.Components.URLSpanNoUnderline;
import org.telegram.ui.Components.VerticalPositionAutoAnimator;
import org.telegram.ui.Components.spoilers.SpoilersTextView;
import org.telegram.ui.CountrySelectActivity;
import org.telegram.ui.LoginActivity;
@SuppressLint({"HardwareIds"})
public class LoginActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
private static final int SHOW_DELAY;
private int activityMode;
private Runnable animationFinishCallback;
private ImageView backButtonView;
private AlertDialog cancelDeleteProgressDialog;
private TLRPC$TL_auth_sentCode cancelDeletionCode;
private Bundle cancelDeletionParams;
private String cancelDeletionPhone;
private boolean checkPermissions;
private boolean checkShowPermissions;
private int currentConnectionState;
private int currentDoneType;
private TLRPC$TL_help_termsOfService currentTermsOfService;
private int currentViewNum;
private boolean customKeyboardWasVisible;
private boolean[] doneButtonVisible;
private AnimatorSet doneItemAnimation;
private boolean[] doneProgressVisible;
private Runnable[] editDoneCallback;
private Runnable emailChangeFinishCallback;
private VerticalPositionAutoAnimator floatingAutoAnimator;
private FrameLayout floatingButtonContainer;
private TransformableLoginButtonView floatingButtonIcon;
private RadialProgressView floatingProgressView;
private boolean forceDisableSafetyNet;
private View introView;
private boolean isAnimatingIntro;
private boolean isRequestingFirebaseSms;
private ValueAnimator keyboardAnimator;
private Runnable keyboardHideCallback;
private LinearLayout keyboardLinearLayout;
private CustomPhoneKeyboardView keyboardView;
private boolean needRequestPermissions;
private boolean newAccount;
private Dialog permissionsDialog;
private ArrayList<String> permissionsItems;
private Dialog permissionsShowDialog;
private ArrayList<String> permissionsShowItems;
private PhoneNumberConfirmView phoneNumberConfirmView;
private boolean[] postedEditDoneCallback;
private int progressRequestId;
private ImageView proxyButtonView;
private boolean proxyButtonVisible;
private ProxyDrawable proxyDrawable;
private RadialProgressView radialProgressView;
private boolean restoringState;
private AnimatorSet[] showDoneAnimation;
private Runnable showProxyButtonDelayed;
private SizeNotifierFrameLayout sizeNotifierFrameLayout;
private FrameLayout slideViewsContainer;
private TextView startMessagingButton;
private boolean syncContacts;
private boolean testBackend;
private SlideView[] views;
public static class ProgressView extends View {
}
static {
SHOW_DELAY = SharedConfig.getDevicePerformanceClass() <= 1 ? ImageReceiver.DEFAULT_CROSSFADE_DURATION : 100;
}
public LoginActivity() {
this.views = new SlideView[16];
this.permissionsItems = new ArrayList<>();
this.permissionsShowItems = new ArrayList<>();
this.checkPermissions = true;
this.checkShowPermissions = true;
this.syncContacts = true;
this.testBackend = false;
this.activityMode = 0;
this.showDoneAnimation = new AnimatorSet[2];
this.doneButtonVisible = new boolean[]{true, false};
this.customKeyboardWasVisible = false;
this.doneProgressVisible = new boolean[2];
this.editDoneCallback = new Runnable[2];
this.postedEditDoneCallback = new boolean[2];
}
public LoginActivity(int i) {
this.views = new SlideView[16];
this.permissionsItems = new ArrayList<>();
this.permissionsShowItems = new ArrayList<>();
this.checkPermissions = true;
this.checkShowPermissions = true;
this.syncContacts = true;
this.testBackend = false;
this.activityMode = 0;
this.showDoneAnimation = new AnimatorSet[2];
this.doneButtonVisible = new boolean[]{true, false};
this.customKeyboardWasVisible = false;
this.doneProgressVisible = new boolean[2];
this.editDoneCallback = new Runnable[2];
this.postedEditDoneCallback = new boolean[2];
this.currentAccount = i;
this.newAccount = true;
}
public LoginActivity changeEmail(Runnable runnable) {
this.activityMode = 3;
this.currentViewNum = 12;
this.emailChangeFinishCallback = runnable;
return this;
}
public LoginActivity cancelAccountDeletion(String str, Bundle bundle, TLRPC$TL_auth_sentCode tLRPC$TL_auth_sentCode) {
this.cancelDeletionPhone = str;
this.cancelDeletionParams = bundle;
this.cancelDeletionCode = tLRPC$TL_auth_sentCode;
this.activityMode = 1;
return this;
}
public LoginActivity changePhoneNumber() {
this.activityMode = 2;
return this;
}
public boolean isInCancelAccountDeletionMode() {
return this.activityMode == 1;
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
int i = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (i >= slideViewArr.length) {
break;
}
if (slideViewArr[i] != null) {
slideViewArr[i].onDestroyActivity();
}
i++;
}
AlertDialog alertDialog = this.cancelDeleteProgressDialog;
if (alertDialog != null) {
alertDialog.dismiss();
this.cancelDeleteProgressDialog = null;
}
for (Runnable runnable : this.editDoneCallback) {
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
}
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateConnectionState);
}
@Override
public boolean onFragmentCreate() {
getNotificationCenter().addObserver(this, NotificationCenter.didUpdateConnectionState);
return super.onFragmentCreate();
}
@Override
public View createView(Context context) {
Bundle bundle;
int i;
int i2;
SlideView[] slideViewArr;
boolean z;
this.actionBar.setAddToContainer(false);
this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int i3) {
if (i3 == 1) {
LoginActivity.this.onDoneButtonPressed();
} else if (i3 == -1 && LoginActivity.this.onBackPressed()) {
LoginActivity.this.finishFragment();
}
}
});
this.currentDoneType = 0;
boolean[] zArr = this.doneButtonVisible;
zArr[0] = true;
zArr[1] = false;
SizeNotifierFrameLayout sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context) {
@Override
protected void onMeasure(int i3, int i4) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) LoginActivity.this.floatingButtonContainer.getLayoutParams();
int dp = LoginActivity.this.isCustomKeyboardVisible() ? AndroidUtilities.dp(230.0f) : 0;
if (LoginActivity.this.isCustomKeyboardVisible() && measureKeyboardHeight() > AndroidUtilities.dp(20.0f)) {
dp -= measureKeyboardHeight();
}
if (Bulletin.getVisibleBulletin() != null && Bulletin.getVisibleBulletin().isShowing()) {
super.onMeasure(i3, i4);
marginLayoutParams.bottomMargin = ((AndroidUtilities.dp(16.0f) + Bulletin.getVisibleBulletin().getLayout().getMeasuredHeight()) - AndroidUtilities.dp(10.0f)) + dp;
} else {
marginLayoutParams.bottomMargin = AndroidUtilities.dp(16.0f) + dp;
}
int i5 = AndroidUtilities.isTablet() ? 0 : AndroidUtilities.statusBarHeight;
((ViewGroup.MarginLayoutParams) LoginActivity.this.backButtonView.getLayoutParams()).topMargin = AndroidUtilities.dp(16.0f) + i5;
((ViewGroup.MarginLayoutParams) LoginActivity.this.proxyButtonView.getLayoutParams()).topMargin = AndroidUtilities.dp(16.0f) + i5;
((ViewGroup.MarginLayoutParams) LoginActivity.this.radialProgressView.getLayoutParams()).topMargin = AndroidUtilities.dp(16.0f) + i5;
if (measureKeyboardHeight() > AndroidUtilities.dp(20.0f) && LoginActivity.this.keyboardView.getVisibility() != 8 && !LoginActivity.this.isCustomKeyboardForceDisabled() && !LoginActivity.this.customKeyboardWasVisible) {
if (LoginActivity.this.keyboardAnimator != null) {
LoginActivity.this.keyboardAnimator.cancel();
}
LoginActivity.this.keyboardView.setVisibility(8);
}
super.onMeasure(i3, i4);
}
};
this.sizeNotifierFrameLayout = sizeNotifierFrameLayout;
sizeNotifierFrameLayout.setDelegate(new SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate() {
@Override
public final void onSizeChanged(int i3, boolean z2) {
LoginActivity.this.lambda$createView$0(i3, z2);
}
});
this.fragmentView = this.sizeNotifierFrameLayout;
ScrollView scrollView = new ScrollView(context) {
@Override
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z2) {
if (LoginActivity.this.currentViewNum == 1 || LoginActivity.this.currentViewNum == 2 || LoginActivity.this.currentViewNum == 4) {
rect.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(view, rect, z2);
}
};
scrollView.setFillViewport(true);
this.sizeNotifierFrameLayout.addView(scrollView, LayoutHelper.createFrame(-1, -1.0f));
LinearLayout linearLayout = new LinearLayout(context);
this.keyboardLinearLayout = linearLayout;
linearLayout.setOrientation(1);
scrollView.addView(this.keyboardLinearLayout, LayoutHelper.createScroll(-1, -2, 51));
Space space = new Space(context);
space.setMinimumHeight(AndroidUtilities.isTablet() ? 0 : AndroidUtilities.statusBarHeight);
this.keyboardLinearLayout.addView(space);
FrameLayout frameLayout = new FrameLayout(context) {
@Override
protected void onLayout(boolean z2, int i3, int i4, int i5, int i6) {
super.onLayout(z2, i3, i4, i5, i6);
for (SlideView slideView : LoginActivity.this.views) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) slideView.getLayoutParams();
int height = getHeight() + AndroidUtilities.dp(16.0f);
if (!slideView.hasCustomKeyboard() && LoginActivity.this.keyboardView.getVisibility() == 0) {
height += AndroidUtilities.dp(230.0f);
}
slideView.layout(marginLayoutParams.leftMargin, marginLayoutParams.topMargin, getWidth() - marginLayoutParams.rightMargin, height);
}
}
@Override
protected void onMeasure(int i3, int i4) {
super.onMeasure(i3, i4);
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
for (SlideView slideView : LoginActivity.this.views) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) slideView.getLayoutParams();
int dp = (measuredHeight - marginLayoutParams.topMargin) + AndroidUtilities.dp(16.0f);
if (!slideView.hasCustomKeyboard() && LoginActivity.this.keyboardView.getVisibility() == 0) {
dp += AndroidUtilities.dp(230.0f);
}
slideView.measure(View.MeasureSpec.makeMeasureSpec((measuredWidth - marginLayoutParams.rightMargin) - marginLayoutParams.leftMargin, 1073741824), View.MeasureSpec.makeMeasureSpec(dp, 1073741824));
}
}
};
this.slideViewsContainer = frameLayout;
this.keyboardLinearLayout.addView(frameLayout, LayoutHelper.createLinear(-1, 0, 1.0f));
CustomPhoneKeyboardView customPhoneKeyboardView = new CustomPhoneKeyboardView(context);
this.keyboardView = customPhoneKeyboardView;
customPhoneKeyboardView.setViewToFindFocus(this.slideViewsContainer);
this.keyboardLinearLayout.addView(this.keyboardView, LayoutHelper.createLinear(-1, 230));
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);
this.views[9] = new LoginActivityNewPasswordView(context, 0);
this.views[10] = new LoginActivityNewPasswordView(context, 1);
this.views[11] = new LoginActivitySmsView(context, 11);
this.views[12] = new LoginActivitySetupEmail(context);
this.views[13] = new LoginActivityEmailCodeView(context, true);
this.views[14] = new LoginActivityEmailCodeView(context, false);
this.views[15] = new LoginActivitySmsView(context, 15);
int i3 = 0;
while (true) {
SlideView[] slideViewArr2 = this.views;
if (i3 >= slideViewArr2.length) {
break;
}
slideViewArr2[i3].setVisibility(i3 == 0 ? 0 : 8);
this.slideViewsContainer.addView(this.views[i3], LayoutHelper.createFrame(-1, -1.0f, 17, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 30.0f, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 0.0f));
i3++;
}
Bundle loadCurrentState = this.activityMode == 0 ? loadCurrentState(this.newAccount, this.currentAccount) : null;
if (loadCurrentState != null) {
this.currentViewNum = loadCurrentState.getInt("currentViewNum", 0);
this.syncContacts = loadCurrentState.getInt("syncContacts", 1) == 1;
int i4 = this.currentViewNum;
if (i4 >= 1 && i4 <= 4) {
int i5 = loadCurrentState.getInt("open");
if (i5 != 0 && Math.abs((System.currentTimeMillis() / 1000) - i5) >= 86400) {
this.currentViewNum = 0;
clearCurrentState();
bundle = null;
}
} else if (i4 == 6) {
if (((LoginActivityPasswordView) this.views[6]).currentPassword == null) {
this.currentViewNum = 0;
clearCurrentState();
bundle = null;
}
} else if (i4 == 7 && ((LoginActivityRecoverView) this.views[7]).passwordString == null) {
this.currentViewNum = 0;
clearCurrentState();
bundle = null;
}
FrameLayout frameLayout2 = new FrameLayout(context);
this.floatingButtonContainer = frameLayout2;
frameLayout2.setVisibility(!this.doneButtonVisible[0] ? 0 : 8);
i = Build.VERSION.SDK_INT;
if (i >= 21) {
StateListAnimator stateListAnimator = new StateListAnimator();
stateListAnimator.addState(new int[]{R.attr.state_pressed}, ObjectAnimator.ofFloat(this.floatingButtonIcon, "translationZ", AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.floatingButtonIcon, "translationZ", AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
this.floatingButtonContainer.setStateListAnimator(stateListAnimator);
this.floatingButtonContainer.setOutlineProvider(new ViewOutlineProvider(this) {
@Override
@SuppressLint({"NewApi"})
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
}
});
}
this.floatingAutoAnimator = VerticalPositionAutoAnimator.attach(this.floatingButtonContainer);
this.sizeNotifierFrameLayout.addView(this.floatingButtonContainer, LayoutHelper.createFrame(i < 21 ? 56 : 60, i < 21 ? 56.0f : 60.0f, 85, 0.0f, 0.0f, 24.0f, 16.0f));
this.floatingButtonContainer.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$1(view);
}
});
this.floatingAutoAnimator.addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener() {
@Override
public final void onAnimationUpdate(DynamicAnimation dynamicAnimation, float f, float f2) {
LoginActivity.this.lambda$createView$2(dynamicAnimation, f, f2);
}
});
ImageView imageView = new ImageView(context);
this.backButtonView = imageView;
imageView.setImageResource(org.telegram.messenger.R.drawable.ic_ab_back);
this.backButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$3(view);
}
});
this.backButtonView.setContentDescription(LocaleController.getString(org.telegram.messenger.R.string.Back));
int dp = AndroidUtilities.dp(4.0f);
this.backButtonView.setPadding(dp, dp, dp, dp);
this.sizeNotifierFrameLayout.addView(this.backButtonView, LayoutHelper.createFrame(32, 32.0f, 51, 16.0f, 16.0f, 0.0f, 0.0f));
ImageView imageView2 = new ImageView(context);
this.proxyButtonView = imageView2;
ProxyDrawable proxyDrawable = new ProxyDrawable(context);
this.proxyDrawable = proxyDrawable;
imageView2.setImageDrawable(proxyDrawable);
this.proxyButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$4(view);
}
});
this.proxyButtonView.setAlpha(0.0f);
this.proxyButtonView.setVisibility(8);
this.sizeNotifierFrameLayout.addView(this.proxyButtonView, LayoutHelper.createFrame(32, 32.0f, 53, 16.0f, 16.0f, 16.0f, 16.0f));
updateProxyButton(false, true);
RadialProgressView radialProgressView = new RadialProgressView(context);
this.radialProgressView = radialProgressView;
radialProgressView.setSize(AndroidUtilities.dp(20.0f));
this.radialProgressView.setAlpha(0.0f);
this.radialProgressView.setScaleX(0.1f);
this.radialProgressView.setScaleY(0.1f);
this.sizeNotifierFrameLayout.addView(this.radialProgressView, LayoutHelper.createFrame(32, 32.0f, 53, 0.0f, 16.0f, 16.0f, 0.0f));
TransformableLoginButtonView transformableLoginButtonView = new TransformableLoginButtonView(context);
this.floatingButtonIcon = transformableLoginButtonView;
transformableLoginButtonView.setTransformType(0);
this.floatingButtonIcon.setProgress(1.0f);
this.floatingButtonIcon.setDrawBackground(false);
this.floatingButtonContainer.setContentDescription(LocaleController.getString("Done", org.telegram.messenger.R.string.Done));
this.floatingButtonContainer.addView(this.floatingButtonIcon, LayoutHelper.createFrame(i < 21 ? 56 : 60, i < 21 ? 56.0f : 60.0f));
RadialProgressView radialProgressView2 = new RadialProgressView(context);
this.floatingProgressView = radialProgressView2;
radialProgressView2.setSize(AndroidUtilities.dp(22.0f));
this.floatingProgressView.setAlpha(0.0f);
this.floatingProgressView.setScaleX(0.1f);
this.floatingProgressView.setScaleY(0.1f);
this.floatingProgressView.setVisibility(4);
this.floatingButtonContainer.addView(this.floatingProgressView, LayoutHelper.createFrame(-1, -1.0f));
if (bundle != null) {
this.restoringState = true;
}
i2 = 0;
while (true) {
slideViewArr = this.views;
if (i2 < slideViewArr.length) {
break;
}
SlideView slideView = slideViewArr[i2];
if (bundle != null) {
if (i2 >= 1 && i2 <= 4) {
if (i2 == this.currentViewNum) {
slideView.restoreStateParams(bundle);
}
} else {
slideView.restoreStateParams(bundle);
}
}
if (this.currentViewNum == i2) {
this.backButtonView.setVisibility((slideView.needBackButton() || this.newAccount || this.activityMode == 2) ? 0 : 8);
slideView.setVisibility(0);
slideView.onShow();
setCustomKeyboardVisible(slideView.hasCustomKeyboard(), false);
this.currentDoneType = 0;
if (i2 != 0 && i2 != 5) {
if (i2 != 6) {
if (i2 != 9) {
if (i2 != 10 && i2 != 12) {
z = false;
showDoneButton(z, false);
if (i2 == 1 && i2 != 2) {
if (i2 != 3 && i2 != 4) {
}
}
this.currentDoneType = 1;
}
z = true;
showDoneButton(z, false);
if (i2 == 1) {
}
this.currentDoneType = 1;
}
z = true;
showDoneButton(z, false);
if (i2 == 1) {
}
this.currentDoneType = 1;
}
}
z = true;
showDoneButton(z, false);
if (i2 == 1) {
}
this.currentDoneType = 1;
} else if (slideView.getVisibility() != 8) {
slideView.setVisibility(8);
slideView.onHide();
}
i2++;
}
this.restoringState = false;
updateColors();
if (isInCancelAccountDeletionMode()) {
lambda$fillNextCodeParams$23(this.cancelDeletionParams, this.cancelDeletionCode, false);
}
return this.fragmentView;
}
bundle = loadCurrentState;
FrameLayout frameLayout22 = new FrameLayout(context);
this.floatingButtonContainer = frameLayout22;
frameLayout22.setVisibility(!this.doneButtonVisible[0] ? 0 : 8);
i = Build.VERSION.SDK_INT;
if (i >= 21) {
}
this.floatingAutoAnimator = VerticalPositionAutoAnimator.attach(this.floatingButtonContainer);
this.sizeNotifierFrameLayout.addView(this.floatingButtonContainer, LayoutHelper.createFrame(i < 21 ? 56 : 60, i < 21 ? 56.0f : 60.0f, 85, 0.0f, 0.0f, 24.0f, 16.0f));
this.floatingButtonContainer.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$1(view);
}
});
this.floatingAutoAnimator.addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener() {
@Override
public final void onAnimationUpdate(DynamicAnimation dynamicAnimation, float f, float f2) {
LoginActivity.this.lambda$createView$2(dynamicAnimation, f, f2);
}
});
ImageView imageView3 = new ImageView(context);
this.backButtonView = imageView3;
imageView3.setImageResource(org.telegram.messenger.R.drawable.ic_ab_back);
this.backButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$3(view);
}
});
this.backButtonView.setContentDescription(LocaleController.getString(org.telegram.messenger.R.string.Back));
int dp2 = AndroidUtilities.dp(4.0f);
this.backButtonView.setPadding(dp2, dp2, dp2, dp2);
this.sizeNotifierFrameLayout.addView(this.backButtonView, LayoutHelper.createFrame(32, 32.0f, 51, 16.0f, 16.0f, 0.0f, 0.0f));
ImageView imageView22 = new ImageView(context);
this.proxyButtonView = imageView22;
ProxyDrawable proxyDrawable2 = new ProxyDrawable(context);
this.proxyDrawable = proxyDrawable2;
imageView22.setImageDrawable(proxyDrawable2);
this.proxyButtonView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.this.lambda$createView$4(view);
}
});
this.proxyButtonView.setAlpha(0.0f);
this.proxyButtonView.setVisibility(8);
this.sizeNotifierFrameLayout.addView(this.proxyButtonView, LayoutHelper.createFrame(32, 32.0f, 53, 16.0f, 16.0f, 16.0f, 16.0f));
updateProxyButton(false, true);
RadialProgressView radialProgressView3 = new RadialProgressView(context);
this.radialProgressView = radialProgressView3;
radialProgressView3.setSize(AndroidUtilities.dp(20.0f));
this.radialProgressView.setAlpha(0.0f);
this.radialProgressView.setScaleX(0.1f);
this.radialProgressView.setScaleY(0.1f);
this.sizeNotifierFrameLayout.addView(this.radialProgressView, LayoutHelper.createFrame(32, 32.0f, 53, 0.0f, 16.0f, 16.0f, 0.0f));
TransformableLoginButtonView transformableLoginButtonView2 = new TransformableLoginButtonView(context);
this.floatingButtonIcon = transformableLoginButtonView2;
transformableLoginButtonView2.setTransformType(0);
this.floatingButtonIcon.setProgress(1.0f);
this.floatingButtonIcon.setDrawBackground(false);
this.floatingButtonContainer.setContentDescription(LocaleController.getString("Done", org.telegram.messenger.R.string.Done));
this.floatingButtonContainer.addView(this.floatingButtonIcon, LayoutHelper.createFrame(i < 21 ? 56 : 60, i < 21 ? 56.0f : 60.0f));
RadialProgressView radialProgressView22 = new RadialProgressView(context);
this.floatingProgressView = radialProgressView22;
radialProgressView22.setSize(AndroidUtilities.dp(22.0f));
this.floatingProgressView.setAlpha(0.0f);
this.floatingProgressView.setScaleX(0.1f);
this.floatingProgressView.setScaleY(0.1f);
this.floatingProgressView.setVisibility(4);
this.floatingButtonContainer.addView(this.floatingProgressView, LayoutHelper.createFrame(-1, -1.0f));
if (bundle != null) {
}
i2 = 0;
while (true) {
slideViewArr = this.views;
if (i2 < slideViewArr.length) {
}
i2++;
}
this.restoringState = false;
updateColors();
if (isInCancelAccountDeletionMode()) {
}
return this.fragmentView;
}
public void lambda$createView$0(int i, boolean z) {
Runnable runnable;
if (i > AndroidUtilities.dp(20.0f) && isCustomKeyboardVisible()) {
AndroidUtilities.hideKeyboard(this.fragmentView);
}
if (i > AndroidUtilities.dp(20.0f) || (runnable = this.keyboardHideCallback) == null) {
return;
}
runnable.run();
this.keyboardHideCallback = null;
}
public void lambda$createView$1(View view) {
onDoneButtonPressed();
}
public void lambda$createView$2(DynamicAnimation dynamicAnimation, float f, float f2) {
PhoneNumberConfirmView phoneNumberConfirmView = this.phoneNumberConfirmView;
if (phoneNumberConfirmView != null) {
phoneNumberConfirmView.updateFabPosition();
}
}
public void lambda$createView$3(View view) {
if (onBackPressed()) {
finishFragment();
}
}
public void lambda$createView$4(View view) {
presentFragment(new ProxyListActivity());
}
public boolean isCustomKeyboardForceDisabled() {
Point point = AndroidUtilities.displaySize;
return point.x > point.y || AndroidUtilities.isTablet() || AndroidUtilities.isAccessibilityTouchExplorationEnabled();
}
public boolean isCustomKeyboardVisible() {
return this.views[this.currentViewNum].hasCustomKeyboard() && !isCustomKeyboardForceDisabled();
}
private void setCustomKeyboardVisible(boolean z, boolean z2) {
if (this.customKeyboardWasVisible == z && z2) {
return;
}
this.customKeyboardWasVisible = z;
if (isCustomKeyboardForceDisabled()) {
z = false;
}
if (z) {
AndroidUtilities.hideKeyboard(this.fragmentView);
AndroidUtilities.requestAltFocusable(getParentActivity(), this.classGuid);
if (z2) {
ValueAnimator duration = ValueAnimator.ofFloat(0.0f, 1.0f).setDuration(300L);
this.keyboardAnimator = duration;
duration.setInterpolator(CubicBezierInterpolator.DEFAULT);
this.keyboardAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$setCustomKeyboardVisible$5(valueAnimator);
}
});
this.keyboardAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
LoginActivity.this.keyboardView.setVisibility(0);
}
@Override
public void onAnimationEnd(Animator animator) {
if (LoginActivity.this.keyboardAnimator == animator) {
LoginActivity.this.keyboardAnimator = null;
}
}
});
this.keyboardAnimator.start();
return;
}
this.keyboardView.setVisibility(0);
return;
}
AndroidUtilities.removeAltFocusable(getParentActivity(), this.classGuid);
if (z2) {
ValueAnimator duration2 = ValueAnimator.ofFloat(1.0f, 0.0f).setDuration(300L);
this.keyboardAnimator = duration2;
duration2.setInterpolator(Easings.easeInOutQuad);
this.keyboardAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$setCustomKeyboardVisible$6(valueAnimator);
}
});
this.keyboardAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
LoginActivity.this.keyboardView.setVisibility(8);
if (LoginActivity.this.keyboardAnimator == animator) {
LoginActivity.this.keyboardAnimator = null;
}
}
});
this.keyboardAnimator.start();
return;
}
this.keyboardView.setVisibility(8);
}
public void lambda$setCustomKeyboardVisible$5(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.keyboardView.setAlpha(floatValue);
this.keyboardView.setTranslationY((1.0f - floatValue) * AndroidUtilities.dp(230.0f));
}
public void lambda$setCustomKeyboardVisible$6(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.keyboardView.setAlpha(floatValue);
this.keyboardView.setTranslationY((1.0f - floatValue) * AndroidUtilities.dp(230.0f));
}
@Override
public void onPause() {
super.onPause();
if (this.newAccount) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
}
AndroidUtilities.removeAltFocusable(getParentActivity(), this.classGuid);
}
@Override
public void onResume() {
SlideView slideView;
int i;
super.onResume();
if (this.newAccount) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
}
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
View view = this.fragmentView;
if (view != null) {
view.requestLayout();
}
try {
int i2 = this.currentViewNum;
if (i2 >= 1 && i2 <= 4) {
SlideView[] slideViewArr = this.views;
if ((slideViewArr[i2] instanceof LoginActivitySmsView) && (i = ((LoginActivitySmsView) slideViewArr[i2]).openTime) != 0 && Math.abs((System.currentTimeMillis() / 1000) - i) >= 86400) {
this.views[this.currentViewNum].onBackPressed(true);
setPage(0, false, null, true);
}
}
} catch (Exception e) {
FileLog.e(e);
}
int i3 = this.currentViewNum;
if (i3 == 0 && !this.needRequestPermissions && (slideView = this.views[i3]) != null) {
slideView.onShow();
}
if (isCustomKeyboardVisible()) {
AndroidUtilities.hideKeyboard(this.fragmentView);
AndroidUtilities.requestAltFocusable(getParentActivity(), this.classGuid);
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
setCustomKeyboardVisible(this.views[this.currentViewNum].hasCustomKeyboard(), false);
PhoneNumberConfirmView phoneNumberConfirmView = this.phoneNumberConfirmView;
if (phoneNumberConfirmView != null) {
phoneNumberConfirmView.dismiss();
}
}
@Override
public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) {
if (strArr.length == 0 || iArr.length == 0) {
return;
}
boolean z = iArr[0] == 0;
if (i == 6) {
this.checkPermissions = false;
int i2 = this.currentViewNum;
if (i2 == 0) {
((PhoneView) this.views[i2]).confirmedNumber = true;
this.views[this.currentViewNum].lambda$onNextPressed$14(null);
return;
}
return;
}
if (i == 7) {
this.checkShowPermissions = false;
int i3 = this.currentViewNum;
if (i3 == 0) {
((PhoneView) this.views[i3]).fillNumber();
return;
}
return;
}
if (i == 20) {
if (z) {
((LoginActivityRegisterView) this.views[5]).imageUpdater.openCamera();
}
} else if (i == 151 && z) {
final LoginActivityRegisterView loginActivityRegisterView = (LoginActivityRegisterView) this.views[5];
loginActivityRegisterView.post(new Runnable() {
@Override
public final void run() {
LoginActivity.lambda$onRequestPermissionsResultFragment$7(LoginActivity.LoginActivityRegisterView.this);
}
});
}
}
public static void lambda$onRequestPermissionsResultFragment$7(LoginActivityRegisterView loginActivityRegisterView) {
loginActivityRegisterView.imageUpdater.openGallery();
}
public static Bundle loadCurrentState(boolean z, int i) {
try {
Bundle bundle = new Bundle();
Context context = ApplicationLoader.applicationContext;
StringBuilder sb = new StringBuilder();
sb.append("logininfo2");
sb.append(z ? "_" + i : "");
for (Map.Entry<String, ?> entry : context.getSharedPreferences(sb.toString(), 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 (value instanceof Boolean) {
bundle.putBoolean(key, ((Boolean) value).booleanValue());
}
} 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());
} else if (value instanceof Boolean) {
bundle2.putBoolean(split[1], ((Boolean) value).booleanValue());
}
}
}
return bundle;
} catch (Exception e) {
FileLog.e(e);
return null;
}
}
private void clearCurrentState() {
String str;
Context context = ApplicationLoader.applicationContext;
StringBuilder sb = new StringBuilder();
sb.append("logininfo2");
if (this.newAccount) {
str = "_" + this.currentAccount;
} else {
str = "";
}
sb.append(str);
SharedPreferences.Editor edit = context.getSharedPreferences(sb.toString(), 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 Boolean) {
if (str != null) {
editor.putBoolean(str + "_|_" + str2, ((Boolean) obj).booleanValue());
} else {
editor.putBoolean(str2, ((Boolean) obj).booleanValue());
}
} else if (obj instanceof Bundle) {
putBundleToEditor((Bundle) obj, editor, str2);
}
}
}
@Override
public void onDialogDismiss(Dialog dialog) {
if (Build.VERSION.SDK_INT >= 23) {
try {
if (dialog == this.permissionsDialog && !this.permissionsItems.isEmpty() && getParentActivity() != null) {
getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
} else {
if (dialog != this.permissionsShowDialog || this.permissionsShowItems.isEmpty() || getParentActivity() == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$onDialogDismiss$8();
}
}, 200L);
getParentActivity().requestPermissions((String[]) this.permissionsShowItems.toArray(new String[0]), 7);
}
} catch (Exception unused) {
}
}
}
public void lambda$onDialogDismiss$8() {
this.needRequestPermissions = false;
}
@Override
public boolean onBackPressed() {
int i = this.currentViewNum;
int i2 = 0;
if (i != 0 && (this.activityMode != 3 || i != 12)) {
if (i == 6) {
this.views[i].onBackPressed(true);
setPage(0, true, null, true);
} else if (i == 7 || i == 8) {
this.views[i].onBackPressed(true);
setPage(6, true, null, true);
} else if ((i >= 1 && i <= 4) || i == 11 || i == 15) {
if (this.views[i].onBackPressed(false)) {
setPage(0, true, null, true);
}
} else if (i == 5) {
((LoginActivityRegisterView) this.views[i]).wrongNumber.callOnClick();
} else if (i == 9) {
this.views[i].onBackPressed(true);
setPage(7, true, null, true);
} else if (i == 10) {
this.views[i].onBackPressed(true);
setPage(9, true, null, true);
} else if (i == 13) {
this.views[i].onBackPressed(true);
setPage(12, true, null, true);
} else if (this.views[i].onBackPressed(true)) {
setPage(0, true, null, true);
}
return false;
}
while (true) {
SlideView[] slideViewArr = this.views;
if (i2 < slideViewArr.length) {
if (slideViewArr[i2] != null) {
slideViewArr[i2].onDestroyActivity();
}
i2++;
} else {
clearCurrentState();
return true;
}
}
}
@Override
public void onActivityResultFragment(int i, int i2, Intent intent) {
LoginActivityRegisterView loginActivityRegisterView = (LoginActivityRegisterView) this.views[5];
if (loginActivityRegisterView != null) {
loginActivityRegisterView.imageUpdater.onActivityResult(i, i2, intent);
}
}
public void needShowAlert(String str, String str2) {
if (str2 == null || getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(str);
builder.setMessage(str2);
builder.setPositiveButton(LocaleController.getString("OK", org.telegram.messenger.R.string.OK), null);
showDialog(builder.create());
}
public void onFieldError(final View view, boolean z) {
view.performHapticFeedback(3, 2);
AndroidUtilities.shakeViewSpring(view, 3.5f);
if (z && (view instanceof OutlineTextContainerView)) {
int i = org.telegram.messenger.R.id.timeout_callback;
Runnable runnable = (Runnable) view.getTag(i);
if (runnable != null) {
view.removeCallbacks(runnable);
}
final OutlineTextContainerView outlineTextContainerView = (OutlineTextContainerView) view;
AtomicReference atomicReference = new AtomicReference();
final EditText attachedEditText = outlineTextContainerView.getAttachedEditText();
final AnonymousClass8 anonymousClass8 = new AnonymousClass8(this, attachedEditText, atomicReference);
outlineTextContainerView.animateError(1.0f);
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
LoginActivity.lambda$onFieldError$10(OutlineTextContainerView.this, view, attachedEditText, anonymousClass8);
}
};
atomicReference.set(runnable2);
view.postDelayed(runnable2, 2000L);
view.setTag(i, runnable2);
if (attachedEditText != null) {
attachedEditText.addTextChangedListener(anonymousClass8);
}
}
}
public class AnonymousClass8 implements TextWatcher {
final EditText val$editText;
final AtomicReference val$timeoutCallbackRef;
@Override
public void afterTextChanged(Editable editable) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
AnonymousClass8(LoginActivity loginActivity, EditText editText, AtomicReference atomicReference) {
this.val$editText = editText;
this.val$timeoutCallbackRef = atomicReference;
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
final EditText editText = this.val$editText;
final AtomicReference atomicReference = this.val$timeoutCallbackRef;
editText.post(new Runnable() {
@Override
public final void run() {
LoginActivity.AnonymousClass8.this.lambda$beforeTextChanged$0(editText, atomicReference);
}
});
}
public void lambda$beforeTextChanged$0(EditText editText, AtomicReference atomicReference) {
editText.removeTextChangedListener(this);
editText.removeCallbacks((Runnable) atomicReference.get());
((Runnable) atomicReference.get()).run();
}
}
public static void lambda$onFieldError$10(OutlineTextContainerView outlineTextContainerView, View view, final EditText editText, final TextWatcher textWatcher) {
outlineTextContainerView.animateError(0.0f);
view.setTag(org.telegram.messenger.R.id.timeout_callback, null);
if (editText != null) {
editText.post(new Runnable() {
@Override
public final void run() {
editText.removeTextChangedListener(textWatcher);
}
});
}
}
public static void needShowInvalidAlert(BaseFragment baseFragment, String str, boolean z) {
needShowInvalidAlert(baseFragment, str, null, z);
}
public static void needShowInvalidAlert(final BaseFragment baseFragment, final String str, PhoneInputData phoneInputData, final boolean z) {
if (baseFragment == null || baseFragment.getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(baseFragment.getParentActivity());
if (z) {
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle));
builder.setMessage(LocaleController.getString("BannedPhoneNumber", org.telegram.messenger.R.string.BannedPhoneNumber));
} else if (phoneInputData == null || phoneInputData.patterns == null || phoneInputData.patterns.isEmpty() || phoneInputData.country == null) {
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle));
builder.setMessage(LocaleController.getString(org.telegram.messenger.R.string.InvalidPhoneNumber));
} else {
int i = ConnectionsManager.DEFAULT_DATACENTER_ID;
Iterator it = phoneInputData.patterns.iterator();
while (it.hasNext()) {
int length = ((String) it.next()).replace(" ", "").length();
if (length < i) {
i = length;
}
}
if (PhoneFormat.stripExceptNumbers(str).length() - phoneInputData.country.code.length() < i) {
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.WrongNumberFormat));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("ShortNumberInfo", org.telegram.messenger.R.string.ShortNumberInfo, phoneInputData.country.name, phoneInputData.phoneNumber)));
} else {
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle));
builder.setMessage(LocaleController.getString(org.telegram.messenger.R.string.InvalidPhoneNumber));
}
}
builder.setNeutralButton(LocaleController.getString("BotHelp", org.telegram.messenger.R.string.BotHelp), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LoginActivity.lambda$needShowInvalidAlert$11(z, str, baseFragment, dialogInterface, i2);
}
});
builder.setPositiveButton(LocaleController.getString("OK", org.telegram.messenger.R.string.OK), null);
baseFragment.showDialog(builder.create());
}
public static void lambda$needShowInvalidAlert$11(boolean z, String str, BaseFragment baseFragment, 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.SENDTO");
intent.setData(Uri.parse("mailto:"));
String[] strArr = new String[1];
strArr[0] = z ? "recover@telegram.org" : "login@stel.com";
intent.putExtra("android.intent.extra.EMAIL", strArr);
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 Telegram 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 Telegram 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());
}
baseFragment.getParentActivity().startActivity(Intent.createChooser(intent, "Send email..."));
} catch (Exception unused) {
AlertDialog.Builder builder = new AlertDialog.Builder(baseFragment.getParentActivity());
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle));
builder.setMessage(LocaleController.getString("NoMailInstalled", org.telegram.messenger.R.string.NoMailInstalled));
builder.setPositiveButton(LocaleController.getString("OK", org.telegram.messenger.R.string.OK), null);
baseFragment.showDialog(builder.create());
}
}
public void showDoneButton(final boolean z, boolean z2) {
TimeInterpolator timeInterpolator;
int i = this.currentDoneType;
final boolean z3 = i == 0;
if (this.doneButtonVisible[i] == z) {
return;
}
AnimatorSet[] animatorSetArr = this.showDoneAnimation;
if (animatorSetArr[i] != null) {
if (z2) {
animatorSetArr[i].removeAllListeners();
}
this.showDoneAnimation[this.currentDoneType].cancel();
}
boolean[] zArr = this.doneButtonVisible;
int i2 = this.currentDoneType;
zArr[i2] = z;
if (!z2) {
if (z) {
if (z3) {
this.floatingButtonContainer.setVisibility(0);
this.floatingAutoAnimator.setOffsetY(0.0f);
return;
}
return;
}
if (z3) {
this.floatingButtonContainer.setVisibility(8);
this.floatingAutoAnimator.setOffsetY(AndroidUtilities.dpf2(70.0f));
return;
}
return;
}
this.showDoneAnimation[i2] = new AnimatorSet();
if (z) {
if (z3) {
if (this.floatingButtonContainer.getVisibility() != 0) {
this.floatingAutoAnimator.setOffsetY(AndroidUtilities.dpf2(70.0f));
this.floatingButtonContainer.setVisibility(0);
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.floatingAutoAnimator.getOffsetY(), 0.0f);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$showDoneButton$12(valueAnimator);
}
});
this.showDoneAnimation[this.currentDoneType].play(ofFloat);
}
} else if (z3) {
ValueAnimator ofFloat2 = ValueAnimator.ofFloat(this.floatingAutoAnimator.getOffsetY(), AndroidUtilities.dpf2(70.0f));
ofFloat2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$showDoneButton$13(valueAnimator);
}
});
this.showDoneAnimation[this.currentDoneType].play(ofFloat2);
}
this.showDoneAnimation[this.currentDoneType].addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (LoginActivity.this.showDoneAnimation[!z3 ? 1 : 0] == null || !LoginActivity.this.showDoneAnimation[!z3 ? 1 : 0].equals(animator) || z) {
return;
}
if (z3) {
LoginActivity.this.floatingButtonContainer.setVisibility(8);
}
if (!z3 || LoginActivity.this.floatingButtonIcon.getAlpha() == 1.0f) {
return;
}
LoginActivity.this.floatingButtonIcon.setAlpha(1.0f);
LoginActivity.this.floatingButtonIcon.setScaleX(1.0f);
LoginActivity.this.floatingButtonIcon.setScaleY(1.0f);
LoginActivity.this.floatingButtonIcon.setVisibility(0);
LoginActivity.this.floatingButtonContainer.setEnabled(true);
LoginActivity.this.floatingProgressView.setAlpha(0.0f);
LoginActivity.this.floatingProgressView.setScaleX(0.1f);
LoginActivity.this.floatingProgressView.setScaleY(0.1f);
LoginActivity.this.floatingProgressView.setVisibility(4);
}
@Override
public void onAnimationCancel(Animator animator) {
if (LoginActivity.this.showDoneAnimation[!z3 ? 1 : 0] == null || !LoginActivity.this.showDoneAnimation[!z3 ? 1 : 0].equals(animator)) {
return;
}
LoginActivity.this.showDoneAnimation[!z3 ? 1 : 0] = null;
}
});
int i3 = ImageReceiver.DEFAULT_CROSSFADE_DURATION;
if (!z3) {
timeInterpolator = null;
} else if (z) {
i3 = 200;
timeInterpolator = AndroidUtilities.decelerateInterpolator;
} else {
timeInterpolator = AndroidUtilities.accelerateInterpolator;
}
this.showDoneAnimation[this.currentDoneType].setDuration(i3);
this.showDoneAnimation[this.currentDoneType].setInterpolator(timeInterpolator);
this.showDoneAnimation[this.currentDoneType].start();
}
public void lambda$showDoneButton$12(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.floatingAutoAnimator.setOffsetY(floatValue);
this.floatingButtonContainer.setAlpha(1.0f - (floatValue / AndroidUtilities.dpf2(70.0f)));
}
public void lambda$showDoneButton$13(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.floatingAutoAnimator.setOffsetY(floatValue);
this.floatingButtonContainer.setAlpha(1.0f - (floatValue / AndroidUtilities.dpf2(70.0f)));
}
public void onDoneButtonPressed() {
if (this.doneButtonVisible[this.currentDoneType]) {
if (this.radialProgressView.getTag() != null) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("StopLoadingTitle", org.telegram.messenger.R.string.StopLoadingTitle));
builder.setMessage(LocaleController.getString("StopLoading", org.telegram.messenger.R.string.StopLoading));
builder.setPositiveButton(LocaleController.getString("WaitMore", org.telegram.messenger.R.string.WaitMore), null);
builder.setNegativeButton(LocaleController.getString("Stop", org.telegram.messenger.R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.this.lambda$onDoneButtonPressed$14(dialogInterface, i);
}
});
showDialog(builder.create());
return;
}
this.views[this.currentViewNum].lambda$onNextPressed$14(null);
}
}
public void lambda$onDoneButtonPressed$14(DialogInterface dialogInterface, int i) {
this.views[this.currentViewNum].onCancelPressed();
needHideProgress(true);
}
private void showEditDoneProgress(boolean z, boolean z2) {
lambda$showEditDoneProgress$15(z, z2, false);
}
public void lambda$showEditDoneProgress$15(final boolean z, final boolean z2, final boolean z3) {
if (z2 && this.doneProgressVisible[this.currentDoneType] == z && !z3) {
return;
}
if (Looper.myLooper() != Looper.getMainLooper()) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$showEditDoneProgress$15(z, z2, z3);
}
});
return;
}
final int i = this.currentDoneType;
final boolean z4 = i == 0;
if (!z3 && !z4) {
this.doneProgressVisible[i] = z;
if (z2) {
if (this.postedEditDoneCallback[i]) {
AndroidUtilities.cancelRunOnUIThread(this.editDoneCallback[i]);
this.postedEditDoneCallback[this.currentDoneType] = false;
return;
} else if (z) {
Runnable[] runnableArr = this.editDoneCallback;
Runnable runnable = new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$showEditDoneProgress$16(i, z, z2);
}
};
runnableArr[i] = runnable;
AndroidUtilities.runOnUIThread(runnable, 2000L);
this.postedEditDoneCallback[this.currentDoneType] = true;
return;
}
}
} else {
this.postedEditDoneCallback[i] = false;
this.doneProgressVisible[i] = z;
}
AnimatorSet animatorSet = this.doneItemAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
if (z2) {
this.doneItemAnimation = new AnimatorSet();
float[] fArr = new float[2];
fArr[0] = z ? 0.0f : 1.0f;
fArr[1] = z ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
ofFloat.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
if (z) {
if (z4) {
LoginActivity.this.floatingButtonIcon.setVisibility(0);
LoginActivity.this.floatingProgressView.setVisibility(0);
LoginActivity.this.floatingButtonContainer.setEnabled(false);
return;
}
LoginActivity.this.radialProgressView.setVisibility(0);
}
}
@Override
public void onAnimationEnd(Animator animator) {
if (z4) {
if (!z) {
LoginActivity.this.floatingProgressView.setVisibility(4);
LoginActivity.this.floatingButtonIcon.setVisibility(0);
LoginActivity.this.floatingButtonContainer.setEnabled(true);
} else {
LoginActivity.this.floatingButtonIcon.setVisibility(4);
LoginActivity.this.floatingProgressView.setVisibility(0);
}
} else if (!z) {
LoginActivity.this.radialProgressView.setVisibility(4);
}
if (LoginActivity.this.doneItemAnimation == null || !LoginActivity.this.doneItemAnimation.equals(animator)) {
return;
}
LoginActivity.this.doneItemAnimation = null;
}
});
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$showEditDoneProgress$17(z4, valueAnimator);
}
});
this.doneItemAnimation.playTogether(ofFloat);
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
return;
}
if (z) {
if (z4) {
this.floatingProgressView.setVisibility(0);
this.floatingButtonIcon.setVisibility(4);
this.floatingButtonContainer.setEnabled(false);
this.floatingButtonIcon.setScaleX(0.1f);
this.floatingButtonIcon.setScaleY(0.1f);
this.floatingButtonIcon.setAlpha(0.0f);
this.floatingProgressView.setScaleX(1.0f);
this.floatingProgressView.setScaleY(1.0f);
this.floatingProgressView.setAlpha(1.0f);
return;
}
this.radialProgressView.setVisibility(0);
this.radialProgressView.setScaleX(1.0f);
this.radialProgressView.setScaleY(1.0f);
this.radialProgressView.setAlpha(1.0f);
return;
}
this.radialProgressView.setTag(null);
if (z4) {
this.floatingProgressView.setVisibility(4);
this.floatingButtonIcon.setVisibility(0);
this.floatingButtonContainer.setEnabled(true);
this.floatingProgressView.setScaleX(0.1f);
this.floatingProgressView.setScaleY(0.1f);
this.floatingProgressView.setAlpha(0.0f);
this.floatingButtonIcon.setScaleX(1.0f);
this.floatingButtonIcon.setScaleY(1.0f);
this.floatingButtonIcon.setAlpha(1.0f);
return;
}
this.radialProgressView.setVisibility(4);
this.radialProgressView.setScaleX(0.1f);
this.radialProgressView.setScaleY(0.1f);
this.radialProgressView.setAlpha(0.0f);
}
public void lambda$showEditDoneProgress$16(int i, boolean z, boolean z2) {
int i2 = this.currentDoneType;
this.currentDoneType = i;
lambda$showEditDoneProgress$15(z, z2, true);
this.currentDoneType = i2;
}
public void lambda$showEditDoneProgress$17(boolean z, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
if (z) {
float f = 1.0f - floatValue;
float f2 = (f * 0.9f) + 0.1f;
this.floatingButtonIcon.setScaleX(f2);
this.floatingButtonIcon.setScaleY(f2);
this.floatingButtonIcon.setAlpha(f);
float f3 = (0.9f * floatValue) + 0.1f;
this.floatingProgressView.setScaleX(f3);
this.floatingProgressView.setScaleY(f3);
this.floatingProgressView.setAlpha(floatValue);
return;
}
float f4 = (0.9f * floatValue) + 0.1f;
this.radialProgressView.setScaleX(f4);
this.radialProgressView.setScaleY(f4);
this.radialProgressView.setAlpha(floatValue);
}
public void needShowProgress(int i) {
needShowProgress(i, true);
}
public void needShowProgress(int i, boolean z) {
if (isInCancelAccountDeletionMode() && i == 0) {
if (this.cancelDeleteProgressDialog != null || getParentActivity() == null || getParentActivity().isFinishing()) {
return;
}
AlertDialog alertDialog = new AlertDialog(getParentActivity(), 3);
this.cancelDeleteProgressDialog = alertDialog;
alertDialog.setCanCancel(false);
this.cancelDeleteProgressDialog.show();
return;
}
this.progressRequestId = i;
showEditDoneProgress(true, z);
}
public void needHideProgress(boolean z) {
needHideProgress(z, true);
}
public void needHideProgress(boolean z, boolean z2) {
AlertDialog alertDialog;
if (this.progressRequestId != 0) {
if (z) {
ConnectionsManager.getInstance(this.currentAccount).cancelRequest(this.progressRequestId, true);
}
this.progressRequestId = 0;
}
if (isInCancelAccountDeletionMode() && (alertDialog = this.cancelDeleteProgressDialog) != null) {
alertDialog.dismiss();
this.cancelDeleteProgressDialog = null;
}
showEditDoneProgress(false, z2);
}
public void setPage(int i, boolean z, Bundle bundle, boolean z2) {
final boolean z3 = i == 0 || i == 5 || i == 6 || i == 9 || i == 10 || i == 12;
if (i == this.currentViewNum) {
z = false;
}
if (z3) {
if (i == 0) {
this.checkPermissions = true;
this.checkShowPermissions = true;
}
this.currentDoneType = 1;
showDoneButton(false, z);
showEditDoneProgress(false, z);
this.currentDoneType = 0;
showEditDoneProgress(false, z);
if (!z) {
showDoneButton(true, false);
}
} else {
this.currentDoneType = 0;
showDoneButton(false, z);
showEditDoneProgress(false, z);
if (i != 8) {
this.currentDoneType = 1;
}
}
if (z) {
SlideView[] slideViewArr = this.views;
final SlideView slideView = slideViewArr[this.currentViewNum];
SlideView slideView2 = slideViewArr[i];
this.currentViewNum = i;
this.backButtonView.setVisibility((slideView2.needBackButton() || this.newAccount) ? 0 : 8);
slideView2.setParams(bundle, false);
setParentActivityTitle(slideView2.getHeaderName());
slideView2.onShow();
int i2 = AndroidUtilities.displaySize.x;
if (z2) {
i2 = -i2;
}
slideView2.setX(i2);
slideView2.setVisibility(0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (LoginActivity.this.currentDoneType == 0 && z3) {
LoginActivity.this.showDoneButton(true, true);
}
slideView.setVisibility(8);
slideView.onHide();
slideView.setX(0.0f);
}
});
Animator[] animatorArr = new Animator[2];
Property property = View.TRANSLATION_X;
float[] fArr = new float[1];
fArr[0] = z2 ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x;
animatorArr[0] = ObjectAnimator.ofFloat(slideView, (Property<SlideView, Float>) property, fArr);
animatorArr[1] = ObjectAnimator.ofFloat(slideView2, (Property<SlideView, Float>) View.TRANSLATION_X, 0.0f);
animatorSet.playTogether(animatorArr);
animatorSet.setDuration(300L);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.start();
setCustomKeyboardVisible(slideView2.hasCustomKeyboard(), true);
return;
}
this.backButtonView.setVisibility((this.views[i].needBackButton() || this.newAccount) ? 0 : 8);
this.views[this.currentViewNum].setVisibility(8);
this.views[this.currentViewNum].onHide();
this.currentViewNum = i;
this.views[i].setParams(bundle, false);
this.views[i].setVisibility(0);
setParentActivityTitle(this.views[i].getHeaderName());
this.views[i].onShow();
setCustomKeyboardVisible(this.views[i].hasCustomKeyboard(), false);
}
@Override
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);
}
}
Context context = ApplicationLoader.applicationContext;
StringBuilder sb = new StringBuilder();
sb.append("logininfo2");
sb.append(this.newAccount ? "_" + this.currentAccount : "");
SharedPreferences.Editor edit = context.getSharedPreferences(sb.toString(), 0).edit();
edit.clear();
putBundleToEditor(bundle2, edit, null);
edit.commit();
} catch (Exception e) {
FileLog.e(e);
}
}
private void needFinishActivity(final boolean z, boolean z2, int i) {
if (getParentActivity() != null) {
AndroidUtilities.setLightStatusBar(getParentActivity().getWindow(), false);
}
clearCurrentState();
if (getParentActivity() instanceof LaunchActivity) {
if (this.newAccount) {
this.newAccount = false;
((LaunchActivity) getParentActivity()).switchToAccount(this.currentAccount, false, new GenericProvider() {
@Override
public final Object provide(Object obj) {
DialogsActivity lambda$needFinishActivity$18;
lambda$needFinishActivity$18 = LoginActivity.lambda$needFinishActivity$18(z, (Void) obj);
return lambda$needFinishActivity$18;
}
});
finishFragment();
return;
}
if (z && z2) {
TwoStepVerificationSetupActivity twoStepVerificationSetupActivity = new TwoStepVerificationSetupActivity(6, null);
twoStepVerificationSetupActivity.setBlockingAlert(i);
twoStepVerificationSetupActivity.setFromRegistration(true);
presentFragment(twoStepVerificationSetupActivity, true);
} else {
Bundle bundle = new Bundle();
bundle.putBoolean("afterSignup", z);
presentFragment(new DialogsActivity(bundle), true);
}
NotificationCenter.getInstance(this.currentAccount).lambda$postNotificationNameOnUIThread$1(NotificationCenter.mainUserInfoChanged, new Object[0]);
LocaleController.getInstance().loadRemoteLanguages(this.currentAccount);
RestrictedLanguagesSelectActivity.checkRestrictedLanguages(true);
return;
}
if (getParentActivity() instanceof ExternalActionActivity) {
((ExternalActionActivity) getParentActivity()).onFinishLogin();
}
}
public static DialogsActivity lambda$needFinishActivity$18(boolean z, Void r2) {
Bundle bundle = new Bundle();
bundle.putBoolean("afterSignup", z);
return new DialogsActivity(bundle);
}
public void onAuthSuccess(TLRPC$TL_auth_authorization tLRPC$TL_auth_authorization) {
onAuthSuccess(tLRPC$TL_auth_authorization, false);
}
public void onAuthSuccess(TLRPC$TL_auth_authorization tLRPC$TL_auth_authorization, boolean z) {
MessagesController.getInstance(this.currentAccount).cleanup();
ConnectionsManager.getInstance(this.currentAccount).setUserId(tLRPC$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(tLRPC$TL_auth_authorization.user);
UserConfig.getInstance(this.currentAccount).saveConfig(true);
MessagesStorage.getInstance(this.currentAccount).cleanup(true);
ArrayList arrayList = new ArrayList();
arrayList.add(tLRPC$TL_auth_authorization.user);
MessagesStorage.getInstance(this.currentAccount).putUsersAndChats(arrayList, null, true, true);
MessagesController.getInstance(this.currentAccount).putUser(tLRPC$TL_auth_authorization.user, false);
ContactsController.getInstance(this.currentAccount).checkAppAccount();
MessagesController.getInstance(this.currentAccount).checkPromoInfo(true);
ConnectionsManager.getInstance(this.currentAccount).updateDcSettings();
MessagesController.getInstance(this.currentAccount).loadAppConfig();
if (tLRPC$TL_auth_authorization.future_auth_token != null) {
AuthTokensHelper.saveLogInToken(tLRPC$TL_auth_authorization);
} else {
FileLog.d("onAuthSuccess future_auth_token is empty");
}
if (z) {
MessagesController.getInstance(this.currentAccount).putDialogsEndReachedAfterRegistration();
}
MediaDataController.getInstance(this.currentAccount).loadStickersByEmojiOrName(AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME, false, true);
needFinishActivity(z, tLRPC$TL_auth_authorization.setup_password_required, tLRPC$TL_auth_authorization.otherwise_relogin_days);
}
public void fillNextCodeParams(Bundle bundle, TLRPC$TL_account_sentEmailCode tLRPC$TL_account_sentEmailCode) {
bundle.putString("emailPattern", tLRPC$TL_account_sentEmailCode.email_pattern);
bundle.putInt("length", tLRPC$TL_account_sentEmailCode.length);
setPage(13, true, bundle, false);
}
public void lambda$resendCodeFromSafetyNet$19(Bundle bundle, TLRPC$auth_SentCode tLRPC$auth_SentCode) {
lambda$fillNextCodeParams$23(bundle, tLRPC$auth_SentCode, true);
}
private void resendCodeFromSafetyNet(final Bundle bundle, TLRPC$auth_SentCode tLRPC$auth_SentCode) {
if (this.isRequestingFirebaseSms) {
needHideProgress(false);
this.isRequestingFirebaseSms = false;
TLRPC$TL_auth_resendCode tLRPC$TL_auth_resendCode = new TLRPC$TL_auth_resendCode();
tLRPC$TL_auth_resendCode.phone_number = bundle.getString("phoneFormated");
tLRPC$TL_auth_resendCode.phone_code_hash = tLRPC$auth_SentCode.phone_code_hash;
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tLRPC$TL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$22(bundle, tLObject, tLRPC$TL_error);
}
}, 10);
}
}
public void lambda$resendCodeFromSafetyNet$22(final Bundle bundle, final TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if (tLObject != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, tLObject);
}
});
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$resendCodeFromSafetyNet$21();
}
});
}
}
public void lambda$resendCodeFromSafetyNet$21() {
if (getParentActivity() == null || getParentActivity().isFinishing() || getContext() == null) {
return;
}
new AlertDialog.Builder(getContext()).setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle)).setMessage(LocaleController.getString(org.telegram.messenger.R.string.SafetyNetErrorOccurred)).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$20(dialogInterface, i);
}
}).show();
}
public void lambda$resendCodeFromSafetyNet$20(DialogInterface dialogInterface, int i) {
this.forceDisableSafetyNet = true;
if (this.currentViewNum != 0) {
setPage(0, true, null, true);
}
}
public void lambda$fillNextCodeParams$23(final Bundle bundle, final TLRPC$auth_SentCode tLRPC$auth_SentCode, final boolean z) {
TLRPC$auth_SentCodeType tLRPC$auth_SentCodeType = tLRPC$auth_SentCode.type;
if ((tLRPC$auth_SentCodeType instanceof TLRPC$TL_auth_sentCodeTypeFirebaseSms) && !tLRPC$auth_SentCodeType.verifiedFirebase && !this.isRequestingFirebaseSms) {
if (PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices()) {
needShowProgress(0);
this.isRequestingFirebaseSms = true;
SafetyNet.getClient(ApplicationLoader.applicationContext).attest(tLRPC$auth_SentCode.type.nonce, BuildVars.SAFETYNET_KEY).addOnSuccessListener(new OnSuccessListener() {
@Override
public final void onSuccess(Object obj) {
LoginActivity.this.lambda$fillNextCodeParams$25(bundle, tLRPC$auth_SentCode, z, (SafetyNetApi$AttestationResponse) obj);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public final void onFailure(Exception exc) {
LoginActivity.this.lambda$fillNextCodeParams$26(bundle, tLRPC$auth_SentCode, exc);
}
});
return;
} else {
FileLog.d("Resend firebase sms because firebase is not available");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
return;
}
}
bundle.putString("phoneHash", tLRPC$auth_SentCode.phone_code_hash);
TLRPC$auth_CodeType tLRPC$auth_CodeType = tLRPC$auth_SentCode.next_type;
if (tLRPC$auth_CodeType instanceof TLRPC$TL_auth_codeTypeCall) {
bundle.putInt("nextType", 4);
} else if (tLRPC$auth_CodeType instanceof TLRPC$TL_auth_codeTypeFlashCall) {
bundle.putInt("nextType", 3);
} else if (tLRPC$auth_CodeType instanceof TLRPC$TL_auth_codeTypeSms) {
bundle.putInt("nextType", 2);
} else if (tLRPC$auth_CodeType instanceof TLRPC$TL_auth_codeTypeMissedCall) {
bundle.putInt("nextType", 11);
} else if (tLRPC$auth_CodeType instanceof TLRPC$TL_auth_codeTypeFragmentSms) {
bundle.putInt("nextType", 15);
}
if (tLRPC$auth_SentCode.type instanceof TLRPC$TL_auth_sentCodeTypeApp) {
bundle.putInt("type", 1);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
setPage(1, z, bundle, false);
return;
}
if (tLRPC$auth_SentCode.timeout == 0) {
tLRPC$auth_SentCode.timeout = 60;
}
bundle.putInt("timeout", tLRPC$auth_SentCode.timeout * 1000);
TLRPC$auth_SentCodeType tLRPC$auth_SentCodeType2 = tLRPC$auth_SentCode.type;
if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeCall) {
bundle.putInt("type", 4);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
setPage(4, z, bundle, false);
return;
}
if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeFlashCall) {
bundle.putInt("type", 3);
bundle.putString("pattern", tLRPC$auth_SentCode.type.pattern);
setPage(3, z, bundle, false);
return;
}
if ((tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeSms) || (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeFirebaseSms)) {
bundle.putInt("type", 2);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
bundle.putBoolean("firebase", tLRPC$auth_SentCode.type instanceof TLRPC$TL_auth_sentCodeTypeFirebaseSms);
setPage(2, z, bundle, false);
return;
}
if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeFragmentSms) {
bundle.putInt("type", 15);
bundle.putString("url", tLRPC$auth_SentCode.type.url);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
setPage(15, z, bundle, false);
return;
}
if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeMissedCall) {
bundle.putInt("type", 11);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
bundle.putString("prefix", tLRPC$auth_SentCode.type.prefix);
setPage(11, z, bundle, false);
return;
}
if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeSetUpEmailRequired) {
bundle.putBoolean("googleSignInAllowed", tLRPC$auth_SentCodeType2.google_signin_allowed);
setPage(12, z, bundle, false);
} else if (tLRPC$auth_SentCodeType2 instanceof TLRPC$TL_auth_sentCodeTypeEmailCode) {
bundle.putBoolean("googleSignInAllowed", tLRPC$auth_SentCodeType2.google_signin_allowed);
bundle.putString("emailPattern", tLRPC$auth_SentCode.type.email_pattern);
bundle.putInt("length", tLRPC$auth_SentCode.type.length);
bundle.putInt("nextPhoneLoginDate", tLRPC$auth_SentCode.type.next_phone_login_date);
bundle.putInt("resetAvailablePeriod", tLRPC$auth_SentCode.type.reset_available_period);
bundle.putInt("resetPendingDate", tLRPC$auth_SentCode.type.reset_pending_date);
setPage(14, z, bundle, false);
}
}
public void lambda$fillNextCodeParams$25(final Bundle bundle, final TLRPC$auth_SentCode tLRPC$auth_SentCode, final boolean z, SafetyNetApi$AttestationResponse safetyNetApi$AttestationResponse) {
String jwsResult = safetyNetApi$AttestationResponse.getJwsResult();
if (jwsResult != null) {
TLRPC$TL_auth_requestFirebaseSms tLRPC$TL_auth_requestFirebaseSms = new TLRPC$TL_auth_requestFirebaseSms();
tLRPC$TL_auth_requestFirebaseSms.phone_number = bundle.getString("phoneFormated");
tLRPC$TL_auth_requestFirebaseSms.phone_code_hash = tLRPC$auth_SentCode.phone_code_hash;
tLRPC$TL_auth_requestFirebaseSms.safety_net_token = jwsResult;
tLRPC$TL_auth_requestFirebaseSms.flags |= 1;
String[] split = jwsResult.split("\\.");
if (split.length > 0) {
try {
JSONObject jSONObject = new JSONObject(new String(Base64.decode(split[1].getBytes(StandardCharsets.UTF_8), 0)));
if (jSONObject.optBoolean("basicIntegrity") && jSONObject.optBoolean("ctsProfileMatch")) {
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tLRPC$TL_auth_requestFirebaseSms, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.this.lambda$fillNextCodeParams$24(tLRPC$auth_SentCode, bundle, z, tLObject, tLRPC$TL_error);
}
}, 10);
} else {
FileLog.d("Resend firebase sms because ctsProfileMatch or basicIntegrity = false");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
}
return;
} catch (JSONException e) {
FileLog.e(e);
FileLog.d("Resend firebase sms because of exception");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
return;
}
}
FileLog.d("Resend firebase sms because can't split JWS token");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
return;
}
FileLog.d("Resend firebase sms because JWS = null");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
}
public void lambda$fillNextCodeParams$24(final TLRPC$auth_SentCode tLRPC$auth_SentCode, final Bundle bundle, final boolean z, TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if (tLObject instanceof TLRPC$TL_boolTrue) {
needHideProgress(false);
this.isRequestingFirebaseSms = false;
tLRPC$auth_SentCode.type.verifiedFirebase = true;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$fillNextCodeParams$23(bundle, tLRPC$auth_SentCode, z);
}
});
return;
}
FileLog.d("Resend firebase sms because auth.requestFirebaseSms = false");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
}
public void lambda$fillNextCodeParams$26(Bundle bundle, TLRPC$auth_SentCode tLRPC$auth_SentCode, Exception exc) {
FileLog.e(exc);
FileLog.d("Resend firebase sms because of safetynet exception");
resendCodeFromSafetyNet(bundle, tLRPC$auth_SentCode);
}
public class PhoneView extends SlideView implements AdapterView.OnItemSelectedListener, NotificationCenter.NotificationCenterDelegate {
private ImageView chevronRight;
private View codeDividerView;
private AnimatedPhoneNumberEditText codeField;
private HashMap<String, List<CountrySelectActivity.Country>> codesMap;
private boolean confirmedNumber;
private ArrayList<CountrySelectActivity.Country> countriesArray;
private TextViewSwitcher countryButton;
private String countryCodeForHint;
private OutlineTextContainerView countryOutlineView;
private int countryState;
private CountrySelectActivity.Country currentCountry;
private boolean ignoreOnPhoneChange;
private boolean ignoreOnTextChange;
private boolean ignoreSelection;
private boolean nextPressed;
private boolean numberFilled;
private AnimatedPhoneNumberEditText phoneField;
private HashMap<String, List<String>> phoneFormatMap;
private OutlineTextContainerView phoneOutlineView;
private TextView plusTextView;
private TextView subtitleView;
private CheckBoxCell syncContactsBox;
private CheckBoxCell testBackendCheckBox;
private TextView titleView;
private int wasCountryHintIndex;
@Override
public boolean hasCustomKeyboard() {
return true;
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
public PhoneView(final Context context) {
super(context);
this.countryState = 0;
this.countriesArray = new ArrayList<>();
this.codesMap = new HashMap<>();
this.phoneFormatMap = new HashMap<>();
this.ignoreSelection = false;
this.ignoreOnTextChange = false;
this.ignoreOnPhoneChange = false;
this.nextPressed = false;
this.confirmedNumber = false;
this.wasCountryHintIndex = -1;
setOrientation(1);
setGravity(17);
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(LoginActivity.this.activityMode == 2 ? org.telegram.messenger.R.string.ChangePhoneNewNumber : org.telegram.messenger.R.string.YourNumber));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 0.0f, 32.0f, 0.0f));
TextView textView2 = new TextView(context);
this.subtitleView = textView2;
textView2.setText(LocaleController.getString(LoginActivity.this.activityMode == 2 ? org.telegram.messenger.R.string.ChangePhoneHelp : org.telegram.messenger.R.string.StartText));
this.subtitleView.setTextSize(1, 14.0f);
this.subtitleView.setGravity(17);
this.subtitleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.subtitleView, LayoutHelper.createLinear(-1, -2, 1, 32, 8, 32, 0));
TextViewSwitcher textViewSwitcher = new TextViewSwitcher(context);
this.countryButton = textViewSwitcher;
textViewSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
@Override
public final View makeView() {
View lambda$new$0;
lambda$new$0 = LoginActivity.PhoneView.lambda$new$0(context);
return lambda$new$0;
}
});
Animation loadAnimation = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_in);
loadAnimation.setInterpolator(Easings.easeInOutQuad);
this.countryButton.setInAnimation(loadAnimation);
ImageView imageView = new ImageView(context);
this.chevronRight = imageView;
imageView.setImageResource(org.telegram.messenger.R.drawable.msg_inputarrow);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
linearLayout.setGravity(16);
linearLayout.addView(this.countryButton, LayoutHelper.createLinear(0, -2, 1.0f, 0, 0, 0, 0));
linearLayout.addView(this.chevronRight, LayoutHelper.createLinearRelatively(24.0f, 24.0f, 0, 0.0f, 0.0f, 14.0f, 0.0f));
OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context);
this.countryOutlineView = outlineTextContainerView;
int i = org.telegram.messenger.R.string.Country;
outlineTextContainerView.setText(LocaleController.getString(i));
this.countryOutlineView.addView(linearLayout, LayoutHelper.createFrame(-1, -1.0f, 48, 0.0f, 0.0f, 0.0f, 0.0f));
this.countryOutlineView.setForceUseCenter(true);
this.countryOutlineView.setFocusable(true);
this.countryOutlineView.setContentDescription(LocaleController.getString(i));
this.countryOutlineView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.PhoneView.this.lambda$new$1(view, z);
}
});
addView(this.countryOutlineView, LayoutHelper.createLinear(-1, 58, 16.0f, 24.0f, 16.0f, 14.0f));
this.countryOutlineView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.PhoneView.this.lambda$new$4(view);
}
});
LinearLayout linearLayout2 = new LinearLayout(context);
linearLayout2.setOrientation(0);
OutlineTextContainerView outlineTextContainerView2 = new OutlineTextContainerView(context);
this.phoneOutlineView = outlineTextContainerView2;
outlineTextContainerView2.addView(linearLayout2, LayoutHelper.createFrame(-1, -2.0f, 16, 16.0f, 8.0f, 16.0f, 8.0f));
OutlineTextContainerView outlineTextContainerView3 = this.phoneOutlineView;
int i2 = org.telegram.messenger.R.string.PhoneNumber;
outlineTextContainerView3.setText(LocaleController.getString(i2));
addView(this.phoneOutlineView, LayoutHelper.createLinear(-1, 58, 16.0f, 8.0f, 16.0f, 8.0f));
TextView textView3 = new TextView(context);
this.plusTextView = textView3;
textView3.setText("+");
this.plusTextView.setTextSize(1, 16.0f);
this.plusTextView.setFocusable(false);
linearLayout2.addView(this.plusTextView, LayoutHelper.createLinear(-2, -2));
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = new AnimatedPhoneNumberEditText(context, LoginActivity.this) {
@Override
public void onFocusChanged(boolean z, int i3, Rect rect) {
super.onFocusChanged(z, i3, rect);
PhoneView.this.phoneOutlineView.animateSelection((z || PhoneView.this.phoneField.isFocused()) ? 1.0f : 0.0f);
if (z) {
LoginActivity.this.keyboardView.setEditText(this);
}
}
};
this.codeField = animatedPhoneNumberEditText;
animatedPhoneNumberEditText.setInputType(3);
this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
this.codeField.setTextSize(1, 16.0f);
this.codeField.setMaxLines(1);
this.codeField.setGravity(19);
this.codeField.setImeOptions(268435461);
this.codeField.setBackground(null);
int i3 = Build.VERSION.SDK_INT;
if (i3 >= 21) {
this.codeField.setShowSoftInputOnFocus(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
}
this.codeField.setContentDescription(LocaleController.getString(org.telegram.messenger.R.string.LoginAccessibilityCountryCode));
linearLayout2.addView(this.codeField, LayoutHelper.createLinear(55, 36, -9.0f, 0.0f, 0.0f, 0.0f));
this.codeField.addTextChangedListener(new TextWatcher(LoginActivity.this) {
@Override
public void beforeTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
@Override
public void afterTextChanged(Editable editable) {
boolean z;
String str;
CountrySelectActivity.Country country;
CountrySelectActivity.Country country2;
if (PhoneView.this.ignoreOnTextChange) {
return;
}
PhoneView.this.ignoreOnTextChange = true;
String stripExceptNumbers = PhoneFormat.stripExceptNumbers(PhoneView.this.codeField.getText().toString());
PhoneView.this.codeField.setText(stripExceptNumbers);
if (stripExceptNumbers.length() == 0) {
PhoneView.this.setCountryButtonText(null);
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 1;
} else {
int i4 = 4;
if (stripExceptNumbers.length() > 4) {
while (true) {
if (i4 < 1) {
z = false;
str = null;
break;
}
String substring = stripExceptNumbers.substring(0, i4);
List list = (List) PhoneView.this.codesMap.get(substring);
if (list == null) {
country2 = null;
} else if (list.size() > 1) {
String string = MessagesController.getGlobalMainSettings().getString("phone_code_last_matched_" + substring, null);
country2 = (CountrySelectActivity.Country) list.get(list.size() - 1);
if (string != null) {
Iterator it = PhoneView.this.countriesArray.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
CountrySelectActivity.Country country3 = (CountrySelectActivity.Country) it.next();
if (Objects.equals(country3.shortname, string)) {
country2 = country3;
break;
}
}
}
} else {
country2 = (CountrySelectActivity.Country) list.get(0);
}
if (country2 != null) {
String str2 = stripExceptNumbers.substring(i4) + PhoneView.this.phoneField.getText().toString();
PhoneView.this.codeField.setText(substring);
z = true;
str = str2;
stripExceptNumbers = substring;
break;
}
i4--;
}
if (!z) {
str = stripExceptNumbers.substring(1) + PhoneView.this.phoneField.getText().toString();
AnimatedPhoneNumberEditText animatedPhoneNumberEditText2 = PhoneView.this.codeField;
stripExceptNumbers = stripExceptNumbers.substring(0, 1);
animatedPhoneNumberEditText2.setText(stripExceptNumbers);
}
} else {
z = false;
str = null;
}
Iterator it2 = PhoneView.this.countriesArray.iterator();
int i5 = 0;
CountrySelectActivity.Country country4 = null;
while (it2.hasNext()) {
CountrySelectActivity.Country country5 = (CountrySelectActivity.Country) it2.next();
if (country5.code.startsWith(stripExceptNumbers)) {
i5++;
if (country5.code.equals(stripExceptNumbers)) {
if (country4 != null && country4.code.equals(country5.code)) {
i5--;
}
country4 = country5;
}
}
}
if (i5 == 1 && country4 != null && str == null) {
str = stripExceptNumbers.substring(country4.code.length()) + PhoneView.this.phoneField.getText().toString();
AnimatedPhoneNumberEditText animatedPhoneNumberEditText3 = PhoneView.this.codeField;
String str3 = country4.code;
animatedPhoneNumberEditText3.setText(str3);
stripExceptNumbers = str3;
}
List list2 = (List) PhoneView.this.codesMap.get(stripExceptNumbers);
if (list2 == null) {
country = null;
} else if (list2.size() > 1) {
String string2 = MessagesController.getGlobalMainSettings().getString("phone_code_last_matched_" + stripExceptNumbers, null);
country = (CountrySelectActivity.Country) list2.get(list2.size() - 1);
if (string2 != null) {
Iterator it3 = PhoneView.this.countriesArray.iterator();
while (true) {
if (!it3.hasNext()) {
break;
}
CountrySelectActivity.Country country6 = (CountrySelectActivity.Country) it3.next();
if (Objects.equals(country6.shortname, string2)) {
country = country6;
break;
}
}
}
} else {
country = (CountrySelectActivity.Country) list2.get(0);
}
if (country != null) {
PhoneView.this.ignoreSelection = true;
PhoneView.this.currentCountry = country;
PhoneView.this.setCountryHint(stripExceptNumbers, country);
PhoneView.this.countryState = 0;
} else {
PhoneView.this.setCountryButtonText(null);
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() {
@Override
public final boolean onEditorAction(TextView textView4, int i4, KeyEvent keyEvent) {
boolean lambda$new$5;
lambda$new$5 = LoginActivity.PhoneView.this.lambda$new$5(textView4, i4, keyEvent);
return lambda$new$5;
}
});
this.codeDividerView = new View(context);
LinearLayout.LayoutParams createLinear = LayoutHelper.createLinear(0, -1, 4.0f, 8.0f, 12.0f, 8.0f);
createLinear.width = Math.max(2, AndroidUtilities.dp(0.5f));
linearLayout2.addView(this.codeDividerView, createLinear);
AnimatedPhoneNumberEditText animatedPhoneNumberEditText2 = new AnimatedPhoneNumberEditText(context, LoginActivity.this) {
@Override
public boolean onKeyDown(int i4, KeyEvent keyEvent) {
if (i4 == 67 && PhoneView.this.phoneField.length() == 0) {
PhoneView.this.codeField.requestFocus();
PhoneView.this.codeField.setSelection(PhoneView.this.codeField.length());
PhoneView.this.codeField.dispatchKeyEvent(keyEvent);
}
return super.onKeyDown(i4, keyEvent);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (motionEvent.getAction() == 0 && !LoginActivity.this.showKeyboard(this)) {
clearFocus();
requestFocus();
}
return super.onTouchEvent(motionEvent);
}
@Override
public void onFocusChanged(boolean z, int i4, Rect rect) {
super.onFocusChanged(z, i4, rect);
PhoneView.this.phoneOutlineView.animateSelection((z || PhoneView.this.codeField.isFocused()) ? 1.0f : 0.0f);
if (z) {
LoginActivity.this.keyboardView.setEditText(this);
LoginActivity.this.keyboardView.setDispatchBackWhenEmpty(true);
if (PhoneView.this.countryState == 2) {
PhoneView.this.setCountryButtonText(LocaleController.getString(org.telegram.messenger.R.string.WrongCountry));
return;
}
return;
}
if (PhoneView.this.countryState == 2) {
PhoneView.this.setCountryButtonText(null);
}
}
};
this.phoneField = animatedPhoneNumberEditText2;
animatedPhoneNumberEditText2.setInputType(3);
this.phoneField.setPadding(0, 0, 0, 0);
this.phoneField.setCursorSize(AndroidUtilities.dp(20.0f));
this.phoneField.setCursorWidth(1.5f);
this.phoneField.setTextSize(1, 16.0f);
this.phoneField.setMaxLines(1);
this.phoneField.setGravity(19);
this.phoneField.setImeOptions(268435461);
this.phoneField.setBackground(null);
if (i3 >= 21) {
this.phoneField.setShowSoftInputOnFocus(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
}
this.phoneField.setContentDescription(LocaleController.getString(i2));
linearLayout2.addView(this.phoneField, LayoutHelper.createFrame(-1, 36.0f));
this.phoneField.addTextChangedListener(new TextWatcher(LoginActivity.this) {
private int actionPosition;
private int characterAction = -1;
@Override
public void onTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
if (i5 == 0 && i6 == 1) {
this.characterAction = 1;
return;
}
if (i5 == 1 && i6 == 0) {
if (charSequence.charAt(i4) == ' ' && i4 > 0) {
this.characterAction = 3;
this.actionPosition = i4 - 1;
return;
} else {
this.characterAction = 2;
return;
}
}
this.characterAction = -1;
}
@Override
public void afterTextChanged(Editable editable) {
int i4;
int i5;
if (PhoneView.this.ignoreOnPhoneChange) {
return;
}
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 i6 = 0;
while (i6 < obj.length()) {
int i7 = i6 + 1;
String substring = obj.substring(i6, i7);
if ("0123456789".contains(substring)) {
sb.append(substring);
}
i6 = i7;
}
PhoneView.this.ignoreOnPhoneChange = true;
String hintText = PhoneView.this.phoneField.getHintText();
if (hintText != null) {
int i8 = 0;
while (true) {
if (i8 >= sb.length()) {
break;
}
if (i8 < hintText.length()) {
if (hintText.charAt(i8) == ' ') {
sb.insert(i8, ' ');
i8++;
if (selectionStart == i8 && (i5 = this.characterAction) != 2 && i5 != 3) {
selectionStart++;
}
}
i8++;
} else {
sb.insert(i8, ' ');
if (selectionStart == i8 + 1 && (i4 = this.characterAction) != 2 && i4 != 3) {
selectionStart++;
}
}
}
}
editable.replace(0, editable.length(), sb);
if (selectionStart >= 0) {
PhoneView.this.phoneField.setSelection(Math.min(selectionStart, PhoneView.this.phoneField.length()));
}
PhoneView.this.phoneField.onTextChange();
PhoneView.this.invalidateCountryHint();
PhoneView.this.ignoreOnPhoneChange = false;
}
});
this.phoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView4, int i4, KeyEvent keyEvent) {
boolean lambda$new$6;
lambda$new$6 = LoginActivity.PhoneView.this.lambda$new$6(textView4, i4, keyEvent);
return lambda$new$6;
}
});
int i4 = 72;
int i5 = 56;
if (LoginActivity.this.newAccount && LoginActivity.this.activityMode == 0) {
CheckBoxCell checkBoxCell = new CheckBoxCell(context, 2);
this.syncContactsBox = checkBoxCell;
checkBoxCell.setText(LocaleController.getString("SyncContacts", org.telegram.messenger.R.string.SyncContacts), "", LoginActivity.this.syncContacts, false);
addView(this.syncContactsBox, LayoutHelper.createLinear(-2, -1, 51, 16, 0, 16 + ((LocaleController.isRTL && AndroidUtilities.isSmallScreen()) ? i3 >= 21 ? 56 : 60 : 0), 0));
i4 = 48;
this.syncContactsBox.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.PhoneView.this.lambda$new$7(view);
}
});
}
if (BuildVars.DEBUG_VERSION && LoginActivity.this.activityMode == 0) {
CheckBoxCell checkBoxCell2 = new CheckBoxCell(context, 2);
this.testBackendCheckBox = checkBoxCell2;
checkBoxCell2.setText(LocaleController.getString(org.telegram.messenger.R.string.DebugTestBackend), "", LoginActivity.this.testBackend, false);
View view = this.testBackendCheckBox;
if (!LocaleController.isRTL || !AndroidUtilities.isSmallScreen()) {
i5 = 0;
} else if (i3 < 21) {
i5 = 60;
}
addView(view, LayoutHelper.createLinear(-2, -1, 51, 16, 0, 16 + i5, 0));
i4 -= 24;
this.testBackendCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
LoginActivity.PhoneView.this.lambda$new$8(view2);
}
});
}
if (i4 > 0 && !AndroidUtilities.isSmallScreen()) {
Space space = new Space(context);
space.setMinimumHeight(AndroidUtilities.dp(i4));
addView(space, LayoutHelper.createLinear(-2, -2));
}
final 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(";");
CountrySelectActivity.Country country = new CountrySelectActivity.Country();
country.name = split[2];
country.code = split[0];
country.shortname = split[1];
this.countriesArray.add(0, country);
List<CountrySelectActivity.Country> list = this.codesMap.get(split[0]);
if (list == null) {
HashMap<String, List<CountrySelectActivity.Country>> hashMap2 = this.codesMap;
String str = split[0];
ArrayList arrayList = new ArrayList();
hashMap2.put(str, arrayList);
list = arrayList;
}
list.add(country);
if (split.length > 3) {
this.phoneFormatMap.put(split[0], Collections.singletonList(split[3]));
}
hashMap.put(split[1], split[2]);
}
bufferedReader.close();
} catch (Exception e) {
FileLog.e(e);
}
Collections.sort(this.countriesArray, Comparator$CC.comparing(new Function() {
@Override
public Function andThen(Function function) {
return Function.CC.$default$andThen(this, function);
}
@Override
public final Object apply(Object obj) {
String str2;
str2 = ((CountrySelectActivity.Country) obj).name;
return str2;
}
@Override
public Function compose(Function function) {
return Function.CC.$default$compose(this, function);
}
}));
try {
} catch (Exception e2) {
FileLog.e(e2);
}
LoginActivity.this.getAccountInstance().getConnectionsManager().sendRequest(new TLObject() {
@Override
public TLObject deserializeResponse(AbstractSerializedData abstractSerializedData, int i6, boolean z) {
return TLRPC$TL_nearestDc.TLdeserialize(abstractSerializedData, i6, z);
}
@Override
public void serializeToStream(AbstractSerializedData abstractSerializedData) {
abstractSerializedData.writeInt32(531836966);
}
}, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.PhoneView.this.lambda$new$11(hashMap, tLObject, tLRPC$TL_error);
}
}, 10);
if (this.codeField.length() == 0) {
setCountryButtonText(null);
this.phoneField.setHintText((String) null);
this.countryState = 1;
}
if (this.codeField.length() != 0) {
this.phoneField.requestFocus();
AnimatedPhoneNumberEditText animatedPhoneNumberEditText3 = this.phoneField;
animatedPhoneNumberEditText3.setSelection(animatedPhoneNumberEditText3.length());
} else {
this.codeField.requestFocus();
}
loadCountries();
}
public static View lambda$new$0(Context context) {
TextView textView = new TextView(context);
textView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(12.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(12.0f));
textView.setTextSize(1, 16.0f);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
textView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
return textView;
}
public void lambda$new$1(View view, boolean z) {
this.countryOutlineView.animateSelection(z ? 1.0f : 0.0f);
}
public void lambda$new$4(View view) {
CountrySelectActivity countrySelectActivity = new CountrySelectActivity(true, this.countriesArray);
countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
LoginActivity.PhoneView.this.lambda$new$3(country);
}
});
LoginActivity.this.presentFragment(countrySelectActivity);
}
public void lambda$new$3(CountrySelectActivity.Country country) {
selectCountry(country);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$new$2();
}
}, 300L);
this.phoneField.requestFocus();
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.phoneField;
animatedPhoneNumberEditText.setSelection(animatedPhoneNumberEditText.length());
}
public void lambda$new$2() {
LoginActivity.this.showKeyboard(this.phoneField);
}
public boolean lambda$new$5(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
this.phoneField.requestFocus();
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.phoneField;
animatedPhoneNumberEditText.setSelection(animatedPhoneNumberEditText.length());
return true;
}
public boolean lambda$new$6(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
if (LoginActivity.this.phoneNumberConfirmView == null) {
lambda$onNextPressed$14(null);
return true;
}
LoginActivity.this.phoneNumberConfirmView.popupFabContainer.callOnClick();
return true;
}
public void lambda$new$7(View view) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
LoginActivity.this.syncContacts = !r0.syncContacts;
((CheckBoxCell) view).setChecked(LoginActivity.this.syncContacts, true);
if (LoginActivity.this.syncContacts) {
BulletinFactory.of(LoginActivity.this.slideViewsContainer, null).createSimpleBulletin(org.telegram.messenger.R.raw.contacts_sync_on, LocaleController.getString("SyncContactsOn", org.telegram.messenger.R.string.SyncContactsOn)).show();
} else {
BulletinFactory.of(LoginActivity.this.slideViewsContainer, null).createSimpleBulletin(org.telegram.messenger.R.raw.contacts_sync_off, LocaleController.getString("SyncContactsOff", org.telegram.messenger.R.string.SyncContactsOff)).show();
}
}
public void lambda$new$8(View view) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
LoginActivity.this.testBackend = !r0.testBackend;
((CheckBoxCell) view).setChecked(LoginActivity.this.testBackend, true);
if ((BuildVars.DEBUG_VERSION && LoginActivity.this.getConnectionsManager().isTestBackend()) != LoginActivity.this.testBackend) {
LoginActivity.this.getConnectionsManager().switchBackend(false);
}
loadCountries();
}
public void lambda$new$11(final HashMap hashMap, final TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$new$10(tLObject, hashMap);
}
});
}
public void lambda$new$10(TLObject tLObject, HashMap hashMap) {
if (tLObject == null) {
return;
}
TLRPC$TL_nearestDc tLRPC$TL_nearestDc = (TLRPC$TL_nearestDc) tLObject;
if (this.codeField.length() == 0) {
setCountry(hashMap, tLRPC$TL_nearestDc.country.toUpperCase());
}
}
private void loadCountries() {
TLRPC$TL_help_getCountriesList tLRPC$TL_help_getCountriesList = new TLRPC$TL_help_getCountriesList();
tLRPC$TL_help_getCountriesList.lang_code = LocaleController.getInstance().getCurrentLocaleInfo() != null ? LocaleController.getInstance().getCurrentLocaleInfo().getLangCode() : Locale.getDefault().getCountry();
LoginActivity.this.getConnectionsManager().sendRequest(tLRPC$TL_help_getCountriesList, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.PhoneView.this.lambda$loadCountries$13(tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$loadCountries$13(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$loadCountries$12(tLRPC$TL_error, tLObject);
}
});
}
public void lambda$loadCountries$12(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject) {
boolean z;
CountrySelectActivity.Country country;
if (tLRPC$TL_error == null) {
this.countriesArray.clear();
this.codesMap.clear();
this.phoneFormatMap.clear();
TLRPC$TL_help_countriesList tLRPC$TL_help_countriesList = (TLRPC$TL_help_countriesList) tLObject;
for (int i = 0; i < tLRPC$TL_help_countriesList.countries.size(); i++) {
TLRPC$TL_help_country tLRPC$TL_help_country = tLRPC$TL_help_countriesList.countries.get(i);
for (int i2 = 0; i2 < tLRPC$TL_help_country.country_codes.size(); i2++) {
TLRPC$TL_help_countryCode tLRPC$TL_help_countryCode = tLRPC$TL_help_country.country_codes.get(i2);
if (tLRPC$TL_help_countryCode != null) {
CountrySelectActivity.Country country2 = new CountrySelectActivity.Country();
String str = tLRPC$TL_help_country.name;
country2.name = str;
String str2 = tLRPC$TL_help_country.default_name;
country2.defaultName = str2;
if (str == null && str2 != null) {
country2.name = str2;
}
country2.code = tLRPC$TL_help_countryCode.country_code;
country2.shortname = tLRPC$TL_help_country.iso2;
this.countriesArray.add(country2);
List<CountrySelectActivity.Country> list = this.codesMap.get(tLRPC$TL_help_countryCode.country_code);
if (list == null) {
HashMap<String, List<CountrySelectActivity.Country>> hashMap = this.codesMap;
String str3 = tLRPC$TL_help_countryCode.country_code;
ArrayList arrayList = new ArrayList();
hashMap.put(str3, arrayList);
list = arrayList;
}
list.add(country2);
if (tLRPC$TL_help_countryCode.patterns.size() > 0) {
this.phoneFormatMap.put(tLRPC$TL_help_countryCode.country_code, tLRPC$TL_help_countryCode.patterns);
}
}
}
}
if (LoginActivity.this.activityMode == 2) {
String stripExceptNumbers = PhoneFormat.stripExceptNumbers(UserConfig.getInstance(((BaseFragment) LoginActivity.this).currentAccount).getClientPhone());
if (TextUtils.isEmpty(stripExceptNumbers)) {
return;
}
int i3 = 4;
if (stripExceptNumbers.length() > 4) {
while (true) {
if (i3 < 1) {
z = false;
break;
}
String substring = stripExceptNumbers.substring(0, i3);
List<CountrySelectActivity.Country> list2 = this.codesMap.get(substring);
CountrySelectActivity.Country country3 = null;
if (list2 != null) {
if (list2.size() > 1) {
String string = MessagesController.getGlobalMainSettings().getString("phone_code_last_matched_" + substring, null);
if (string != null) {
country = list2.get(list2.size() - 1);
Iterator<CountrySelectActivity.Country> it = this.countriesArray.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
CountrySelectActivity.Country next = it.next();
if (Objects.equals(next.shortname, string)) {
country = next;
break;
}
}
} else {
country = list2.get(list2.size() - 1);
}
country3 = country;
} else {
country3 = list2.get(0);
}
}
if (country3 != null) {
this.codeField.setText(substring);
z = true;
break;
}
i3--;
}
if (z) {
return;
}
this.codeField.setText(stripExceptNumbers.substring(0, 1));
}
}
}
}
@Override
public void updateColors() {
this.titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.subtitleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
for (int i = 0; i < this.countryButton.getChildCount(); i++) {
TextView textView = (TextView) this.countryButton.getChildAt(i);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
textView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
}
ImageView imageView = this.chevronRight;
int i2 = Theme.key_windowBackgroundWhiteHintText;
imageView.setColorFilter(Theme.getColor(i2));
this.chevronRight.setBackground(Theme.createSelectorDrawable(LoginActivity.this.getThemedColor(Theme.key_listSelector), 1));
TextView textView2 = this.plusTextView;
int i3 = Theme.key_windowBackgroundWhiteBlackText;
textView2.setTextColor(Theme.getColor(i3));
this.codeField.setTextColor(Theme.getColor(i3));
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.codeField;
int i4 = Theme.key_windowBackgroundWhiteInputFieldActivated;
animatedPhoneNumberEditText.setCursorColor(Theme.getColor(i4));
this.codeDividerView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputField));
this.phoneField.setTextColor(Theme.getColor(i3));
this.phoneField.setHintTextColor(Theme.getColor(i2));
this.phoneField.setCursorColor(Theme.getColor(i4));
CheckBoxCell checkBoxCell = this.syncContactsBox;
if (checkBoxCell != null) {
checkBoxCell.setSquareCheckBoxColor(Theme.key_checkboxSquareUnchecked, Theme.key_checkboxSquareBackground, Theme.key_checkboxSquareCheck);
this.syncContactsBox.updateTextColor();
}
CheckBoxCell checkBoxCell2 = this.testBackendCheckBox;
if (checkBoxCell2 != null) {
checkBoxCell2.setSquareCheckBoxColor(Theme.key_checkboxSquareUnchecked, Theme.key_checkboxSquareBackground, Theme.key_checkboxSquareCheck);
this.testBackendCheckBox.updateTextColor();
}
this.phoneOutlineView.updateColor();
this.countryOutlineView.updateColor();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
}
public void selectCountry(CountrySelectActivity.Country country) {
this.ignoreOnTextChange = true;
String str = country.code;
this.codeField.setText(str);
setCountryHint(str, country);
this.currentCountry = country;
this.countryState = 0;
this.ignoreOnTextChange = false;
MessagesController.getGlobalMainSettings().edit().putString("phone_code_last_matched_" + country.code, country.shortname).apply();
}
public void setCountryHint(String str, CountrySelectActivity.Country country) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
String languageFlag = LocaleController.getLanguageFlag(country.shortname);
if (languageFlag != null) {
spannableStringBuilder.append((CharSequence) languageFlag).append((CharSequence) " ");
spannableStringBuilder.setSpan(new ReplacementSpan(this) {
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i, int i2, float f, int i3, int i4, int i5, Paint paint) {
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i, int i2, Paint.FontMetricsInt fontMetricsInt) {
return AndroidUtilities.dp(16.0f);
}
}, languageFlag.length(), languageFlag.length() + 1, 0);
}
spannableStringBuilder.append((CharSequence) country.name);
setCountryButtonText(Emoji.replaceEmoji((CharSequence) spannableStringBuilder, this.countryButton.getCurrentView().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20.0f), false));
this.countryCodeForHint = str;
this.wasCountryHintIndex = -1;
invalidateCountryHint();
}
public void invalidateCountryHint() {
int i;
String str = this.countryCodeForHint;
String replace = this.phoneField.getText() != null ? this.phoneField.getText().toString().replace(" ", "") : "";
if (this.phoneFormatMap.get(str) != null && !this.phoneFormatMap.get(str).isEmpty()) {
List<String> list = this.phoneFormatMap.get(str);
if (!replace.isEmpty()) {
i = 0;
while (i < list.size()) {
if (replace.startsWith(list.get(i).replace(" ", "").replace("X", "").replace("0", ""))) {
break;
} else {
i++;
}
}
}
i = -1;
if (i == -1) {
for (int i2 = 0; i2 < list.size(); i2++) {
String str2 = list.get(i2);
if (str2.startsWith("X") || str2.startsWith("0")) {
i = i2;
break;
}
}
if (i == -1) {
i = 0;
}
}
if (this.wasCountryHintIndex != i) {
String str3 = this.phoneFormatMap.get(str).get(i);
int selectionStart = this.phoneField.getSelectionStart();
int selectionEnd = this.phoneField.getSelectionEnd();
this.phoneField.setHintText(str3 != null ? str3.replace('X', '0') : null);
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.phoneField;
animatedPhoneNumberEditText.setSelection(Math.max(0, Math.min(animatedPhoneNumberEditText.length(), selectionStart)), Math.max(0, Math.min(this.phoneField.length(), selectionEnd)));
this.wasCountryHintIndex = i;
return;
}
return;
}
if (this.wasCountryHintIndex != -1) {
int selectionStart2 = this.phoneField.getSelectionStart();
int selectionEnd2 = this.phoneField.getSelectionEnd();
this.phoneField.setHintText((String) null);
this.phoneField.setSelection(selectionStart2, selectionEnd2);
this.wasCountryHintIndex = -1;
}
}
public void setCountryButtonText(CharSequence charSequence) {
Animation loadAnimation = AnimationUtils.loadAnimation(ApplicationLoader.applicationContext, (this.countryButton.getCurrentView().getText() == null || charSequence != null) ? org.telegram.messenger.R.anim.text_out : org.telegram.messenger.R.anim.text_out_down);
loadAnimation.setInterpolator(Easings.easeInOutQuad);
this.countryButton.setOutAnimation(loadAnimation);
CharSequence text = this.countryButton.getCurrentView().getText();
this.countryButton.setText(charSequence, ((TextUtils.isEmpty(charSequence) && TextUtils.isEmpty(text)) || Objects.equals(text, charSequence)) ? false : true);
this.countryOutlineView.animateSelection(charSequence != null ? 1.0f : 0.0f);
}
private void setCountry(HashMap<String, String> hashMap, String str) {
if (hashMap.get(str) == null || this.countriesArray == null) {
return;
}
CountrySelectActivity.Country country = null;
int i = 0;
while (true) {
if (i < this.countriesArray.size()) {
if (this.countriesArray.get(i) != null && this.countriesArray.get(i).name.equals(str)) {
country = this.countriesArray.get(i);
break;
}
i++;
} else {
break;
}
}
if (country != null) {
this.codeField.setText(country.code);
this.countryState = 0;
}
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
if (this.ignoreSelection) {
this.ignoreSelection = false;
return;
}
this.ignoreOnTextChange = true;
this.codeField.setText(this.countriesArray.get(i).code);
this.ignoreOnTextChange = false;
}
@Override
public void lambda$onNextPressed$14(final String str) {
String str2;
int i;
boolean z;
boolean z2;
boolean z3;
TLRPC$TL_auth_sendCode tLRPC$TL_auth_sendCode;
final Bundle bundle;
String str3;
boolean z4;
String line1Number;
boolean z5;
int i2;
if (LoginActivity.this.getParentActivity() == null || this.nextPressed || LoginActivity.this.isRequestingFirebaseSms) {
return;
}
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
if (BuildVars.DEBUG_VERSION) {
FileLog.d("sim status = " + telephonyManager.getSimState());
}
if (this.codeField.length() == 0 || this.phoneField.length() == 0) {
LoginActivity.this.onFieldError(this.phoneOutlineView, false);
return;
}
String str4 = "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText());
if (!this.confirmedNumber) {
Point point = AndroidUtilities.displaySize;
if (point.x > point.y && !LoginActivity.this.isCustomKeyboardVisible() && LoginActivity.this.sizeNotifierFrameLayout.measureKeyboardHeight() > AndroidUtilities.dp(20.0f)) {
LoginActivity.this.keyboardHideCallback = new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$onNextPressed$15(str);
}
};
AndroidUtilities.hideKeyboard(LoginActivity.this.fragmentView);
return;
}
LoginActivity loginActivity = LoginActivity.this;
Context context = LoginActivity.this.fragmentView.getContext();
LoginActivity loginActivity2 = LoginActivity.this;
loginActivity.phoneNumberConfirmView = new PhoneNumberConfirmView(context, (ViewGroup) loginActivity2.fragmentView, loginActivity2.floatingButtonContainer, str4, new AnonymousClass6(str));
LoginActivity.this.phoneNumberConfirmView.show();
return;
}
this.confirmedNumber = false;
if (LoginActivity.this.phoneNumberConfirmView != null) {
LoginActivity.this.phoneNumberConfirmView.dismiss();
}
boolean isSimAvailable = AndroidUtilities.isSimAvailable();
int i3 = Build.VERSION.SDK_INT;
if (i3 < 23 || !isSimAvailable) {
str2 = "ephone";
i = 1;
z = true;
z2 = true;
z3 = true;
} else {
z = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
z2 = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.CALL_PHONE") == 0;
z3 = i3 < 28 || LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_CALL_LOG") == 0;
if (i3 >= 26) {
z5 = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_NUMBERS") == 0;
str2 = "ephone";
} else {
str2 = "ephone";
z5 = true;
}
if (LoginActivity.this.checkPermissions) {
LoginActivity.this.permissionsItems.clear();
if (!z) {
LoginActivity.this.permissionsItems.add("android.permission.READ_PHONE_STATE");
}
if (!z2) {
LoginActivity.this.permissionsItems.add("android.permission.CALL_PHONE");
}
if (!z3) {
LoginActivity.this.permissionsItems.add("android.permission.READ_CALL_LOG");
}
if (!z5 && i3 >= 26) {
LoginActivity.this.permissionsItems.add("android.permission.READ_PHONE_NUMBERS");
}
if (!LoginActivity.this.permissionsItems.isEmpty()) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (!globalMainSettings.getBoolean("firstlogin", true) && !LoginActivity.this.getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE") && !LoginActivity.this.getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_CALL_LOG")) {
try {
LoginActivity.this.getParentActivity().requestPermissions((String[]) LoginActivity.this.permissionsItems.toArray(new String[0]), 6);
return;
} catch (Exception e) {
FileLog.e(e);
return;
}
}
globalMainSettings.edit().putBoolean("firstlogin", false).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setPositiveButton(LocaleController.getString("Continue", org.telegram.messenger.R.string.Continue), null);
if (!z && (!z2 || !z3)) {
builder.setMessage(LocaleController.getString("AllowReadCallAndLog", org.telegram.messenger.R.string.AllowReadCallAndLog));
i2 = org.telegram.messenger.R.raw.calls_log;
} else if (!z2 || !z3) {
builder.setMessage(LocaleController.getString("AllowReadCallLog", org.telegram.messenger.R.string.AllowReadCallLog));
i2 = org.telegram.messenger.R.raw.calls_log;
} else {
builder.setMessage(LocaleController.getString("AllowReadCall", org.telegram.messenger.R.string.AllowReadCall));
i2 = org.telegram.messenger.R.raw.incoming_calls;
}
builder.setTopAnimation(i2, 46, false, Theme.getColor(Theme.key_dialogTopBackground));
LoginActivity loginActivity3 = LoginActivity.this;
loginActivity3.permissionsDialog = loginActivity3.showDialog(builder.create());
this.confirmedNumber = true;
return;
}
}
i = 1;
}
int i4 = this.countryState;
if (i4 == i) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ChooseCountry", org.telegram.messenger.R.string.ChooseCountry));
LoginActivity.this.needHideProgress(false);
return;
}
if (i4 == 2 && !BuildVars.DEBUG_VERSION) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("WrongCountry", org.telegram.messenger.R.string.WrongCountry));
LoginActivity.this.needHideProgress(false);
return;
}
final String stripExceptNumbers = PhoneFormat.stripExceptNumbers("" + ((Object) this.codeField.getText()) + ((Object) this.phoneField.getText()));
if (LoginActivity.this.activityMode == 0 && (LoginActivity.this.getParentActivity() instanceof LaunchActivity)) {
for (final int i5 = 0; i5 < 4; i5++) {
UserConfig userConfig = UserConfig.getInstance(i5);
if (userConfig.isClientActivated() && PhoneNumberUtils.compare(stripExceptNumbers, userConfig.getCurrentUser().phone) && ConnectionsManager.getInstance(i5).isTestBackend() == LoginActivity.this.testBackend) {
AlertDialog.Builder builder2 = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder2.setTitle(LocaleController.getString(org.telegram.messenger.R.string.AppName));
builder2.setMessage(LocaleController.getString("AccountAlreadyLoggedIn", org.telegram.messenger.R.string.AccountAlreadyLoggedIn));
builder2.setPositiveButton(LocaleController.getString("AccountSwitch", org.telegram.messenger.R.string.AccountSwitch), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i6) {
LoginActivity.PhoneView.this.lambda$onNextPressed$16(i5, dialogInterface, i6);
}
});
builder2.setNegativeButton(LocaleController.getString("OK", org.telegram.messenger.R.string.OK), null);
LoginActivity.this.showDialog(builder2.create());
LoginActivity.this.needHideProgress(false);
return;
}
}
}
TLRPC$TL_codeSettings tLRPC$TL_codeSettings = new TLRPC$TL_codeSettings();
tLRPC$TL_codeSettings.allow_flashcall = isSimAvailable && z && z2 && z3;
tLRPC$TL_codeSettings.allow_missed_call = isSimAvailable && z;
boolean hasServices = PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices();
tLRPC$TL_codeSettings.allow_firebase = hasServices;
tLRPC$TL_codeSettings.allow_app_hash = hasServices;
if (LoginActivity.this.forceDisableSafetyNet || TextUtils.isEmpty(BuildVars.SAFETYNET_KEY)) {
tLRPC$TL_codeSettings.allow_firebase = false;
}
ArrayList<TLRPC$TL_auth_authorization> savedLogInTokens = AuthTokensHelper.getSavedLogInTokens();
if (savedLogInTokens != null) {
for (int i6 = 0; i6 < savedLogInTokens.size(); i6++) {
if (savedLogInTokens.get(i6).future_auth_token != null) {
if (tLRPC$TL_codeSettings.logout_tokens == null) {
tLRPC$TL_codeSettings.logout_tokens = new ArrayList<>();
}
if (BuildVars.DEBUG_VERSION) {
FileLog.d("login token to check " + new String(savedLogInTokens.get(i6).future_auth_token, StandardCharsets.UTF_8));
}
tLRPC$TL_codeSettings.logout_tokens.add(savedLogInTokens.get(i6).future_auth_token);
if (tLRPC$TL_codeSettings.logout_tokens.size() >= 20) {
break;
}
}
}
}
ArrayList<TLRPC$TL_auth_loggedOut> savedLogOutTokens = AuthTokensHelper.getSavedLogOutTokens();
if (savedLogOutTokens != null) {
for (int i7 = 0; i7 < savedLogOutTokens.size(); i7++) {
if (tLRPC$TL_codeSettings.logout_tokens == null) {
tLRPC$TL_codeSettings.logout_tokens = new ArrayList<>();
}
tLRPC$TL_codeSettings.logout_tokens.add(savedLogOutTokens.get(i7).future_auth_token);
if (tLRPC$TL_codeSettings.logout_tokens.size() >= 20) {
break;
}
}
AuthTokensHelper.saveLogOutTokens(savedLogOutTokens);
}
if (tLRPC$TL_codeSettings.logout_tokens != null) {
tLRPC$TL_codeSettings.flags |= 64;
}
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
sharedPreferences.edit().remove("sms_hash_code").apply();
if (tLRPC$TL_codeSettings.allow_app_hash) {
sharedPreferences.edit().putString("sms_hash", BuildVars.getSmsHash()).apply();
} else {
sharedPreferences.edit().remove("sms_hash").apply();
}
if (tLRPC$TL_codeSettings.allow_flashcall) {
try {
line1Number = telephonyManager.getLine1Number();
z4 = TextUtils.isEmpty(line1Number);
} catch (Exception e2) {
e = e2;
z4 = false;
}
try {
if (!z4) {
boolean compare = PhoneNumberUtils.compare(stripExceptNumbers, line1Number);
tLRPC$TL_codeSettings.current_number = compare;
if (!compare) {
z4 = false;
tLRPC$TL_codeSettings.allow_flashcall = false;
}
} else if (UserConfig.getActivatedAccountsCount() > 0) {
z4 = false;
tLRPC$TL_codeSettings.allow_flashcall = false;
} else {
z4 = false;
tLRPC$TL_codeSettings.current_number = false;
}
} catch (Exception e3) {
e = e3;
tLRPC$TL_codeSettings.allow_flashcall = z4;
FileLog.e(e);
if (LoginActivity.this.activityMode == 2) {
}
final TLRPC$TL_auth_sendCode tLRPC$TL_auth_sendCode2 = tLRPC$TL_auth_sendCode;
bundle = new Bundle();
bundle.putString("phone", "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText()));
str3 = str2;
bundle.putString(str3, "+" + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString()));
bundle.putString("phoneFormated", stripExceptNumbers);
this.nextPressed = true;
final PhoneInputData phoneInputData = new PhoneInputData();
phoneInputData.phoneNumber = "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText());
phoneInputData.country = this.currentCountry;
phoneInputData.patterns = this.phoneFormatMap.get(this.codeField.getText().toString());
LoginActivity.this.needShowProgress(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_sendCode2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.PhoneView.this.lambda$onNextPressed$20(bundle, stripExceptNumbers, phoneInputData, tLRPC$TL_auth_sendCode2, tLObject, tLRPC$TL_error);
}
}, 27));
}
}
if (LoginActivity.this.activityMode == 2) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).cleanup(false);
TLRPC$TL_auth_sendCode tLRPC$TL_auth_sendCode3 = new TLRPC$TL_auth_sendCode();
tLRPC$TL_auth_sendCode3.api_hash = BuildVars.APP_HASH;
tLRPC$TL_auth_sendCode3.api_id = BuildVars.APP_ID;
tLRPC$TL_auth_sendCode3.phone_number = stripExceptNumbers;
tLRPC$TL_auth_sendCode3.settings = tLRPC$TL_codeSettings;
tLRPC$TL_auth_sendCode = tLRPC$TL_auth_sendCode3;
} else {
TLRPC$TL_account_sendChangePhoneCode tLRPC$TL_account_sendChangePhoneCode = new TLRPC$TL_account_sendChangePhoneCode();
tLRPC$TL_account_sendChangePhoneCode.phone_number = stripExceptNumbers;
tLRPC$TL_account_sendChangePhoneCode.settings = tLRPC$TL_codeSettings;
tLRPC$TL_auth_sendCode = tLRPC$TL_account_sendChangePhoneCode;
}
final TLObject tLRPC$TL_auth_sendCode22 = tLRPC$TL_auth_sendCode;
bundle = new Bundle();
bundle.putString("phone", "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText()));
try {
str3 = str2;
} catch (Exception e4) {
e = e4;
str3 = str2;
}
try {
bundle.putString(str3, "+" + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString()));
} catch (Exception e5) {
e = e5;
FileLog.e(e);
bundle.putString(str3, "+" + stripExceptNumbers);
bundle.putString("phoneFormated", stripExceptNumbers);
this.nextPressed = true;
final PhoneInputData phoneInputData2 = new PhoneInputData();
phoneInputData2.phoneNumber = "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText());
phoneInputData2.country = this.currentCountry;
phoneInputData2.patterns = this.phoneFormatMap.get(this.codeField.getText().toString());
LoginActivity.this.needShowProgress(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_sendCode22, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.PhoneView.this.lambda$onNextPressed$20(bundle, stripExceptNumbers, phoneInputData2, tLRPC$TL_auth_sendCode22, tLObject, tLRPC$TL_error);
}
}, 27));
}
bundle.putString("phoneFormated", stripExceptNumbers);
this.nextPressed = true;
final PhoneInputData phoneInputData22 = new PhoneInputData();
phoneInputData22.phoneNumber = "+" + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText());
phoneInputData22.country = this.currentCountry;
phoneInputData22.patterns = this.phoneFormatMap.get(this.codeField.getText().toString());
LoginActivity.this.needShowProgress(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_sendCode22, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.PhoneView.this.lambda$onNextPressed$20(bundle, stripExceptNumbers, phoneInputData22, tLRPC$TL_auth_sendCode22, tLObject, tLRPC$TL_error);
}
}, 27));
}
public void lambda$onNextPressed$15(final String str) {
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$onNextPressed$14(str);
}
}, 200L);
}
public class AnonymousClass6 implements PhoneNumberConfirmView.IConfirmDialogCallback {
final String val$code;
AnonymousClass6(String str) {
this.val$code = str;
}
@Override
public void onFabPressed(PhoneNumberConfirmView phoneNumberConfirmView, TransformableLoginButtonView transformableLoginButtonView) {
onConfirm(phoneNumberConfirmView);
}
@Override
public void onEditPressed(PhoneNumberConfirmView phoneNumberConfirmView, TextView textView) {
phoneNumberConfirmView.dismiss();
}
@Override
public void onConfirmPressed(PhoneNumberConfirmView phoneNumberConfirmView, TextView textView) {
onConfirm(phoneNumberConfirmView);
}
@Override
public void onDismiss(PhoneNumberConfirmView phoneNumberConfirmView) {
LoginActivity.this.phoneNumberConfirmView = null;
}
private void onConfirm(final PhoneNumberConfirmView phoneNumberConfirmView) {
int i;
PhoneView.this.confirmedNumber = true;
LoginActivity.this.currentDoneType = 0;
LoginActivity.this.needShowProgress(0, false);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 23 && AndroidUtilities.isSimAvailable()) {
boolean z = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
boolean z2 = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.CALL_PHONE") == 0;
boolean z3 = i2 < 28 || LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_CALL_LOG") == 0;
boolean z4 = i2 < 26 || LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_NUMBERS") == 0;
if (PhoneView.this.codeField != null && "888".equals(PhoneView.this.codeField.getText())) {
z = true;
z2 = true;
z3 = true;
z4 = true;
}
if (LoginActivity.this.checkPermissions) {
LoginActivity.this.permissionsItems.clear();
if (!z) {
LoginActivity.this.permissionsItems.add("android.permission.READ_PHONE_STATE");
}
if (!z2) {
LoginActivity.this.permissionsItems.add("android.permission.CALL_PHONE");
}
if (!z3) {
LoginActivity.this.permissionsItems.add("android.permission.READ_CALL_LOG");
}
if (!z4 && i2 >= 26) {
LoginActivity.this.permissionsItems.add("android.permission.READ_PHONE_NUMBERS");
}
if (!LoginActivity.this.permissionsItems.isEmpty()) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (!globalMainSettings.getBoolean("firstlogin", true) && !LoginActivity.this.getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE") && !LoginActivity.this.getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_CALL_LOG")) {
try {
LoginActivity.this.getParentActivity().requestPermissions((String[]) LoginActivity.this.permissionsItems.toArray(new String[0]), 6);
return;
} catch (Exception e) {
FileLog.e(e);
return;
}
}
globalMainSettings.edit().putBoolean("firstlogin", false).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setPositiveButton(LocaleController.getString("Continue", org.telegram.messenger.R.string.Continue), null);
if (!z && (!z2 || !z3)) {
builder.setMessage(LocaleController.getString("AllowReadCallAndLog", org.telegram.messenger.R.string.AllowReadCallAndLog));
i = org.telegram.messenger.R.raw.calls_log;
} else if (!z2 || !z3) {
builder.setMessage(LocaleController.getString("AllowReadCallLog", org.telegram.messenger.R.string.AllowReadCallLog));
i = org.telegram.messenger.R.raw.calls_log;
} else {
builder.setMessage(LocaleController.getString("AllowReadCall", org.telegram.messenger.R.string.AllowReadCall));
i = org.telegram.messenger.R.raw.incoming_calls;
}
builder.setTopAnimation(i, 46, false, Theme.getColor(Theme.key_dialogTopBackground));
LoginActivity loginActivity = LoginActivity.this;
loginActivity.permissionsDialog = loginActivity.showDialog(builder.create());
PhoneView.this.confirmedNumber = true;
return;
}
}
}
final String str = this.val$code;
phoneNumberConfirmView.animateProgress(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.AnonymousClass6.this.lambda$onConfirm$1(phoneNumberConfirmView, str);
}
});
}
public void lambda$onConfirm$1(final PhoneNumberConfirmView phoneNumberConfirmView, final String str) {
phoneNumberConfirmView.dismiss();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.AnonymousClass6.this.lambda$onConfirm$0(str, phoneNumberConfirmView);
}
}, 150L);
}
public void lambda$onConfirm$0(String str, PhoneNumberConfirmView phoneNumberConfirmView) {
PhoneView.this.lambda$onNextPressed$14(str);
LoginActivity.this.floatingProgressView.sync(phoneNumberConfirmView.floatingProgressView);
}
}
public void lambda$onNextPressed$16(int i, DialogInterface dialogInterface, int i2) {
if (UserConfig.selectedAccount != i) {
((LaunchActivity) LoginActivity.this.getParentActivity()).switchToAccount(i, false);
}
LoginActivity.this.finishFragment();
}
public void lambda$onNextPressed$20(final Bundle bundle, final String str, final PhoneInputData phoneInputData, final TLObject tLObject, final TLObject tLObject2, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$onNextPressed$19(tLRPC$TL_error, tLObject2, bundle, str, phoneInputData, tLObject);
}
});
}
public void lambda$onNextPressed$19(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, Bundle bundle, final String str, PhoneInputData phoneInputData, TLObject tLObject2) {
this.nextPressed = false;
if (tLRPC$TL_error == null) {
if (!(tLObject instanceof TLRPC$TL_auth_sentCodeSuccess)) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, (TLRPC$auth_SentCode) tLObject);
} else {
TLRPC$auth_Authorization tLRPC$auth_Authorization = ((TLRPC$TL_auth_sentCodeSuccess) tLObject).authorization;
if (!(tLRPC$auth_Authorization instanceof TLRPC$TL_auth_authorizationSignUpRequired)) {
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLRPC$auth_Authorization);
} else {
TLRPC$TL_help_termsOfService tLRPC$TL_help_termsOfService = ((TLRPC$TL_auth_authorizationSignUpRequired) tLObject).terms_of_service;
if (tLRPC$TL_help_termsOfService != null) {
LoginActivity.this.currentTermsOfService = tLRPC$TL_help_termsOfService;
}
LoginActivity.this.setPage(5, true, bundle, false);
}
}
} else {
String str2 = tLRPC$TL_error.text;
if (str2 != null) {
if (str2.contains("SESSION_PASSWORD_NEEDED")) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_account_getPassword(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject3, TLRPC$TL_error tLRPC$TL_error2) {
LoginActivity.PhoneView.this.lambda$onNextPressed$18(str, tLObject3, tLRPC$TL_error2);
}
}, 10);
} else if (tLRPC$TL_error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.needShowInvalidAlert(LoginActivity.this, str, phoneInputData, false);
} else if (tLRPC$TL_error.text.contains("PHONE_PASSWORD_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else if (tLRPC$TL_error.text.contains("PHONE_NUMBER_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("PhoneNumberFlood", org.telegram.messenger.R.string.PhoneNumberFlood));
} else if (tLRPC$TL_error.text.contains("PHONE_NUMBER_BANNED")) {
LoginActivity.needShowInvalidAlert(LoginActivity.this, str, phoneInputData, true);
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", org.telegram.messenger.R.string.InvalidCode));
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else if (tLRPC$TL_error.code != -1000) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLObject2, phoneInputData.phoneNumber);
}
}
}
if (LoginActivity.this.isRequestingFirebaseSms) {
return;
}
LoginActivity.this.needHideProgress(false);
}
public void lambda$onNextPressed$18(final String str, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$onNextPressed$17(tLRPC$TL_error, tLObject, str);
}
});
}
public void lambda$onNextPressed$17(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, String str) {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
if (tLRPC$TL_error != null) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
TLRPC$account_Password tLRPC$account_Password = (TLRPC$account_Password) tLObject;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(tLRPC$account_Password, true)) {
AlertsCreator.showUpdateAppAlert(LoginActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", org.telegram.messenger.R.string.UpdateAppAlert), true);
return;
}
Bundle bundle = new Bundle();
SerializedData serializedData = new SerializedData(tLRPC$account_Password.getObjectSize());
tLRPC$account_Password.serializeToStream(serializedData);
bundle.putString("password", Utilities.bytesToHex(serializedData.toByteArray()));
bundle.putString("phoneFormated", str);
LoginActivity.this.setPage(6, true, bundle, false);
}
public void fillNumber() {
boolean z;
boolean z2;
boolean z3;
CountrySelectActivity.Country country;
if (this.numberFilled || LoginActivity.this.activityMode != 0) {
return;
}
try {
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
if (AndroidUtilities.isSimAvailable()) {
int i = Build.VERSION.SDK_INT;
if (i >= 23) {
z = LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
if (i >= 26 && LoginActivity.this.getParentActivity().checkSelfPermission("android.permission.READ_PHONE_NUMBERS") != 0) {
z2 = false;
if (LoginActivity.this.checkShowPermissions && (!z || !z2)) {
LoginActivity.this.permissionsShowItems.clear();
if (!z) {
LoginActivity.this.permissionsShowItems.add("android.permission.READ_PHONE_STATE");
}
if (!z2 && i >= 26) {
LoginActivity.this.permissionsShowItems.add("android.permission.READ_PHONE_NUMBERS");
}
if (LoginActivity.this.permissionsShowItems.isEmpty()) {
final ArrayList arrayList = new ArrayList(LoginActivity.this.permissionsShowItems);
Runnable runnable = new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$fillNumber$21(arrayList);
}
};
if (LoginActivity.this.isAnimatingIntro) {
LoginActivity.this.animationFinishCallback = runnable;
return;
} else {
runnable.run();
return;
}
}
return;
}
}
z2 = true;
if (LoginActivity.this.checkShowPermissions) {
LoginActivity.this.permissionsShowItems.clear();
if (!z) {
}
if (!z2) {
LoginActivity.this.permissionsShowItems.add("android.permission.READ_PHONE_NUMBERS");
}
if (LoginActivity.this.permissionsShowItems.isEmpty()) {
}
}
} else {
z = true;
z2 = true;
}
this.numberFilled = true;
if (!LoginActivity.this.newAccount && z && z2) {
this.codeField.setAlpha(0.0f);
this.phoneField.setAlpha(0.0f);
String stripExceptNumbers = PhoneFormat.stripExceptNumbers(telephonyManager.getLine1Number());
if (!TextUtils.isEmpty(stripExceptNumbers)) {
int i2 = 4;
String str = null;
if (stripExceptNumbers.length() > 4) {
while (true) {
if (i2 < 1) {
z3 = false;
break;
}
String substring = stripExceptNumbers.substring(0, i2);
List<CountrySelectActivity.Country> list = this.codesMap.get(substring);
if (list == null) {
country = null;
} else if (list.size() > 1) {
String string = MessagesController.getGlobalMainSettings().getString("phone_code_last_matched_" + substring, null);
country = list.get(list.size() - 1);
if (string != null) {
Iterator<CountrySelectActivity.Country> it = this.countriesArray.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
CountrySelectActivity.Country next = it.next();
if (Objects.equals(next.shortname, string)) {
country = next;
break;
}
}
}
} else {
country = list.get(0);
}
if (country != null) {
String substring2 = stripExceptNumbers.substring(i2);
this.codeField.setText(substring);
str = substring2;
z3 = true;
break;
}
i2--;
}
if (!z3) {
str = stripExceptNumbers.substring(1);
this.codeField.setText(stripExceptNumbers.substring(0, 1));
}
}
if (str != null) {
this.phoneField.requestFocus();
this.phoneField.setText(str);
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.phoneField;
animatedPhoneNumberEditText.setSelection(animatedPhoneNumberEditText.length());
}
}
if (this.phoneField.length() > 0) {
AnimatorSet duration = new AnimatorSet().setDuration(300L);
duration.playTogether(ObjectAnimator.ofFloat(this.codeField, (Property<AnimatedPhoneNumberEditText, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.phoneField, (Property<AnimatedPhoneNumberEditText, Float>) View.ALPHA, 1.0f));
duration.start();
this.confirmedNumber = true;
return;
}
this.codeField.setAlpha(1.0f);
this.phoneField.setAlpha(1.0f);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$fillNumber$21(List list) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (globalMainSettings.getBoolean("firstloginshow", true) || LoginActivity.this.getParentActivity().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE")) {
globalMainSettings.edit().putBoolean("firstloginshow", false).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTopAnimation(org.telegram.messenger.R.raw.incoming_calls, 46, false, Theme.getColor(Theme.key_dialogTopBackground));
builder.setPositiveButton(LocaleController.getString("Continue", org.telegram.messenger.R.string.Continue), null);
builder.setMessage(LocaleController.getString("AllowFillNumber", org.telegram.messenger.R.string.AllowFillNumber));
LoginActivity loginActivity = LoginActivity.this;
loginActivity.permissionsShowDialog = loginActivity.showDialog(builder.create(), true, null);
LoginActivity.this.needRequestPermissions = true;
return;
}
LoginActivity.this.getParentActivity().requestPermissions((String[]) list.toArray(new String[0]), 7);
}
@Override
public void onShow() {
super.onShow();
fillNumber();
CheckBoxCell checkBoxCell = this.syncContactsBox;
if (checkBoxCell != null) {
checkBoxCell.setChecked(LoginActivity.this.syncContacts, false);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.lambda$onShow$22();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$22() {
if (this.phoneField != null) {
if (LoginActivity.this.needRequestPermissions) {
this.codeField.clearFocus();
this.phoneField.clearFocus();
} else {
if (this.codeField.length() != 0) {
this.phoneField.requestFocus();
if (!this.numberFilled) {
AnimatedPhoneNumberEditText animatedPhoneNumberEditText = this.phoneField;
animatedPhoneNumberEditText.setSelection(animatedPhoneNumberEditText.length());
}
LoginActivity.this.showKeyboard(this.phoneField);
return;
}
this.codeField.requestFocus();
LoginActivity.this.showKeyboard(this.codeField);
}
}
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourPhone", org.telegram.messenger.R.string.YourPhone);
}
@Override
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
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);
}
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (i == NotificationCenter.emojiLoaded) {
this.countryButton.getCurrentView().invalidate();
}
}
}
public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
private RLottieImageView blueImageView;
private FrameLayout bottomContainer;
private String catchedPhone;
private CodeFieldContainer codeFieldContainer;
private int codeTime;
private Timer codeTimer;
private TextView confirmTextView;
private Bundle currentParams;
private int currentType;
private RLottieDrawable dotsDrawable;
private RLottieDrawable dotsToStarsDrawable;
private String emailPhone;
private Runnable errorColorTimeout;
private ViewSwitcher errorViewSwitcher;
RLottieDrawable hintDrawable;
private boolean isDotsAnimationVisible;
private boolean isResendingCode;
private double lastCodeTime;
private double lastCurrentTime;
private String lastError;
private int length;
private ImageView missedCallArrowIcon;
private TextView missedCallDescriptionSubtitle;
private TextView missedCallDescriptionSubtitle2;
private ImageView missedCallPhoneIcon;
private boolean nextPressed;
private int nextType;
private LinearLayout openFragmentButton;
private TextView openFragmentButtonText;
private RLottieImageView openFragmentImageView;
private int openTime;
private String pattern;
private String phone;
private String phoneHash;
private boolean postedErrorColorTimeout;
private String prefix;
private TextView prefixTextView;
private FrameLayout problemFrame;
private LoadingTextView problemText;
private ProgressView progressView;
private String requestPhone;
private RLottieDrawable starsToDotsDrawable;
private int time;
private LoadingTextView timeText;
private Timer timeTimer;
private final Object timerSync;
private TextView titleTextView;
private String url;
private boolean waitingForEvent;
private TextView wrongCode;
public static void lambda$onBackPressed$42(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
}
@Override
public boolean needBackButton() {
return true;
}
static int access$8326(LoginActivitySmsView loginActivitySmsView, double d) {
int i = (int) (loginActivitySmsView.time - d);
loginActivitySmsView.time = i;
return i;
}
static int access$9426(LoginActivitySmsView loginActivitySmsView, double d) {
int i = (int) (loginActivitySmsView.codeTime - d);
loginActivitySmsView.codeTime = i;
return i;
}
public void lambda$new$0() {
int i = 0;
this.postedErrorColorTimeout = false;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
if (this.errorViewSwitcher.getCurrentView() != (this.currentType == 15 ? this.openFragmentButton : this.problemFrame)) {
this.errorViewSwitcher.showNext();
}
}
public LoginActivitySmsView(final Context context, int i) {
super(context);
FrameLayout frameLayout;
this.timerSync = new Object();
this.time = 60000;
this.codeTime = 15000;
this.lastError = "";
this.isResendingCode = false;
this.pattern = "*";
this.prefix = "";
this.errorColorTimeout = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$new$0();
}
};
this.currentType = i;
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
textView.setTextSize(1, 14.0f);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
TextView textView2 = new TextView(context);
this.titleTextView = textView2;
textView2.setTextSize(1, 18.0f);
this.titleTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.titleTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.titleTextView.setGravity(49);
String string = LoginActivity.this.activityMode != 1 ? null : LocaleController.getString(org.telegram.messenger.R.string.CancelAccountReset);
int i2 = this.currentType;
if (i2 == 11) {
this.titleTextView.setText(string == null ? LocaleController.getString("MissedCallDescriptionTitle", org.telegram.messenger.R.string.MissedCallDescriptionTitle) : string);
FrameLayout frameLayout2 = new FrameLayout(context);
this.missedCallArrowIcon = new ImageView(context);
this.missedCallPhoneIcon = new ImageView(context);
frameLayout2.addView(this.missedCallArrowIcon);
frameLayout2.addView(this.missedCallPhoneIcon);
this.missedCallArrowIcon.setImageResource(org.telegram.messenger.R.drawable.login_arrow1);
this.missedCallPhoneIcon.setImageResource(org.telegram.messenger.R.drawable.login_phone1);
addView(frameLayout2, LayoutHelper.createLinear(64, 64, 1, 0, 16, 0, 0));
addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 8, 0, 0));
TextView textView3 = new TextView(context);
this.missedCallDescriptionSubtitle = textView3;
textView3.setTextSize(1, 14.0f);
this.missedCallDescriptionSubtitle.setGravity(1);
this.missedCallDescriptionSubtitle.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.missedCallDescriptionSubtitle.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle", org.telegram.messenger.R.string.MissedCallDescriptionSubtitle)));
addView(this.missedCallDescriptionSubtitle, LayoutHelper.createLinear(-1, -2, 49, 36, 16, 36, 0));
this.codeFieldContainer = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivitySmsView.this.lambda$onNextPressed$14(null);
}
};
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
TextView textView4 = new TextView(context);
this.prefixTextView = textView4;
textView4.setTextSize(1, 20.0f);
this.prefixTextView.setMaxLines(1);
this.prefixTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.prefixTextView.setPadding(0, 0, 0, 0);
this.prefixTextView.setGravity(16);
linearLayout.addView(this.prefixTextView, LayoutHelper.createLinear(-2, -1, 16, 0, 0, 4, 0));
linearLayout.addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, -1));
addView(linearLayout, LayoutHelper.createLinear(-2, 34, 1, 0, 28, 0, 0));
TextView textView5 = new TextView(context);
this.missedCallDescriptionSubtitle2 = textView5;
textView5.setTextSize(1, 14.0f);
this.missedCallDescriptionSubtitle2.setGravity(1);
this.missedCallDescriptionSubtitle2.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.missedCallDescriptionSubtitle2.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle2", org.telegram.messenger.R.string.MissedCallDescriptionSubtitle2)));
addView(this.missedCallDescriptionSubtitle2, LayoutHelper.createLinear(-1, -2, 49, 36, 28, 36, 12));
} else {
if (i2 == 3) {
this.confirmTextView.setGravity(1);
FrameLayout frameLayout3 = new FrameLayout(context);
addView(frameLayout3, LayoutHelper.createLinear(-1, 0, 1.0f));
LinearLayout linearLayout2 = new LinearLayout(context);
linearLayout2.setOrientation(1);
linearLayout2.setGravity(1);
frameLayout3.addView(linearLayout2, LayoutHelper.createFrame(-1, -2, 17));
((FrameLayout.LayoutParams) linearLayout2.getLayoutParams()).bottomMargin = AndroidUtilities.isTablet() ? 0 : AndroidUtilities.statusBarHeight;
FrameLayout frameLayout4 = new FrameLayout(context);
linearLayout2.addView(frameLayout4, LayoutHelper.createFrame(-2, -2, 1));
this.blueImageView = new RLottieImageView(context);
int i3 = org.telegram.messenger.R.raw.phone_flash_call;
RLottieDrawable rLottieDrawable = new RLottieDrawable(i3, String.valueOf(i3), AndroidUtilities.dp(64.0f), AndroidUtilities.dp(64.0f), true, null);
this.hintDrawable = rLottieDrawable;
this.blueImageView.setAnimation(rLottieDrawable);
frameLayout4.addView(this.blueImageView, LayoutHelper.createFrame(64, 64.0f));
this.titleTextView.setText(string == null ? LocaleController.getString(org.telegram.messenger.R.string.YourCode) : string);
linearLayout2.addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 1, 0, 16, 0, 0));
linearLayout2.addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 0, 8, 0, 0));
frameLayout = frameLayout3;
if (this.currentType != 11) {
CodeFieldContainer codeFieldContainer = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivitySmsView.this.lambda$onNextPressed$14(null);
}
};
this.codeFieldContainer = codeFieldContainer;
addView(codeFieldContainer, LayoutHelper.createLinear(-2, 42, 1, 0, 32, 0, 0));
}
if (this.currentType == 3) {
this.codeFieldContainer.setVisibility(8);
}
this.problemFrame = new FrameLayout(context);
LoadingTextView loadingTextView = new LoadingTextView(context, LoginActivity.this) {
@Override
protected boolean isRippleEnabled() {
return getVisibility() == 0 && (LoginActivitySmsView.this.time <= 0 || LoginActivitySmsView.this.timeTimer == null);
}
};
this.timeText = loadingTextView;
loadingTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.timeText.setPadding(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(14.0f), AndroidUtilities.dp(16.0f));
this.timeText.setTextSize(1, 15.0f);
this.timeText.setGravity(49);
this.timeText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySmsView.this.lambda$new$4(view);
}
});
this.problemFrame.addView(this.timeText, LayoutHelper.createFrame(-2, -2, 49));
this.errorViewSwitcher = new ViewSwitcher(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i4, int i5) {
super.onMeasure(i4, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
if (this.currentType == 15) {
Animation loadAnimation = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_in);
Interpolator interpolator = Easings.easeInOutQuad;
loadAnimation.setInterpolator(interpolator);
this.errorViewSwitcher.setInAnimation(loadAnimation);
Animation loadAnimation2 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_out);
loadAnimation2.setInterpolator(interpolator);
this.errorViewSwitcher.setOutAnimation(loadAnimation2);
LoadingTextView loadingTextView2 = new LoadingTextView(context, LoginActivity.this) {
@Override
protected boolean isRippleEnabled() {
return isClickable() && getVisibility() == 0 && !LoginActivitySmsView.this.nextPressed && (LoginActivitySmsView.this.timeText == null || LoginActivitySmsView.this.timeText.getVisibility() == 8) && !LoginActivitySmsView.this.isResendingCode;
}
};
this.problemText = loadingTextView2;
loadingTextView2.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.problemText.setTextSize(1, 15.0f);
this.problemText.setGravity(49);
this.problemText.setPadding(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(14.0f), AndroidUtilities.dp(16.0f));
this.problemFrame.addView(this.problemText, LayoutHelper.createFrame(-1, -2, 17));
this.errorViewSwitcher.addView(this.problemFrame, LayoutHelper.createFrame(-2, -2, 17));
} else {
Animation loadAnimation3 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.scale_in);
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.DEFAULT;
loadAnimation3.setInterpolator(cubicBezierInterpolator);
this.errorViewSwitcher.setInAnimation(loadAnimation3);
Animation loadAnimation4 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.scale_out);
loadAnimation4.setInterpolator(cubicBezierInterpolator);
this.errorViewSwitcher.setOutAnimation(loadAnimation4);
LinearLayout linearLayout3 = new LinearLayout(context);
this.openFragmentButton = linearLayout3;
linearLayout3.setOrientation(0);
this.openFragmentButton.setGravity(17);
this.openFragmentButton.setPadding(AndroidUtilities.dp(34.0f), 0, AndroidUtilities.dp(34.0f), 0);
this.openFragmentButton.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6.0f), Theme.getColor(Theme.key_changephoneinfo_image2), Theme.getColor(Theme.key_chats_actionPressedBackground)));
this.openFragmentButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySmsView.this.lambda$new$5(view);
}
});
this.errorViewSwitcher.addView(this.openFragmentButton, LayoutHelper.createFrame(-1, 52.0f));
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.openFragmentImageView = rLottieImageView;
rLottieImageView.setAnimation(org.telegram.messenger.R.raw.fragment, 36, 36);
this.openFragmentButton.addView(this.openFragmentImageView, LayoutHelper.createLinear(36, 36, 16, 0, 0, 2, 0));
TextView textView6 = new TextView(context);
this.openFragmentButtonText = textView6;
textView6.setText(LocaleController.getString(org.telegram.messenger.R.string.OpenFragment));
this.openFragmentButtonText.setTextColor(-1);
this.openFragmentButtonText.setTextSize(1, 15.0f);
this.openFragmentButtonText.setGravity(17);
this.openFragmentButtonText.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.openFragmentButton.addView(this.openFragmentButtonText);
}
TextView textView7 = new TextView(context);
this.wrongCode = textView7;
textView7.setText(LocaleController.getString("WrongCode", org.telegram.messenger.R.string.WrongCode));
this.wrongCode.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.wrongCode.setTextSize(1, 15.0f);
this.wrongCode.setGravity(49);
this.wrongCode.setPadding(0, AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f));
this.errorViewSwitcher.addView(this.wrongCode, LayoutHelper.createFrame(-2, -2, 17));
if (frameLayout != null) {
FrameLayout frameLayout5 = new FrameLayout(context);
this.bottomContainer = frameLayout5;
frameLayout5.addView(this.errorViewSwitcher, LayoutHelper.createFrame(this.currentType == 15 ? -1 : -2, -2.0f, 81, 0.0f, 0.0f, 0.0f, 32.0f));
addView(this.bottomContainer, LayoutHelper.createLinear(-1, 0, 1.0f));
} else {
frameLayout.addView(this.errorViewSwitcher, LayoutHelper.createFrame(-2, -2.0f, 81, 0.0f, 0.0f, 0.0f, 32.0f));
}
VerticalPositionAutoAnimator.attach(this.errorViewSwitcher);
if (this.currentType == 15) {
this.problemText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySmsView.this.lambda$new$8(context, view);
}
});
return;
}
return;
}
this.confirmTextView.setGravity(49);
FrameLayout frameLayout6 = new FrameLayout(context);
addView(frameLayout6, LayoutHelper.createLinear(-2, -2, 49, 0, 16, 0, 0));
int i4 = this.currentType;
int i5 = i4 == 1 ? 128 : 64;
if (i4 == 1) {
int i6 = org.telegram.messenger.R.raw.code_laptop;
float f = i5;
this.hintDrawable = new RLottieDrawable(i6, String.valueOf(i6), AndroidUtilities.dp(f), AndroidUtilities.dp(f), true, null);
} else {
int i7 = org.telegram.messenger.R.raw.sms_incoming_info;
float f2 = i5;
this.hintDrawable = new RLottieDrawable(i7, String.valueOf(i7), AndroidUtilities.dp(f2), AndroidUtilities.dp(f2), true, null);
int i8 = org.telegram.messenger.R.raw.phone_stars_to_dots;
this.starsToDotsDrawable = new RLottieDrawable(i8, String.valueOf(i8), AndroidUtilities.dp(f2), AndroidUtilities.dp(f2), true, null);
int i9 = org.telegram.messenger.R.raw.phone_dots;
this.dotsDrawable = new RLottieDrawable(i9, String.valueOf(i9), AndroidUtilities.dp(f2), AndroidUtilities.dp(f2), true, null);
int i10 = org.telegram.messenger.R.raw.phone_dots_to_stars;
this.dotsToStarsDrawable = new RLottieDrawable(i10, String.valueOf(i10), AndroidUtilities.dp(f2), AndroidUtilities.dp(f2), true, null);
}
RLottieImageView rLottieImageView2 = new RLottieImageView(context);
this.blueImageView = rLottieImageView2;
rLottieImageView2.setAnimation(this.hintDrawable);
if (this.currentType == 1 && !AndroidUtilities.isSmallScreen()) {
this.blueImageView.setTranslationY(-AndroidUtilities.dp(24.0f));
}
frameLayout6.addView(this.blueImageView, LayoutHelper.createFrame(i5, i5, 51, 0.0f, 0.0f, 0.0f, (this.currentType != 1 || AndroidUtilities.isSmallScreen()) ? 0.0f : -AndroidUtilities.dp(16.0f)));
TextView textView8 = this.titleTextView;
if (string == null) {
string = LocaleController.getString(this.currentType == 1 ? org.telegram.messenger.R.string.SentAppCodeTitle : org.telegram.messenger.R.string.SentSmsCodeTitle);
}
textView8.setText(string);
addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 18, 0, 0));
int i11 = this.currentType == 15 ? 16 : 0;
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 49, i11, 17, i11, 0));
}
frameLayout = null;
if (this.currentType != 11) {
}
if (this.currentType == 3) {
}
this.problemFrame = new FrameLayout(context);
LoadingTextView loadingTextView3 = new LoadingTextView(context, LoginActivity.this) {
@Override
protected boolean isRippleEnabled() {
return getVisibility() == 0 && (LoginActivitySmsView.this.time <= 0 || LoginActivitySmsView.this.timeTimer == null);
}
};
this.timeText = loadingTextView3;
loadingTextView3.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.timeText.setPadding(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(14.0f), AndroidUtilities.dp(16.0f));
this.timeText.setTextSize(1, 15.0f);
this.timeText.setGravity(49);
this.timeText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySmsView.this.lambda$new$4(view);
}
});
this.problemFrame.addView(this.timeText, LayoutHelper.createFrame(-2, -2, 49));
this.errorViewSwitcher = new ViewSwitcher(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i42, int i52) {
super.onMeasure(i42, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
if (this.currentType == 15) {
}
TextView textView72 = new TextView(context);
this.wrongCode = textView72;
textView72.setText(LocaleController.getString("WrongCode", org.telegram.messenger.R.string.WrongCode));
this.wrongCode.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.wrongCode.setTextSize(1, 15.0f);
this.wrongCode.setGravity(49);
this.wrongCode.setPadding(0, AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f));
this.errorViewSwitcher.addView(this.wrongCode, LayoutHelper.createFrame(-2, -2, 17));
if (frameLayout != null) {
}
VerticalPositionAutoAnimator.attach(this.errorViewSwitcher);
if (this.currentType == 15) {
}
}
public void lambda$new$4(View view) {
if (this.time <= 0 || this.timeTimer == null) {
this.isResendingCode = true;
this.timeText.invalidate();
this.timeText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText));
int i = this.nextType;
if (i != 4 && i != 2 && i != 11 && i != 15) {
if (i == 3) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
this.waitingForEvent = false;
destroyCodeTimer();
resendCode();
return;
}
return;
}
if (i == 4 || i == 11) {
this.timeText.setText(LocaleController.getString("Calling", org.telegram.messenger.R.string.Calling));
} else {
this.timeText.setText(LocaleController.getString("SendingSms", org.telegram.messenger.R.string.SendingSms));
}
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
createCodeTimer();
TLRPC$TL_auth_resendCode tLRPC$TL_auth_resendCode = new TLRPC$TL_auth_resendCode();
tLRPC$TL_auth_resendCode.phone_number = this.requestPhone;
tLRPC$TL_auth_resendCode.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.this.lambda$new$3(bundle, tLObject, tLRPC$TL_error);
}
}, 10);
}
}
public void lambda$new$1(Bundle bundle, TLObject tLObject) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, (TLRPC$TL_auth_sentCode) tLObject);
}
public void lambda$new$3(final Bundle bundle, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
if (tLObject != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$new$1(bundle, tLObject);
}
});
} else {
if (tLRPC$TL_error == null || tLRPC$TL_error.text == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$new$2(tLRPC$TL_error);
}
});
}
}
public void lambda$new$2(TLRPC$TL_error tLRPC$TL_error) {
this.lastError = tLRPC$TL_error.text;
}
public void lambda$new$5(View view) {
try {
getContext().startActivity(new Intent("android.intent.action.VIEW", Uri.parse(this.url)));
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$new$8(Context context, View view) {
if (this.nextPressed) {
return;
}
LoadingTextView loadingTextView = this.timeText;
if ((loadingTextView == null || loadingTextView.getVisibility() == 8) && !this.isResendingCode) {
if (!(this.nextType == 0)) {
if (LoginActivity.this.radialProgressView.getTag() != null) {
return;
}
resendCode();
return;
}
new AlertDialog.Builder(context).setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle)).setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("DidNotGetTheCodeInfo", org.telegram.messenger.R.string.DidNotGetTheCodeInfo, this.phone))).setNeutralButton(LocaleController.getString(org.telegram.messenger.R.string.DidNotGetTheCodeHelpButton), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivitySmsView.this.lambda$new$6(dialogInterface, i);
}
}).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Close), null).setNegativeButton(LocaleController.getString(org.telegram.messenger.R.string.DidNotGetTheCodeEditNumberButton), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivitySmsView.this.lambda$new$7(dialogInterface, i);
}
}).show();
}
}
public void lambda$new$6(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.SENDTO");
intent.setData(Uri.parse("mailto:"));
intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@telegram.org"});
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) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.AppName), LocaleController.getString("NoMailInstalled", org.telegram.messenger.R.string.NoMailInstalled));
}
}
public void lambda$new$7(DialogInterface dialogInterface, int i) {
LoginActivity.this.setPage(0, true, null, true);
}
@Override
public void updateColors() {
this.confirmTextView.setTextColor(Theme.getColor(LoginActivity.this.isInCancelAccountDeletionMode() ? Theme.key_windowBackgroundWhiteBlackText : Theme.key_windowBackgroundWhiteGrayText6));
this.confirmTextView.setLinkTextColor(Theme.getColor(Theme.key_chats_actionBackground));
TextView textView = this.titleTextView;
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i));
if (this.currentType == 11) {
TextView textView2 = this.missedCallDescriptionSubtitle;
int i2 = Theme.key_windowBackgroundWhiteGrayText;
textView2.setTextColor(Theme.getColor(i2));
this.missedCallDescriptionSubtitle2.setTextColor(Theme.getColor(i2));
this.missedCallArrowIcon.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.SRC_IN));
this.missedCallPhoneIcon.setColorFilter(new PorterDuffColorFilter(Theme.getColor(i), PorterDuff.Mode.SRC_IN));
this.prefixTextView.setTextColor(Theme.getColor(i));
}
applyLottieColors(this.hintDrawable);
applyLottieColors(this.starsToDotsDrawable);
applyLottieColors(this.dotsDrawable);
applyLottieColors(this.dotsToStarsDrawable);
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer != null) {
codeFieldContainer.invalidate();
}
Integer num = (Integer) this.timeText.getTag();
if (num == null) {
num = Integer.valueOf(Theme.key_windowBackgroundWhiteGrayText6);
}
this.timeText.setTextColor(Theme.getColor(num.intValue()));
if (this.currentType != 15) {
this.problemText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
}
this.wrongCode.setTextColor(Theme.getColor(Theme.key_text_RedBold));
}
private void applyLottieColors(RLottieDrawable rLottieDrawable) {
if (rLottieDrawable != null) {
rLottieDrawable.setLayerColor("Bubble.**", Theme.getColor(Theme.key_chats_actionBackground));
int i = Theme.key_windowBackgroundWhiteBlackText;
rLottieDrawable.setLayerColor("Phone.**", Theme.getColor(i));
rLottieDrawable.setLayerColor("Note.**", Theme.getColor(i));
}
}
@Override
public boolean hasCustomKeyboard() {
return this.currentType != 3;
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
private void resendCode() {
if (this.nextPressed || this.isResendingCode || LoginActivity.this.isRequestingFirebaseSms) {
return;
}
this.isResendingCode = true;
this.timeText.invalidate();
this.problemText.invalidate();
final 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 tLRPC$TL_auth_resendCode = new TLRPC$TL_auth_resendCode();
tLRPC$TL_auth_resendCode.phone_number = this.requestPhone;
tLRPC$TL_auth_resendCode.phone_code_hash = this.phoneHash;
tryShowProgress(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.this.lambda$resendCode$10(bundle, tLObject, tLRPC$TL_error);
}
}, 10));
}
public void lambda$resendCode$10(final Bundle bundle, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$resendCode$9(tLRPC$TL_error, bundle, tLObject);
}
});
}
public void lambda$resendCode$9(TLRPC$TL_error tLRPC$TL_error, Bundle bundle, TLObject tLObject) {
this.nextPressed = false;
if (tLRPC$TL_error == null) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, (TLRPC$TL_auth_sentCode) tLObject);
} else {
String str = tLRPC$TL_error.text;
if (str != null) {
if (str.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidPhoneNumber", org.telegram.messenger.R.string.InvalidPhoneNumber));
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", org.telegram.messenger.R.string.InvalidCode));
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else if (tLRPC$TL_error.code != -1000) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ErrorOccurred", org.telegram.messenger.R.string.ErrorOccurred) + "\n" + tLRPC$TL_error.text);
}
}
}
tryHideProgress(false);
}
@Override
protected void onConfigurationChanged(Configuration configuration) {
CodeNumberField[] codeNumberFieldArr;
super.onConfigurationChanged(configuration);
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer == null || (codeNumberFieldArr = codeFieldContainer.codeField) == null) {
return;
}
for (CodeNumberField codeNumberField : codeNumberFieldArr) {
if (Build.VERSION.SDK_INT >= 21) {
codeNumberField.setShowSoftInputOnFocusCompat(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
}
}
}
private void tryShowProgress(int i) {
lambda$tryShowProgress$11(i, true);
}
public void lambda$tryShowProgress$11(final int i, final boolean z) {
if (this.starsToDotsDrawable == null) {
LoginActivity.this.needShowProgress(i, z);
return;
}
if (this.isDotsAnimationVisible) {
return;
}
this.isDotsAnimationVisible = true;
if (this.hintDrawable.getCurrentFrame() != this.hintDrawable.getFramesCount() - 1) {
this.hintDrawable.setOnAnimationEndListener(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryShowProgress$12(i, z);
}
});
return;
}
this.starsToDotsDrawable.setOnAnimationEndListener(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryShowProgress$14();
}
});
this.blueImageView.setAutoRepeat(false);
this.starsToDotsDrawable.setCurrentFrame(0, false);
this.blueImageView.setAnimation(this.starsToDotsDrawable);
this.blueImageView.playAnimation();
}
public void lambda$tryShowProgress$12(final int i, final boolean z) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryShowProgress$11(i, z);
}
});
}
public void lambda$tryShowProgress$14() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryShowProgress$13();
}
});
}
public void lambda$tryShowProgress$13() {
this.blueImageView.setAutoRepeat(true);
this.dotsDrawable.setCurrentFrame(0, false);
this.dotsDrawable.setAutoRepeat(1);
this.blueImageView.setAnimation(this.dotsDrawable);
this.blueImageView.playAnimation();
}
private void tryHideProgress(boolean z) {
tryHideProgress(z, true);
}
private void tryHideProgress(boolean z, boolean z2) {
if (this.starsToDotsDrawable == null) {
LoginActivity.this.needHideProgress(z, z2);
} else if (this.isDotsAnimationVisible) {
this.isDotsAnimationVisible = false;
this.blueImageView.setAutoRepeat(false);
this.dotsDrawable.setAutoRepeat(0);
this.dotsDrawable.setOnFinishCallback(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryHideProgress$18();
}
}, this.dotsDrawable.getFramesCount() - 1);
}
}
public void lambda$tryHideProgress$18() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryHideProgress$17();
}
});
}
public void lambda$tryHideProgress$16() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryHideProgress$15();
}
});
}
public void lambda$tryHideProgress$17() {
this.dotsToStarsDrawable.setOnAnimationEndListener(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$tryHideProgress$16();
}
});
this.blueImageView.setAutoRepeat(false);
this.dotsToStarsDrawable.setCurrentFrame(0, false);
this.blueImageView.setAnimation(this.dotsToStarsDrawable);
this.blueImageView.playAnimation();
}
public void lambda$tryHideProgress$15() {
this.blueImageView.setAutoRepeat(false);
this.blueImageView.setAnimation(this.hintDrawable);
}
@Override
public String getHeaderName() {
int i = this.currentType;
if (i == 3 || i == 11) {
return this.phone;
}
return LocaleController.getString("YourCode", org.telegram.messenger.R.string.YourCode);
}
@Override
public void setParams(Bundle bundle, boolean z) {
String str;
int i;
String str2;
String string;
if (bundle == null) {
return;
}
this.waitingForEvent = true;
int i2 = this.currentType;
if (i2 == 15) {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i2 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i2 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
if (z) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CallReceiver.checkLastReceivedCall();
}
});
}
}
this.currentParams = bundle;
this.phone = bundle.getString("phone");
this.emailPhone = bundle.getString("ephone");
this.requestPhone = bundle.getString("phoneFormated");
this.phoneHash = bundle.getString("phoneHash");
this.time = bundle.getInt("timeout");
this.openTime = (int) (System.currentTimeMillis() / 1000);
this.nextType = bundle.getInt("nextType");
this.pattern = bundle.getString("pattern");
this.prefix = bundle.getString("prefix");
int i3 = bundle.getInt("length");
this.length = i3;
if (i3 == 0) {
this.length = 5;
}
this.url = bundle.getString("url");
this.codeFieldContainer.setNumbersCount(this.length, this.currentType);
for (CodeNumberField codeNumberField : this.codeFieldContainer.codeField) {
if (Build.VERSION.SDK_INT >= 21) {
codeNumberField.setShowSoftInputOnFocusCompat(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
}
codeNumberField.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
if (LoginActivitySmsView.this.postedErrorColorTimeout) {
LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this;
loginActivitySmsView.removeCallbacks(loginActivitySmsView.errorColorTimeout);
LoginActivitySmsView.this.errorColorTimeout.run();
}
}
});
codeNumberField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z2) {
LoginActivity.LoginActivitySmsView.this.lambda$setParams$20(view, z2);
}
});
}
if (this.phone == null) {
return;
}
String format = PhoneFormat.getInstance().format(this.phone);
if (LoginActivity.this.isInCancelAccountDeletionMode()) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(AndroidUtilities.replaceTags(LocaleController.formatString("CancelAccountResetInfo2", org.telegram.messenger.R.string.CancelAccountResetInfo2, PhoneFormat.getInstance().format("+" + format))));
int indexOf = TextUtils.indexOf((CharSequence) spannableStringBuilder, '*');
int lastIndexOf = TextUtils.lastIndexOf(spannableStringBuilder, '*');
str = spannableStringBuilder;
str = spannableStringBuilder;
str = spannableStringBuilder;
if (indexOf != -1 && lastIndexOf != -1 && indexOf != lastIndexOf) {
this.confirmTextView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) "");
spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) "");
spannableStringBuilder.setSpan(new URLSpanNoUnderline("tg://settings/change_number"), indexOf, lastIndexOf - 1, 33);
str = spannableStringBuilder;
}
} else {
int i4 = this.currentType;
str = i4 == 1 ? AndroidUtilities.replaceTags(LocaleController.formatString("SentAppCodeWithPhone", org.telegram.messenger.R.string.SentAppCodeWithPhone, LocaleController.addNbsp(format))) : i4 == 2 ? AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", org.telegram.messenger.R.string.SentSmsCode, LocaleController.addNbsp(format))) : i4 == 3 ? AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", org.telegram.messenger.R.string.SentCallCode, LocaleController.addNbsp(format))) : i4 == 4 ? AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", org.telegram.messenger.R.string.SentCallOnly, LocaleController.addNbsp(format))) : i4 == 15 ? AndroidUtilities.replaceTags(LocaleController.formatString("SentFragmentCode", org.telegram.messenger.R.string.SentFragmentCode, LocaleController.addNbsp(format))) : "";
}
this.confirmTextView.setText(str);
int i5 = this.currentType;
if (i5 != 15) {
if (i5 == 1) {
int i6 = this.nextType;
if (i6 == 3 || i6 == 4 || i6 == 11) {
this.problemText.setText(LocaleController.getString("DidNotGetTheCodePhone", org.telegram.messenger.R.string.DidNotGetTheCodePhone));
} else if (i6 == 15) {
this.problemText.setText(LocaleController.getString("DidNotGetTheCodeFragment", org.telegram.messenger.R.string.DidNotGetTheCodeFragment));
} else if (i6 == 0) {
this.problemText.setText(LocaleController.getString("DidNotGetTheCode", org.telegram.messenger.R.string.DidNotGetTheCode));
} else {
this.problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", org.telegram.messenger.R.string.DidNotGetTheCodeSms));
}
} else {
this.problemText.setText(LocaleController.getString("DidNotGetTheCode", org.telegram.messenger.R.string.DidNotGetTheCode));
}
}
if (this.currentType != 3) {
LoginActivity.this.showKeyboard(this.codeFieldContainer.codeField[0]);
this.codeFieldContainer.codeField[0].requestFocus();
} else {
AndroidUtilities.hideKeyboard(this.codeFieldContainer.codeField[0]);
}
destroyTimer();
destroyCodeTimer();
this.lastCurrentTime = System.currentTimeMillis();
int i7 = this.currentType;
if (i7 == 1) {
setProblemTextVisible(true);
this.timeText.setVisibility(8);
LoadingTextView loadingTextView = this.problemText;
if (loadingTextView != null) {
loadingTextView.setVisibility(0);
}
} else if (i7 == 3) {
int i8 = this.nextType;
if (i8 == 4 || i8 == 2 || i8 == 11) {
setProblemTextVisible(false);
this.timeText.setVisibility(0);
this.problemText.setVisibility(8);
int i9 = this.nextType;
if (i9 == 4 || i9 == 11) {
this.timeText.setText(LocaleController.formatString("CallAvailableIn", org.telegram.messenger.R.string.CallAvailableIn, 1, 0));
} else if (i9 == 2) {
this.timeText.setText(LocaleController.formatString("SmsAvailableIn", org.telegram.messenger.R.string.SmsAvailableIn, 1, 0));
}
}
String obtainLoginPhoneCall = z ? AndroidUtilities.obtainLoginPhoneCall(this.pattern) : null;
if (obtainLoginPhoneCall != null) {
lambda$onNextPressed$14(obtainLoginPhoneCall);
} else {
String str3 = this.catchedPhone;
if (str3 != null) {
lambda$onNextPressed$14(str3);
} else {
int i10 = this.nextType;
if (i10 == 4 || i10 == 2 || i10 == 11) {
createTimer();
}
}
}
} else if (i7 == 2 && ((i = this.nextType) == 2 || i == 4 || i == 3)) {
this.timeText.setText(LocaleController.formatString("CallAvailableIn", org.telegram.messenger.R.string.CallAvailableIn, 2, 0));
setProblemTextVisible(this.time < 1000);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
LoadingTextView loadingTextView2 = this.problemText;
if (loadingTextView2 != null) {
loadingTextView2.setVisibility(this.time < 1000 ? 0 : 8);
}
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 + "|") && !LoginActivity.this.newAccount) {
str2 = string.substring(string.indexOf(124) + 1);
if (str2 == null) {
this.codeFieldContainer.setCode(str2);
lambda$onNextPressed$14(null);
} else {
createTimer();
}
}
}
str2 = null;
if (str2 == null) {
}
} else if (i7 == 4 && this.nextType == 2) {
this.timeText.setText(LocaleController.formatString("SmsAvailableIn", org.telegram.messenger.R.string.SmsAvailableIn, 2, 0));
setProblemTextVisible(this.time < 1000);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
LoadingTextView loadingTextView3 = this.problemText;
if (loadingTextView3 != null) {
loadingTextView3.setVisibility(this.time < 1000 ? 0 : 8);
}
createTimer();
} else if (i7 == 11) {
int i11 = this.nextType;
if (i11 == 4 || i11 == 2 || i11 == 11) {
setProblemTextVisible(false);
this.timeText.setVisibility(0);
this.problemText.setVisibility(8);
int i12 = this.nextType;
if (i12 == 4 || i12 == 11) {
this.timeText.setText(LocaleController.formatString("CallAvailableIn", org.telegram.messenger.R.string.CallAvailableIn, 1, 0));
} else if (i12 == 2) {
this.timeText.setText(LocaleController.formatString("SmsAvailableIn", org.telegram.messenger.R.string.SmsAvailableIn, 1, 0));
}
createTimer();
}
} else {
this.timeText.setVisibility(8);
LoadingTextView loadingTextView4 = this.problemText;
if (loadingTextView4 != null) {
loadingTextView4.setVisibility(0);
}
setProblemTextVisible(false);
createCodeTimer();
}
if (this.currentType == 11) {
String str4 = this.prefix;
for (int i13 = 0; i13 < this.length; i13++) {
str4 = str4 + "0";
}
String format2 = PhoneFormat.getInstance().format("+" + str4);
for (int i14 = 0; i14 < this.length; i14++) {
int lastIndexOf2 = format2.lastIndexOf("0");
if (lastIndexOf2 >= 0) {
format2 = format2.substring(0, lastIndexOf2);
}
}
this.prefixTextView.setText(format2.replaceAll("\\)", "").replaceAll("\\(", ""));
}
}
public void lambda$setParams$20(View view, boolean z) {
if (z) {
LoginActivity.this.keyboardView.setEditText((EditText) view);
LoginActivity.this.keyboardView.setDispatchBackWhenEmpty(true);
}
}
public class LoadingTextView extends TextView {
public final LoadingDrawable loadingDrawable;
private final Drawable rippleDrawable;
protected boolean isRippleEnabled() {
throw null;
}
public LoadingTextView(Context context) {
super(context);
Drawable createSelectorDrawable = Theme.createSelectorDrawable(Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteValueText), 0.1f), 7);
this.rippleDrawable = createSelectorDrawable;
LoadingDrawable loadingDrawable = new LoadingDrawable();
this.loadingDrawable = loadingDrawable;
createSelectorDrawable.setCallback(this);
loadingDrawable.setAppearByGradient(true);
loadingDrawable.setSpeed(0.8f);
}
@Override
public void setText(CharSequence charSequence, TextView.BufferType bufferType) {
super.setText(charSequence, bufferType);
updateLoadingLayout();
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
updateLoadingLayout();
}
private void updateLoadingLayout() {
CharSequence text;
Layout layout = getLayout();
if (layout == null || (text = layout.getText()) == null) {
return;
}
LinkPath linkPath = new LinkPath(true);
linkPath.setInset(AndroidUtilities.dp(3.0f), AndroidUtilities.dp(6.0f));
int length = text.length();
linkPath.setCurrentLayout(layout, 0, 0.0f);
layout.getSelectionPath(0, length, linkPath);
RectF rectF = AndroidUtilities.rectTmp;
linkPath.getBounds(rectF);
this.rippleDrawable.setBounds((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
this.loadingDrawable.usePath(linkPath);
this.loadingDrawable.setRadiiDp(4.0f);
int themedColor = LoginActivity.this.getThemedColor(Theme.key_chat_linkSelectBackground);
this.loadingDrawable.setColors(Theme.multAlpha(themedColor, 0.85f), Theme.multAlpha(themedColor, 2.0f), Theme.multAlpha(themedColor, 3.5f), Theme.multAlpha(themedColor, 6.0f));
this.loadingDrawable.updateBounds();
}
@Override
protected void onDraw(Canvas canvas) {
canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
this.rippleDrawable.draw(canvas);
canvas.restore();
super.onDraw(canvas);
if (LoginActivitySmsView.this.isResendingCode || this.loadingDrawable.isDisappearing()) {
canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
this.loadingDrawable.draw(canvas);
canvas.restore();
invalidate();
}
}
@Override
protected boolean verifyDrawable(Drawable drawable) {
return drawable == this.rippleDrawable || super.verifyDrawable(drawable);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (isRippleEnabled() && motionEvent.getAction() == 0) {
if (Build.VERSION.SDK_INT >= 21) {
this.rippleDrawable.setHotspot(motionEvent.getX(), motionEvent.getY());
}
this.rippleDrawable.setState(new int[]{R.attr.state_enabled, R.attr.state_pressed});
} else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 1) {
this.rippleDrawable.setState(new int[0]);
}
return super.onTouchEvent(motionEvent);
}
}
public void setProblemTextVisible(boolean z) {
LoadingTextView loadingTextView = this.problemText;
if (loadingTextView == null) {
return;
}
float f = z ? 1.0f : 0.0f;
if (loadingTextView.getAlpha() != f) {
this.problemText.animate().cancel();
this.problemText.animate().alpha(f).setDuration(150L).start();
}
}
private void createCodeTimer() {
if (this.codeTimer != null) {
return;
}
this.codeTime = 15000;
int i = this.time;
if (i > 15000) {
this.codeTime = i;
}
this.codeTimer = new Timer();
this.lastCodeTime = System.currentTimeMillis();
this.codeTimer.schedule(new AnonymousClass7(), 0L, 1000L);
}
public class AnonymousClass7 extends TimerTask {
AnonymousClass7() {
}
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.AnonymousClass7.this.lambda$run$0();
}
});
}
public void lambda$run$0() {
double currentTimeMillis = System.currentTimeMillis();
double d = currentTimeMillis - LoginActivitySmsView.this.lastCodeTime;
LoginActivitySmsView.this.lastCodeTime = currentTimeMillis;
LoginActivitySmsView.access$9426(LoginActivitySmsView.this, d);
if (LoginActivitySmsView.this.codeTime <= 1000) {
LoginActivitySmsView.this.setProblemTextVisible(true);
LoginActivitySmsView.this.timeText.setVisibility(8);
if (LoginActivitySmsView.this.problemText != null) {
LoginActivitySmsView.this.problemText.setVisibility(0);
}
LoginActivitySmsView.this.destroyCodeTimer();
}
}
}
public void destroyCodeTimer() {
try {
synchronized (this.timerSync) {
Timer timer = this.codeTimer;
if (timer != null) {
timer.cancel();
this.codeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
private void createTimer() {
if (this.timeTimer != null) {
return;
}
LoadingTextView loadingTextView = this.timeText;
int i = Theme.key_windowBackgroundWhiteGrayText6;
loadingTextView.setTextColor(Theme.getColor(i));
this.timeText.setTag(org.telegram.messenger.R.id.color_key_tag, Integer.valueOf(i));
Timer timer = new Timer();
this.timeTimer = timer;
timer.schedule(new AnonymousClass8(), 0L, 1000L);
}
public class AnonymousClass8 extends TimerTask {
AnonymousClass8() {
}
@Override
public void run() {
if (LoginActivitySmsView.this.timeTimer == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.AnonymousClass8.this.lambda$run$0();
}
});
}
public void lambda$run$0() {
double currentTimeMillis = System.currentTimeMillis();
double d = currentTimeMillis - LoginActivitySmsView.this.lastCurrentTime;
LoginActivitySmsView.this.lastCurrentTime = currentTimeMillis;
LoginActivitySmsView.access$8326(LoginActivitySmsView.this, d);
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.nextType == 11) {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("CallAvailableIn", org.telegram.messenger.R.string.CallAvailableIn, Integer.valueOf(i), Integer.valueOf(i2)));
} else if (LoginActivitySmsView.this.currentType != 2 || LoginActivitySmsView.this.nextType != 2) {
if (LoginActivitySmsView.this.nextType == 2) {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("SmsAvailableIn", org.telegram.messenger.R.string.SmsAvailableIn, Integer.valueOf(i), Integer.valueOf(i2)));
}
} else {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("ResendSmsAvailableIn", org.telegram.messenger.R.string.ResendSmsAvailableIn, Integer.valueOf(i), Integer.valueOf(i2)));
}
ProgressView unused = LoginActivitySmsView.this.progressView;
return;
}
LoginActivitySmsView.this.destroyTimer();
if (LoginActivitySmsView.this.nextType == 3 || LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 2 || LoginActivitySmsView.this.nextType == 11) {
if (LoginActivitySmsView.this.nextType == 4) {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString("RequestCallButton", org.telegram.messenger.R.string.RequestCallButton));
} else if (LoginActivitySmsView.this.nextType == 11 || LoginActivitySmsView.this.nextType == 3) {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString("RequestMissedCall", org.telegram.messenger.R.string.RequestMissedCall));
} else {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString("RequestSmsButton", org.telegram.messenger.R.string.RequestSmsButton));
}
LoadingTextView loadingTextView = LoginActivitySmsView.this.timeText;
int i3 = Theme.key_chats_actionBackground;
loadingTextView.setTextColor(Theme.getColor(i3));
LoginActivitySmsView.this.timeText.setTag(org.telegram.messenger.R.id.color_key_tag, Integer.valueOf(i3));
}
}
}
public void destroyTimer() {
LoadingTextView loadingTextView = this.timeText;
int i = Theme.key_windowBackgroundWhiteGrayText6;
loadingTextView.setTextColor(Theme.getColor(i));
this.timeText.setTag(org.telegram.messenger.R.id.color_key_tag, Integer.valueOf(i));
try {
synchronized (this.timerSync) {
Timer timer = this.timeTimer;
if (timer != null) {
timer.cancel();
this.timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void lambda$onNextPressed$14(String str) {
if (LoginActivity.this.currentViewNum == 11) {
if (this.nextPressed) {
return;
}
} else {
if (this.nextPressed) {
return;
}
if ((LoginActivity.this.currentViewNum < 1 || LoginActivity.this.currentViewNum > 4) && LoginActivity.this.currentViewNum != 15) {
return;
}
}
if (str == null) {
str = this.codeFieldContainer.getCode();
}
int i = 0;
if (TextUtils.isEmpty(str)) {
LoginActivity.this.onFieldError(this.codeFieldContainer, false);
return;
}
if (LoginActivity.this.currentViewNum < 1 || LoginActivity.this.currentViewNum > 4 || !this.codeFieldContainer.isFocusSuppressed) {
this.nextPressed = true;
int i2 = this.currentType;
if (i2 == 15) {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i2 == 2) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i2 == 3) {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = false;
int i3 = LoginActivity.this.activityMode;
if (i3 == 1) {
this.requestPhone = LoginActivity.this.cancelDeletionPhone;
final TLRPC$TL_account_confirmPhone tLRPC$TL_account_confirmPhone = new TLRPC$TL_account_confirmPhone();
tLRPC$TL_account_confirmPhone.phone_code = str;
tLRPC$TL_account_confirmPhone.phone_code_hash = this.phoneHash;
destroyTimer();
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
codeFieldContainer.isFocusSuppressed = true;
CodeNumberField[] codeNumberFieldArr = codeFieldContainer.codeField;
int length = codeNumberFieldArr.length;
while (i < length) {
codeNumberFieldArr[i].animateFocusedProgress(0.0f);
i++;
}
tryShowProgress(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_account_confirmPhone, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$28(tLRPC$TL_account_confirmPhone, tLObject, tLRPC$TL_error);
}
}, 2));
return;
}
if (i3 == 2) {
TLRPC$TL_account_changePhone tLRPC$TL_account_changePhone = new TLRPC$TL_account_changePhone();
tLRPC$TL_account_changePhone.phone_number = this.requestPhone;
tLRPC$TL_account_changePhone.phone_code = str;
tLRPC$TL_account_changePhone.phone_code_hash = this.phoneHash;
destroyTimer();
CodeFieldContainer codeFieldContainer2 = this.codeFieldContainer;
codeFieldContainer2.isFocusSuppressed = true;
CodeNumberField[] codeNumberFieldArr2 = codeFieldContainer2.codeField;
int length2 = codeNumberFieldArr2.length;
while (i < length2) {
codeNumberFieldArr2[i].animateFocusedProgress(0.0f);
i++;
}
lambda$tryShowProgress$11(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_account_changePhone, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$24(tLObject, tLRPC$TL_error);
}
}, 2), true);
LoginActivity.this.showDoneButton(true, true);
return;
}
final TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn = new TLRPC$TL_auth_signIn();
tLRPC$TL_auth_signIn.phone_number = this.requestPhone;
tLRPC$TL_auth_signIn.phone_code = str;
tLRPC$TL_auth_signIn.phone_code_hash = this.phoneHash;
tLRPC$TL_auth_signIn.flags |= 1;
destroyTimer();
CodeFieldContainer codeFieldContainer3 = this.codeFieldContainer;
codeFieldContainer3.isFocusSuppressed = true;
CodeNumberField[] codeNumberFieldArr3 = codeFieldContainer3.codeField;
int length3 = codeNumberFieldArr3.length;
while (i < length3) {
codeNumberFieldArr3[i].animateFocusedProgress(0.0f);
i++;
}
lambda$tryShowProgress$11(ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_signIn, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$36(tLRPC$TL_auth_signIn, tLObject, tLRPC$TL_error);
}
}, 10), true);
LoginActivity.this.showDoneButton(true, true);
}
}
public void lambda$onNextPressed$24(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$23(tLRPC$TL_error, tLObject);
}
});
}
public void lambda$onNextPressed$23(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject) {
int i;
int i2;
boolean z = true;
tryHideProgress(false, true);
this.nextPressed = false;
if (tLRPC$TL_error == null) {
TLRPC$User tLRPC$User = (TLRPC$User) tLObject;
destroyTimer();
destroyCodeTimer();
UserConfig.getInstance(((BaseFragment) LoginActivity.this).currentAccount).setCurrentUser(tLRPC$User);
UserConfig.getInstance(((BaseFragment) LoginActivity.this).currentAccount).saveConfig(true);
ArrayList arrayList = new ArrayList();
arrayList.add(tLRPC$User);
MessagesStorage.getInstance(((BaseFragment) LoginActivity.this).currentAccount).putUsersAndChats(arrayList, null, true, true);
MessagesController.getInstance(((BaseFragment) LoginActivity.this).currentAccount).putUser(tLRPC$User, false);
NotificationCenter.getInstance(((BaseFragment) LoginActivity.this).currentAccount).lambda$postNotificationNameOnUIThread$1(NotificationCenter.mainUserInfoChanged, new Object[0]);
LoginActivity.this.getMessagesController().removeSuggestion(0L, "VALIDATE_PHONE_NUMBER");
if (this.currentType == 3) {
AndroidUtilities.endIncomingCall();
}
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$22();
}
});
return;
}
this.lastError = tLRPC$TL_error.text;
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
int i3 = this.currentType;
if ((i3 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((i3 == 2 && ((i = this.nextType) == 4 || i == 3)) || (i3 == 4 && this.nextType == 2))) {
createTimer();
}
int i4 = this.currentType;
if (i4 == 15) {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = true;
if (this.currentType == 3) {
return;
}
if (tLRPC$TL_error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidPhoneNumber", org.telegram.messenger.R.string.InvalidPhoneNumber));
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
shakeWrongCode();
if (!z) {
return;
}
int i5 = 0;
while (true) {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
CodeNumberField[] codeNumberFieldArr = codeFieldContainer.codeField;
if (i5 < codeNumberFieldArr.length) {
codeNumberFieldArr[i5].setText("");
i5++;
} else {
codeFieldContainer.isFocusSuppressed = false;
codeNumberFieldArr[0].requestFocus();
return;
}
}
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ErrorOccurred", org.telegram.messenger.R.string.ErrorOccurred) + "\n" + tLRPC$TL_error.text);
}
z = false;
if (!z) {
}
}
public void lambda$onNextPressed$22() {
try {
LoginActivity.this.fragmentView.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
new AlertDialog.Builder(getContext()).setTitle(LocaleController.getString(org.telegram.messenger.R.string.YourPasswordSuccess)).setMessage(LocaleController.formatString(org.telegram.messenger.R.string.ChangePhoneNumberSuccessWithPhone, PhoneFormat.getInstance().format("+" + this.requestPhone))).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.OK), null).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$21(dialogInterface);
}
}).show();
}
public void lambda$onNextPressed$21(DialogInterface dialogInterface) {
LoginActivity.this.finishFragment();
}
public void lambda$onNextPressed$28(final TLRPC$TL_account_confirmPhone tLRPC$TL_account_confirmPhone, TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$27(tLRPC$TL_error, tLRPC$TL_account_confirmPhone);
}
});
}
public void lambda$onNextPressed$27(TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_account_confirmPhone tLRPC$TL_account_confirmPhone) {
int i;
int i2;
tryHideProgress(false);
this.nextPressed = false;
if (tLRPC$TL_error == null) {
final Activity parentActivity = LoginActivity.this.getParentActivity();
if (parentActivity == null) {
return;
}
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$26(parentActivity);
}
});
return;
}
this.lastError = tLRPC$TL_error.text;
int i3 = this.currentType;
if ((i3 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((i3 == 2 && ((i = this.nextType) == 4 || i == 3)) || (i3 == 4 && this.nextType == 2))) {
createTimer();
}
int i4 = this.currentType;
if (i4 == 15) {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = true;
if (this.currentType != 3) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_account_confirmPhone, new Object[0]);
}
if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
shakeWrongCode();
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
}
public void lambda$onNextPressed$26(Activity activity) {
new AlertDialog.Builder(activity).setTitle(LocaleController.getString(org.telegram.messenger.R.string.CancelLinkSuccessTitle)).setMessage(LocaleController.formatString("CancelLinkSuccess", org.telegram.messenger.R.string.CancelLinkSuccess, PhoneFormat.getInstance().format("+" + this.phone))).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Close), null).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$25(dialogInterface);
}
}).show();
}
public void lambda$onNextPressed$25(DialogInterface dialogInterface) {
LoginActivity.this.finishFragment();
}
public void lambda$onNextPressed$36(final TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$35(tLRPC$TL_error, tLObject, tLRPC$TL_auth_signIn);
}
});
}
public void lambda$onNextPressed$35(TLRPC$TL_error tLRPC$TL_error, final TLObject tLObject, final TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn) {
int i;
CodeFieldContainer codeFieldContainer;
CodeNumberField[] codeNumberFieldArr;
int i2;
boolean z = true;
tryHideProgress(false, true);
if (tLRPC$TL_error == null) {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
destroyTimer();
destroyCodeTimer();
if (tLObject instanceof TLRPC$TL_auth_authorizationSignUpRequired) {
TLRPC$TL_help_termsOfService tLRPC$TL_help_termsOfService = ((TLRPC$TL_auth_authorizationSignUpRequired) tLObject).terms_of_service;
if (tLRPC$TL_help_termsOfService != null) {
LoginActivity.this.currentTermsOfService = tLRPC$TL_help_termsOfService;
}
final Bundle bundle = new Bundle();
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", tLRPC$TL_auth_signIn.phone_code);
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$29(bundle);
}
});
} else {
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$30(tLObject);
}
});
}
} else {
String str = tLRPC$TL_error.text;
this.lastError = str;
if (str.contains("SESSION_PASSWORD_NEEDED")) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_account_getPassword(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC$TL_error tLRPC$TL_error2) {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$33(tLRPC$TL_auth_signIn, tLObject2, tLRPC$TL_error2);
}
}, 10);
destroyTimer();
destroyCodeTimer();
} else {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
int i3 = this.currentType;
if ((i3 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((i3 == 2 && ((i = this.nextType) == 4 || i == 3)) || (i3 == 4 && this.nextType == 2))) {
createTimer();
}
int i4 = this.currentType;
if (i4 == 15) {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i4 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CallReceiver.checkLastReceivedCall();
}
});
}
this.waitingForEvent = true;
if (this.currentType != 3) {
if (tLRPC$TL_error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidPhoneNumber", org.telegram.messenger.R.string.InvalidPhoneNumber));
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
shakeWrongCode();
if (!z) {
int i5 = 0;
while (true) {
codeFieldContainer = this.codeFieldContainer;
codeNumberFieldArr = codeFieldContainer.codeField;
if (i5 >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i5].setText("");
i5++;
}
codeFieldContainer.isFocusSuppressed = false;
codeNumberFieldArr[0].requestFocus();
}
} else if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ErrorOccurred", org.telegram.messenger.R.string.ErrorOccurred) + "\n" + tLRPC$TL_error.text);
}
z = false;
if (!z) {
}
}
z = false;
}
}
if (z && this.currentType == 3) {
AndroidUtilities.endIncomingCall();
AndroidUtilities.setWaitingForCall(false);
}
}
public void lambda$onNextPressed$29(Bundle bundle) {
LoginActivity.this.setPage(5, true, bundle, false);
}
public void lambda$onNextPressed$30(TLObject tLObject) {
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLObject);
}
public void lambda$onNextPressed$33(final TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$32(tLRPC$TL_error, tLObject, tLRPC$TL_auth_signIn);
}
});
}
public void lambda$onNextPressed$32(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn) {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
if (tLRPC$TL_error != null) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
TLRPC$account_Password tLRPC$account_Password = (TLRPC$account_Password) tLObject;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(tLRPC$account_Password, true)) {
AlertsCreator.showUpdateAppAlert(LoginActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", org.telegram.messenger.R.string.UpdateAppAlert), true);
return;
}
final Bundle bundle = new Bundle();
SerializedData serializedData = new SerializedData(tLRPC$account_Password.getObjectSize());
tLRPC$account_Password.serializeToStream(serializedData);
bundle.putString("password", Utilities.bytesToHex(serializedData.toByteArray()));
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", tLRPC$TL_auth_signIn.phone_code);
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onNextPressed$31(bundle);
}
});
}
public void lambda$onNextPressed$31(Bundle bundle) {
LoginActivity.this.setPage(6, true, bundle, false);
}
private void animateSuccess(final Runnable runnable) {
if (this.currentType == 3) {
runnable.run();
return;
}
final int i = 0;
while (true) {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (i < codeFieldContainer.codeField.length) {
codeFieldContainer.postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$animateSuccess$37(i);
}
}, i * 75);
i++;
} else {
codeFieldContainer.postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$animateSuccess$38(runnable);
}
}, (this.codeFieldContainer.codeField.length * 75) + 400);
return;
}
}
}
public void lambda$animateSuccess$37(int i) {
this.codeFieldContainer.codeField[i].animateSuccessProgress(1.0f);
}
public void lambda$animateSuccess$38(Runnable runnable) {
int i = 0;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i < codeNumberFieldArr.length) {
codeNumberFieldArr[i].animateSuccessProgress(0.0f);
i++;
} else {
runnable.run();
this.codeFieldContainer.isFocusSuppressed = false;
return;
}
}
}
private void shakeWrongCode() {
try {
this.codeFieldContainer.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
int i = 0;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i].setText("");
this.codeFieldContainer.codeField[i].animateErrorProgress(1.0f);
i++;
}
if (this.errorViewSwitcher.getCurrentView() != this.wrongCode) {
this.errorViewSwitcher.showNext();
}
this.codeFieldContainer.codeField[0].requestFocus();
AndroidUtilities.shakeViewSpring(this.codeFieldContainer, this.currentType == 11 ? 3.5f : 10.0f, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$shakeWrongCode$40();
}
});
removeCallbacks(this.errorColorTimeout);
postDelayed(this.errorColorTimeout, 5000L);
this.postedErrorColorTimeout = true;
}
public void lambda$shakeWrongCode$40() {
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$shakeWrongCode$39();
}
}, 150L);
}
public void lambda$shakeWrongCode$39() {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
int i = 0;
codeFieldContainer.isFocusSuppressed = false;
codeFieldContainer.codeField[0].requestFocus();
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
return;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this.errorColorTimeout);
}
@Override
public boolean onBackPressed(boolean z) {
if (LoginActivity.this.activityMode != 0) {
LoginActivity.this.finishFragment();
return false;
}
if (!z) {
LoginActivity loginActivity = LoginActivity.this;
loginActivity.showDialog(new AlertDialog.Builder(loginActivity.getParentActivity()).setTitle(LocaleController.getString(org.telegram.messenger.R.string.EditNumber)).setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("EditNumberInfo", org.telegram.messenger.R.string.EditNumberInfo, this.phone))).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Close), null).setNegativeButton(LocaleController.getString(org.telegram.messenger.R.string.Edit), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivitySmsView.this.lambda$onBackPressed$41(dialogInterface, i);
}
}).create());
return false;
}
this.nextPressed = false;
tryHideProgress(true);
TLRPC$TL_auth_cancelCode tLRPC$TL_auth_cancelCode = new TLRPC$TL_auth_cancelCode();
tLRPC$TL_auth_cancelCode.phone_number = this.requestPhone;
tLRPC$TL_auth_cancelCode.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_cancelCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySmsView.lambda$onBackPressed$42(tLObject, tLRPC$TL_error);
}
}, 10);
destroyTimer();
destroyCodeTimer();
this.currentParams = null;
int i = this.currentType;
if (i == 15) {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else 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 void lambda$onBackPressed$41(DialogInterface dialogInterface, int i) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
@Override
public void onDestroyActivity() {
super.onDestroyActivity();
int i = this.currentType;
if (i == 15) {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else 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
public void onShow() {
super.onShow();
RLottieDrawable rLottieDrawable = this.hintDrawable;
if (rLottieDrawable != null) {
rLottieDrawable.setCurrentFrame(0);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.lambda$onShow$43();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$43() {
CodeNumberField[] codeNumberFieldArr;
if (this.currentType != 3 && (codeNumberFieldArr = this.codeFieldContainer.codeField) != null) {
for (int length = codeNumberFieldArr.length - 1; length >= 0; length--) {
if (length == 0 || this.codeFieldContainer.codeField[length].length() != 0) {
this.codeFieldContainer.codeField[length].requestFocus();
CodeNumberField[] codeNumberFieldArr2 = this.codeFieldContainer.codeField;
codeNumberFieldArr2[length].setSelection(codeNumberFieldArr2[length].length());
LoginActivity.this.showKeyboard(this.codeFieldContainer.codeField[length]);
break;
}
}
}
RLottieDrawable rLottieDrawable = this.hintDrawable;
if (rLottieDrawable != null) {
rLottieDrawable.start();
}
if (this.currentType == 15) {
this.openFragmentImageView.getAnimatedDrawable().setCurrentFrame(0, false);
this.openFragmentImageView.getAnimatedDrawable().start();
}
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (this.waitingForEvent) {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer.codeField == null) {
return;
}
if (i == NotificationCenter.didReceiveSmsCode) {
codeFieldContainer.setText("" + objArr[0]);
lambda$onNextPressed$14(null);
return;
}
if (i == NotificationCenter.didReceiveCall) {
String str = "" + objArr[0];
if (AndroidUtilities.checkPhonePattern(this.pattern, str)) {
if (!this.pattern.equals("*")) {
this.catchedPhone = str;
AndroidUtilities.endIncomingCall();
}
lambda$onNextPressed$14(str);
CallReceiver.clearLastCall();
}
}
}
}
@Override
public void onHide() {
super.onHide();
this.isResendingCode = false;
this.nextPressed = false;
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeFieldContainer.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
public void restoreStateParams(Bundle bundle) {
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) {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer.codeField != null) {
codeFieldContainer.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 TLRPC$account_Password currentPassword;
private RLottieImageView lockImageView;
private boolean nextPressed;
private OutlineTextContainerView outlineCodeField;
private String passwordString;
private String phoneCode;
private String phoneHash;
private String requestPhone;
private TextView titleView;
@Override
public boolean needBackButton() {
return true;
}
public LoginActivityPasswordView(final Context context) {
super(context);
int i;
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.lockImageView = rLottieImageView;
rLottieImageView.setAnimation(org.telegram.messenger.R.raw.tsv_setup_intro, 120, 120);
this.lockImageView.setAutoRepeat(false);
frameLayout.addView(this.lockImageView, LayoutHelper.createFrame(120, 120, 1));
if (!AndroidUtilities.isSmallScreen()) {
Point point = AndroidUtilities.displaySize;
if (point.x <= point.y || AndroidUtilities.isTablet()) {
i = 0;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(org.telegram.messenger.R.string.YourPasswordHeader));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView2 = new TextView(context);
this.confirmTextView = textView2;
textView2.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(1);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString(org.telegram.messenger.R.string.LoginPasswordTextShort));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 12, 8, 12, 0));
OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context);
this.outlineCodeField = outlineTextContainerView;
outlineTextContainerView.setText(LocaleController.getString(org.telegram.messenger.R.string.EnterPassword));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.codeField = editTextBoldCursor;
editTextBoldCursor.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setBackground(null);
this.codeField.setImeOptions(268435461);
this.codeField.setTextSize(1, 18.0f);
this.codeField.setMaxLines(1);
int dp = AndroidUtilities.dp(16.0f);
this.codeField.setPadding(dp, dp, dp, dp);
this.codeField.setInputType(129);
this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
this.codeField.setTypeface(Typeface.DEFAULT);
this.codeField.setGravity(!LocaleController.isRTL ? 5 : 3);
this.codeField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$0(view, z);
}
});
this.outlineCodeField.attachEditText(this.codeField);
this.outlineCodeField.addView(this.codeField, LayoutHelper.createFrame(-1, -2, 48));
this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i2, KeyEvent keyEvent) {
boolean lambda$new$1;
lambda$new$1 = LoginActivity.LoginActivityPasswordView.this.lambda$new$1(textView3, i2, keyEvent);
return lambda$new$1;
}
});
addView(this.outlineCodeField, LayoutHelper.createLinear(-1, -2, 1, 16, 32, 16, 0));
TextView textView3 = new TextView(context);
this.cancelButton = textView3;
textView3.setGravity(19);
this.cancelButton.setText(LocaleController.getString("ForgotPassword", org.telegram.messenger.R.string.ForgotPassword));
this.cancelButton.setTextSize(1, 15.0f);
this.cancelButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.cancelButton.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), 0);
FrameLayout frameLayout2 = new FrameLayout(context);
frameLayout2.addView(this.cancelButton, LayoutHelper.createFrame(-1, Build.VERSION.SDK_INT < 21 ? 56 : 60, 80, 0.0f, 0.0f, 0.0f, 32.0f));
addView(frameLayout2, LayoutHelper.createLinear(-1, -1, 80));
VerticalPositionAutoAnimator.attach(this.cancelButton);
this.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$6(context, view);
}
});
}
}
i = 8;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView4 = new TextView(context);
this.titleView = textView4;
textView4.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(org.telegram.messenger.R.string.YourPasswordHeader));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView22 = new TextView(context);
this.confirmTextView = textView22;
textView22.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(1);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString(org.telegram.messenger.R.string.LoginPasswordTextShort));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 12, 8, 12, 0));
OutlineTextContainerView outlineTextContainerView2 = new OutlineTextContainerView(context);
this.outlineCodeField = outlineTextContainerView2;
outlineTextContainerView2.setText(LocaleController.getString(org.telegram.messenger.R.string.EnterPassword));
EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
this.codeField = editTextBoldCursor2;
editTextBoldCursor2.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setBackground(null);
this.codeField.setImeOptions(268435461);
this.codeField.setTextSize(1, 18.0f);
this.codeField.setMaxLines(1);
int dp2 = AndroidUtilities.dp(16.0f);
this.codeField.setPadding(dp2, dp2, dp2, dp2);
this.codeField.setInputType(129);
this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
this.codeField.setTypeface(Typeface.DEFAULT);
this.codeField.setGravity(!LocaleController.isRTL ? 5 : 3);
this.codeField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$0(view, z);
}
});
this.outlineCodeField.attachEditText(this.codeField);
this.outlineCodeField.addView(this.codeField, LayoutHelper.createFrame(-1, -2, 48));
this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView32, int i2, KeyEvent keyEvent) {
boolean lambda$new$1;
lambda$new$1 = LoginActivity.LoginActivityPasswordView.this.lambda$new$1(textView32, i2, keyEvent);
return lambda$new$1;
}
});
addView(this.outlineCodeField, LayoutHelper.createLinear(-1, -2, 1, 16, 32, 16, 0));
TextView textView32 = new TextView(context);
this.cancelButton = textView32;
textView32.setGravity(19);
this.cancelButton.setText(LocaleController.getString("ForgotPassword", org.telegram.messenger.R.string.ForgotPassword));
this.cancelButton.setTextSize(1, 15.0f);
this.cancelButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.cancelButton.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), 0);
FrameLayout frameLayout22 = new FrameLayout(context);
frameLayout22.addView(this.cancelButton, LayoutHelper.createFrame(-1, Build.VERSION.SDK_INT < 21 ? 56 : 60, 80, 0.0f, 0.0f, 0.0f, 32.0f));
addView(frameLayout22, LayoutHelper.createLinear(-1, -1, 80));
VerticalPositionAutoAnimator.attach(this.cancelButton);
this.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$6(context, view);
}
});
}
public void lambda$new$0(View view, boolean z) {
this.outlineCodeField.animateSelection(z ? 1.0f : 0.0f);
}
public boolean lambda$new$1(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
lambda$onNextPressed$14(null);
return true;
}
public void lambda$new$6(Context context, View view) {
if (LoginActivity.this.radialProgressView.getTag() != null) {
return;
}
if (this.currentPassword.has_recovery) {
LoginActivity.this.needShowProgress(0);
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_auth_requestPasswordRecovery(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$4(tLObject, tLRPC$TL_error);
}
}, 10);
} else {
AndroidUtilities.hideKeyboard(this.codeField);
new AlertDialog.Builder(context).setTitle(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle)).setMessage(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailText)).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Close), null).setNegativeButton(LocaleController.getString(org.telegram.messenger.R.string.ResetAccount), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$5(dialogInterface, i);
}
}).show();
}
}
public void lambda$new$4(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$new$3(tLRPC$TL_error, tLObject);
}
});
}
public void lambda$new$3(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject) {
String formatPluralString;
LoginActivity.this.needHideProgress(false);
if (tLRPC$TL_error == null) {
final TLRPC$TL_auth_passwordRecovery tLRPC$TL_auth_passwordRecovery = (TLRPC$TL_auth_passwordRecovery) tLObject;
if (LoginActivity.this.getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
String str = tLRPC$TL_auth_passwordRecovery.email_pattern;
SpannableStringBuilder valueOf = SpannableStringBuilder.valueOf(str);
int indexOf = str.indexOf(42);
int lastIndexOf = str.lastIndexOf(42);
if (indexOf != lastIndexOf && indexOf != -1 && lastIndexOf != -1) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 256;
textStyleRun.start = indexOf;
int i = lastIndexOf + 1;
textStyleRun.end = i;
valueOf.setSpan(new TextStyleSpan(textStyleRun), indexOf, i, 0);
}
builder.setMessage(AndroidUtilities.formatSpannable(LocaleController.getString(org.telegram.messenger.R.string.RestoreEmailSent), valueOf));
builder.setTitle(LocaleController.getString("RestoreEmailSentTitle", org.telegram.messenger.R.string.RestoreEmailSentTitle));
builder.setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Continue), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LoginActivity.LoginActivityPasswordView.this.lambda$new$2(tLRPC$TL_auth_passwordRecovery, dialogInterface, i2);
}
});
Dialog showDialog = LoginActivity.this.showDialog(builder.create());
if (showDialog != null) {
showDialog.setCanceledOnTouchOutside(false);
showDialog.setCancelable(false);
return;
}
return;
}
if (!tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
int intValue = Utilities.parseInt((CharSequence) tLRPC$TL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.WrongCodeTitle), LocaleController.formatString("FloodWaitTime", org.telegram.messenger.R.string.FloodWaitTime, formatPluralString));
}
public void lambda$new$2(TLRPC$TL_auth_passwordRecovery tLRPC$TL_auth_passwordRecovery, DialogInterface dialogInterface, int i) {
Bundle bundle = new Bundle();
bundle.putString("email_unconfirmed_pattern", tLRPC$TL_auth_passwordRecovery.email_pattern);
bundle.putString("password", this.passwordString);
bundle.putString("requestPhone", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("phoneCode", this.phoneCode);
LoginActivity.this.setPage(7, true, bundle, false);
}
public void lambda$new$5(DialogInterface dialogInterface, int i) {
LoginActivity.this.tryResetAccount(this.requestPhone, this.phoneHash, this.phoneCode);
}
@Override
public void updateColors() {
TextView textView = this.titleView;
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i));
this.confirmTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.codeField.setTextColor(Theme.getColor(i));
this.codeField.setCursorColor(Theme.getColor(i));
this.codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.outlineCodeField.updateColor();
}
@Override
public String getHeaderName() {
return LocaleController.getString("LoginPassword", org.telegram.messenger.R.string.LoginPassword);
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
if (bundle.isEmpty()) {
AndroidUtilities.hideKeyboard(this.codeField);
return;
}
this.codeField.setText("");
this.currentParams = bundle;
String string = bundle.getString("password");
this.passwordString = string;
if (string != null) {
SerializedData serializedData = new SerializedData(Utilities.hexToBytes(string));
this.currentPassword = TLRPC$account_Password.TLdeserialize(serializedData, serializedData.readInt32(false), false);
}
this.requestPhone = bundle.getString("phoneFormated");
this.phoneHash = bundle.getString("phoneHash");
this.phoneCode = bundle.getString("code");
TLRPC$account_Password tLRPC$account_Password = this.currentPassword;
if (tLRPC$account_Password != null && !TextUtils.isEmpty(tLRPC$account_Password.hint)) {
this.codeField.setHint(this.currentPassword.hint);
} else {
this.codeField.setHint((CharSequence) null);
}
}
private void onPasscodeError(boolean z) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
if (z) {
this.codeField.setText("");
}
LoginActivity.this.onFieldError(this.outlineCodeField, true);
}
@Override
public void lambda$onNextPressed$14(String str) {
if (this.nextPressed) {
return;
}
final String obj = this.codeField.getText().toString();
if (obj.length() == 0) {
onPasscodeError(false);
return;
}
this.nextPressed = true;
LoginActivity.this.needShowProgress(0);
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$12(obj);
}
});
}
public void lambda$onNextPressed$12(String str) {
TLRPC$PasswordKdfAlgo tLRPC$PasswordKdfAlgo = this.currentPassword.current_algo;
boolean z = tLRPC$PasswordKdfAlgo instanceof TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow;
byte[] x = z ? SRPHelper.getX(AndroidUtilities.getStringBytes(str), (TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) tLRPC$PasswordKdfAlgo) : null;
TLRPC$TL_auth_checkPassword tLRPC$TL_auth_checkPassword = new TLRPC$TL_auth_checkPassword();
RequestDelegate requestDelegate = new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$11(tLObject, tLRPC$TL_error);
}
};
if (z) {
TLRPC$account_Password tLRPC$account_Password = this.currentPassword;
TLRPC$TL_inputCheckPasswordSRP startCheck = SRPHelper.startCheck(x, tLRPC$account_Password.srp_id, tLRPC$account_Password.srp_B, (TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) tLRPC$PasswordKdfAlgo);
tLRPC$TL_auth_checkPassword.password = startCheck;
if (startCheck != null) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_checkPassword, requestDelegate, 10);
return;
}
TLRPC$TL_error tLRPC$TL_error = new TLRPC$TL_error();
tLRPC$TL_error.text = "PASSWORD_HASH_INVALID";
requestDelegate.run(null, tLRPC$TL_error);
}
}
public void lambda$onNextPressed$11(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$10(tLRPC$TL_error, tLObject);
}
});
}
public void lambda$onNextPressed$10(TLRPC$TL_error tLRPC$TL_error, final TLObject tLObject) {
String formatPluralString;
this.nextPressed = false;
if (tLRPC$TL_error != null && "SRP_ID_INVALID".equals(tLRPC$TL_error.text)) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_account_getPassword(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC$TL_error tLRPC$TL_error2) {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$8(tLObject2, tLRPC$TL_error2);
}
}, 8);
return;
}
if (tLObject instanceof TLRPC$TL_auth_authorization) {
LoginActivity.this.showDoneButton(false, true);
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$9(tLObject);
}
}, 150L);
return;
}
LoginActivity.this.needHideProgress(false);
if (tLRPC$TL_error.text.equals("PASSWORD_HASH_INVALID")) {
onPasscodeError(true);
return;
}
if (!tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
int intValue = Utilities.parseInt((CharSequence) tLRPC$TL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.formatString("FloodWaitTime", org.telegram.messenger.R.string.FloodWaitTime, formatPluralString));
}
public void lambda$onNextPressed$8(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$onNextPressed$7(tLRPC$TL_error, tLObject);
}
});
}
public void lambda$onNextPressed$7(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject) {
if (tLRPC$TL_error == null) {
this.currentPassword = (TLRPC$account_Password) tLObject;
lambda$onNextPressed$14(null);
}
}
public void lambda$onNextPressed$9(TLObject tLObject) {
LoginActivity.this.needHideProgress(false, false);
AndroidUtilities.hideKeyboard(this.codeField);
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLObject);
}
@Override
public boolean onBackPressed(boolean z) {
this.nextPressed = false;
LoginActivity.this.needHideProgress(true);
this.currentParams = null;
return true;
}
@Override
public void onShow() {
super.onShow();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.lambda$onShow$13();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$13() {
EditTextBoldCursor editTextBoldCursor = this.codeField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.codeField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
LoginActivity.this.showKeyboard(this.codeField);
this.lockImageView.getAnimatedDrawable().setCurrentFrame(0, false);
this.lockImageView.playAnimation();
}
}
@Override
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
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 TextView titleView;
private RLottieImageView waitImageView;
private int waitTime;
private Boolean wasResetButtonActive;
@Override
public boolean needBackButton() {
return true;
}
public LoginActivityResetWaitView(Context context) {
super(context);
setOrientation(1);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setGravity(17);
FrameLayout frameLayout = new FrameLayout(context);
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.waitImageView = rLottieImageView;
rLottieImageView.setAutoRepeat(true);
this.waitImageView.setAnimation(org.telegram.messenger.R.raw.sandclock, 120, 120);
frameLayout.addView(this.waitImageView, LayoutHelper.createFrame(120, 120, 1));
Point point = AndroidUtilities.displaySize;
frameLayout.setVisibility((point.x <= point.y || AndroidUtilities.isTablet()) ? 0 : 8);
linearLayout.addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
TextView textView2 = this.titleView;
int i = org.telegram.messenger.R.string.ResetAccount;
textView2.setText(LocaleController.getString(i));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
linearLayout.addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView3 = new TextView(context);
this.confirmTextView = textView3;
textView3.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(1);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
linearLayout.addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 12, 8, 12, 0));
addView(linearLayout, LayoutHelper.createLinear(-1, 0, 1.0f));
TextView textView4 = new TextView(context);
this.resetAccountText = textView4;
textView4.setGravity(1);
this.resetAccountText.setText(LocaleController.getString("ResetAccountStatus", org.telegram.messenger.R.string.ResetAccountStatus));
this.resetAccountText.setTextSize(1, 14.0f);
this.resetAccountText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.resetAccountText, LayoutHelper.createLinear(-2, -2, 49, 0, 24, 0, 0));
TextView textView5 = new TextView(context);
this.resetAccountTime = textView5;
textView5.setGravity(1);
this.resetAccountTime.setTextSize(1, 20.0f);
this.resetAccountTime.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.resetAccountTime.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.resetAccountTime, LayoutHelper.createLinear(-2, -2, 1, 0, 8, 0, 0));
TextView textView6 = new TextView(context);
this.resetAccountButton = textView6;
textView6.setGravity(17);
this.resetAccountButton.setText(LocaleController.getString(i));
this.resetAccountButton.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.resetAccountButton.setTextSize(1, 15.0f);
this.resetAccountButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.resetAccountButton.setPadding(AndroidUtilities.dp(34.0f), 0, AndroidUtilities.dp(34.0f), 0);
this.resetAccountButton.setTextColor(-1);
addView(this.resetAccountButton, LayoutHelper.createLinear(-1, 50, 1, 16, 32, 16, 48));
this.resetAccountButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityResetWaitView.this.lambda$new$3(view);
}
});
}
public void lambda$new$3(View view) {
if (LoginActivity.this.radialProgressView.getTag() != null) {
return;
}
LoginActivity loginActivity = LoginActivity.this;
loginActivity.showDialog(new AlertDialog.Builder(loginActivity.getParentActivity()).setTitle(LocaleController.getString("ResetMyAccountWarning", org.telegram.messenger.R.string.ResetMyAccountWarning)).setMessage(LocaleController.getString("ResetMyAccountWarningText", org.telegram.messenger.R.string.ResetMyAccountWarningText)).setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", org.telegram.messenger.R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityResetWaitView.this.lambda$new$2(dialogInterface, i);
}
}).setNegativeButton(LocaleController.getString("Cancel", org.telegram.messenger.R.string.Cancel), null).create());
}
public void lambda$new$2(DialogInterface dialogInterface, int i) {
LoginActivity.this.needShowProgress(0);
TLRPC$TL_account_deleteAccount tLRPC$TL_account_deleteAccount = new TLRPC$TL_account_deleteAccount();
tLRPC$TL_account_deleteAccount.reason = "Forgot password";
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_account_deleteAccount, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityResetWaitView.this.lambda$new$1(tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$new$1(TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityResetWaitView.this.lambda$new$0(tLRPC$TL_error);
}
});
}
public void lambda$new$0(TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.this.needHideProgress(false);
if (tLRPC$TL_error == null) {
if (this.requestPhone == null || this.phoneHash == null || this.phoneCode == null) {
LoginActivity.this.setPage(0, true, null, true);
return;
}
Bundle bundle = new Bundle();
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", this.phoneCode);
LoginActivity.this.setPage(5, true, bundle, false);
return;
}
if (tLRPC$TL_error.text.equals("2FA_RECENT_CONFIRM")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ResetAccountCancelledAlert", org.telegram.messenger.R.string.ResetAccountCancelledAlert));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
}
}
@Override
public void updateColors() {
TextView textView = this.titleView;
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i));
this.confirmTextView.setTextColor(Theme.getColor(i));
this.resetAccountText.setTextColor(Theme.getColor(i));
this.resetAccountTime.setTextColor(Theme.getColor(i));
this.resetAccountButton.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6.0f), Theme.getColor(Theme.key_changephoneinfo_image2), Theme.getColor(Theme.key_chats_actionPressedBackground)));
}
@Override
public String getHeaderName() {
return LocaleController.getString("ResetAccount", org.telegram.messenger.R.string.ResetAccount);
}
public void updateTimeText() {
int max = Math.max(0, this.waitTime - (ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).getCurrentTime() - this.startTime));
int i = max / 86400;
int round = Math.round(max / 86400.0f);
int i2 = max / 3600;
int i3 = (max / 60) % 60;
int i4 = max % 60;
if (i >= 2) {
this.resetAccountTime.setText(LocaleController.formatPluralString("Days", round, new Object[0]));
} else {
this.resetAccountTime.setText(String.format(Locale.getDefault(), "%02d:%02d:%02d", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4)));
}
boolean z = max == 0;
Boolean bool = this.wasResetButtonActive;
if (bool == null || bool.booleanValue() != z) {
if (!z) {
this.waitImageView.setAutoRepeat(true);
if (!this.waitImageView.isPlaying()) {
this.waitImageView.playAnimation();
}
} else {
this.waitImageView.getAnimatedDrawable().setAutoRepeat(0);
}
this.resetAccountTime.setVisibility(z ? 4 : 0);
this.resetAccountText.setVisibility(z ? 4 : 0);
this.resetAccountButton.setVisibility(z ? 0 : 4);
this.wasResetButtonActive = Boolean.valueOf(z);
}
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
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");
this.confirmTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("ResetAccountInfo", org.telegram.messenger.R.string.ResetAccountInfo, LocaleController.addNbsp(PhoneFormat.getInstance().format("+" + this.requestPhone)))));
updateTimeText();
Runnable runnable = new Runnable() {
@Override
public void run() {
if (LoginActivityResetWaitView.this.timeRunnable != this) {
return;
}
LoginActivityResetWaitView.this.updateTimeText();
AndroidUtilities.runOnUIThread(LoginActivityResetWaitView.this.timeRunnable, 1000L);
}
};
this.timeRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 1000L);
}
@Override
public boolean onBackPressed(boolean z) {
LoginActivity.this.needHideProgress(true);
AndroidUtilities.cancelRunOnUIThread(this.timeRunnable);
this.timeRunnable = null;
this.currentParams = null;
return true;
}
@Override
public void saveStateParams(Bundle bundle) {
Bundle bundle2 = this.currentParams;
if (bundle2 != null) {
bundle.putBundle("resetview_params", bundle2);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
Bundle bundle2 = bundle.getBundle("resetview_params");
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
}
}
public class LoginActivitySetupEmail extends SlideView {
private Bundle currentParams;
private EditTextBoldCursor emailField;
private OutlineTextContainerView emailOutlineView;
private String emailPhone;
private GoogleSignInAccount googleAccount;
private RLottieImageView inboxImageView;
private LoginOrView loginOrView;
private boolean nextPressed;
private String phone;
private String phoneHash;
private String requestPhone;
private TextView signInWithGoogleView;
private TextView subtitleView;
private TextView titleView;
@Override
public boolean needBackButton() {
return true;
}
public LoginActivitySetupEmail(Context context) {
super(context);
int i;
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.inboxImageView = rLottieImageView;
rLottieImageView.setAnimation(org.telegram.messenger.R.raw.tsv_setup_mail, 120, 120);
this.inboxImageView.setAutoRepeat(false);
frameLayout.addView(this.inboxImageView, LayoutHelper.createFrame(120, 120, 1));
if (!AndroidUtilities.isSmallScreen()) {
Point point = AndroidUtilities.displaySize;
if (point.x <= point.y || AndroidUtilities.isTablet()) {
i = 0;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.EnterNewEmail : org.telegram.messenger.R.string.AddEmailTitle));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView2 = new TextView(context);
this.subtitleView = textView2;
textView2.setTextSize(1, 14.0f);
this.subtitleView.setGravity(17);
this.subtitleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.subtitleView.setText(LocaleController.getString(org.telegram.messenger.R.string.AddEmailSubtitle));
addView(this.subtitleView, LayoutHelper.createLinear(-2, -2, 1, 32, 8, 32, 0));
OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context);
this.emailOutlineView = outlineTextContainerView;
outlineTextContainerView.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.YourNewEmail : org.telegram.messenger.R.string.YourEmail));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.emailField = editTextBoldCursor;
editTextBoldCursor.setCursorSize(AndroidUtilities.dp(20.0f));
this.emailField.setCursorWidth(1.5f);
this.emailField.setImeOptions(268435461);
this.emailField.setTextSize(1, 17.0f);
this.emailField.setMaxLines(1);
this.emailField.setInputType(33);
this.emailField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.LoginActivitySetupEmail.this.lambda$new$0(view, z);
}
});
this.emailField.setBackground(null);
this.emailField.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.emailOutlineView.attachEditText(this.emailField);
this.emailOutlineView.addView(this.emailField, LayoutHelper.createFrame(-1, -2, 48));
this.emailField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i2, KeyEvent keyEvent) {
boolean lambda$new$1;
lambda$new$1 = LoginActivity.LoginActivitySetupEmail.this.lambda$new$1(textView3, i2, keyEvent);
return lambda$new$1;
}
});
addView(this.emailOutlineView, LayoutHelper.createLinear(-1, 58, 16.0f, 24.0f, 16.0f, 0.0f));
TextView textView3 = new TextView(context);
this.signInWithGoogleView = textView3;
textView3.setGravity(3);
this.signInWithGoogleView.setTextSize(1, 14.0f);
this.signInWithGoogleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.signInWithGoogleView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.signInWithGoogleView.setMaxLines(2);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("d ");
Drawable drawable = ContextCompat.getDrawable(context, org.telegram.messenger.R.drawable.googleg_standard_color_18);
drawable.setBounds(0, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(18.0f), AndroidUtilities.dp(27.0f));
spannableStringBuilder.setSpan(new ImageSpan(drawable, 0), 0, 1, 33);
spannableStringBuilder.setSpan(new ReplacementSpan(this, LoginActivity.this) {
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i2, int i3, float f, int i4, int i5, int i6, Paint paint) {
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i2, int i3, Paint.FontMetricsInt fontMetricsInt) {
return AndroidUtilities.dp(12.0f);
}
}, 1, 2, 33);
spannableStringBuilder.append((CharSequence) LocaleController.getString(org.telegram.messenger.R.string.SignInWithGoogle));
this.signInWithGoogleView.setText(spannableStringBuilder);
this.loginOrView = new LoginOrView(context);
addView(new Space(context), LayoutHelper.createLinear(0, 0, 1.0f));
FrameLayout frameLayout2 = new FrameLayout(context);
frameLayout2.addView(this.signInWithGoogleView, LayoutHelper.createFrame(-2, -2.0f, 83, 0.0f, 0.0f, 0.0f, 24.0f));
frameLayout2.addView(this.loginOrView, LayoutHelper.createFrame(-2, 16.0f, 83, 0.0f, 0.0f, 0.0f, 70.0f));
this.loginOrView.setMeasureAfter(this.signInWithGoogleView);
addView(frameLayout2, LayoutHelper.createLinear(-1, -2));
VerticalPositionAutoAnimator.attach(frameLayout2);
frameLayout2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySetupEmail.this.lambda$new$3(view);
}
});
}
}
i = 8;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView4 = new TextView(context);
this.titleView = textView4;
textView4.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.EnterNewEmail : org.telegram.messenger.R.string.AddEmailTitle));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView22 = new TextView(context);
this.subtitleView = textView22;
textView22.setTextSize(1, 14.0f);
this.subtitleView.setGravity(17);
this.subtitleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.subtitleView.setText(LocaleController.getString(org.telegram.messenger.R.string.AddEmailSubtitle));
addView(this.subtitleView, LayoutHelper.createLinear(-2, -2, 1, 32, 8, 32, 0));
OutlineTextContainerView outlineTextContainerView2 = new OutlineTextContainerView(context);
this.emailOutlineView = outlineTextContainerView2;
outlineTextContainerView2.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.YourNewEmail : org.telegram.messenger.R.string.YourEmail));
EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
this.emailField = editTextBoldCursor2;
editTextBoldCursor2.setCursorSize(AndroidUtilities.dp(20.0f));
this.emailField.setCursorWidth(1.5f);
this.emailField.setImeOptions(268435461);
this.emailField.setTextSize(1, 17.0f);
this.emailField.setMaxLines(1);
this.emailField.setInputType(33);
this.emailField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.LoginActivitySetupEmail.this.lambda$new$0(view, z);
}
});
this.emailField.setBackground(null);
this.emailField.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.emailOutlineView.attachEditText(this.emailField);
this.emailOutlineView.addView(this.emailField, LayoutHelper.createFrame(-1, -2, 48));
this.emailField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView32, int i2, KeyEvent keyEvent) {
boolean lambda$new$1;
lambda$new$1 = LoginActivity.LoginActivitySetupEmail.this.lambda$new$1(textView32, i2, keyEvent);
return lambda$new$1;
}
});
addView(this.emailOutlineView, LayoutHelper.createLinear(-1, 58, 16.0f, 24.0f, 16.0f, 0.0f));
TextView textView32 = new TextView(context);
this.signInWithGoogleView = textView32;
textView32.setGravity(3);
this.signInWithGoogleView.setTextSize(1, 14.0f);
this.signInWithGoogleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.signInWithGoogleView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.signInWithGoogleView.setMaxLines(2);
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder("d ");
Drawable drawable2 = ContextCompat.getDrawable(context, org.telegram.messenger.R.drawable.googleg_standard_color_18);
drawable2.setBounds(0, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(18.0f), AndroidUtilities.dp(27.0f));
spannableStringBuilder2.setSpan(new ImageSpan(drawable2, 0), 0, 1, 33);
spannableStringBuilder2.setSpan(new ReplacementSpan(this, LoginActivity.this) {
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i2, int i3, float f, int i4, int i5, int i6, Paint paint) {
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i2, int i3, Paint.FontMetricsInt fontMetricsInt) {
return AndroidUtilities.dp(12.0f);
}
}, 1, 2, 33);
spannableStringBuilder2.append((CharSequence) LocaleController.getString(org.telegram.messenger.R.string.SignInWithGoogle));
this.signInWithGoogleView.setText(spannableStringBuilder2);
this.loginOrView = new LoginOrView(context);
addView(new Space(context), LayoutHelper.createLinear(0, 0, 1.0f));
FrameLayout frameLayout22 = new FrameLayout(context);
frameLayout22.addView(this.signInWithGoogleView, LayoutHelper.createFrame(-2, -2.0f, 83, 0.0f, 0.0f, 0.0f, 24.0f));
frameLayout22.addView(this.loginOrView, LayoutHelper.createFrame(-2, 16.0f, 83, 0.0f, 0.0f, 0.0f, 70.0f));
this.loginOrView.setMeasureAfter(this.signInWithGoogleView);
addView(frameLayout22, LayoutHelper.createLinear(-1, -2));
VerticalPositionAutoAnimator.attach(frameLayout22);
frameLayout22.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySetupEmail.this.lambda$new$3(view);
}
});
}
public void lambda$new$0(View view, boolean z) {
this.emailOutlineView.animateSelection(z ? 1.0f : 0.0f);
}
public boolean lambda$new$1(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
lambda$onNextPressed$14(null);
return true;
}
public void lambda$new$3(View view) {
NotificationCenter.getGlobalInstance().addObserver(new NotificationCenter.NotificationCenterDelegate() {
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
int intValue = ((Integer) objArr[0]).intValue();
((Integer) objArr[1]).intValue();
Intent intent = (Intent) objArr[2];
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.onActivityResultReceived);
if (intValue == 200) {
try {
LoginActivitySetupEmail.this.googleAccount = GoogleSignIn.getSignedInAccountFromIntent(intent).getResult(ApiException.class);
LoginActivitySetupEmail.this.lambda$onNextPressed$14(null);
} catch (ApiException e) {
FileLog.e(e);
}
}
}
}, NotificationCenter.onActivityResultReceived);
final GoogleSignInClient client = GoogleSignIn.getClient(getContext(), new GoogleSignInOptions.Builder().requestIdToken(BuildVars.GOOGLE_AUTH_CLIENT_ID).requestEmail().build());
client.signOut().addOnCompleteListener(new OnCompleteListener() {
@Override
public final void onComplete(Task task) {
LoginActivity.LoginActivitySetupEmail.this.lambda$new$2(client, task);
}
});
}
public void lambda$new$2(GoogleSignInClient googleSignInClient, Task task) {
LoginActivity.this.getParentActivity().startActivityForResult(googleSignInClient.getSignInIntent(), 200);
}
@Override
public void updateColors() {
TextView textView = this.titleView;
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i));
this.subtitleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.emailField.setTextColor(Theme.getColor(i));
this.signInWithGoogleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.loginOrView.updateColors();
this.emailOutlineView.invalidate();
}
@Override
public String getHeaderName() {
return LocaleController.getString("AddEmailTitle", org.telegram.messenger.R.string.AddEmailTitle);
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
this.emailField.setText("");
this.currentParams = bundle;
this.phone = bundle.getString("phone");
this.emailPhone = this.currentParams.getString("ephone");
this.requestPhone = this.currentParams.getString("phoneFormated");
this.phoneHash = this.currentParams.getString("phoneHash");
int i = (bundle.getBoolean("googleSignInAllowed") && PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices()) ? 0 : 8;
this.loginOrView.setVisibility(i);
this.signInWithGoogleView.setVisibility(i);
LoginActivity.this.showKeyboard(this.emailField);
this.emailField.requestFocus();
}
private void onPasscodeError(boolean z) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
try {
this.emailOutlineView.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
if (z) {
this.emailField.setText("");
}
this.emailField.requestFocus();
LoginActivity.this.onFieldError(this.emailOutlineView, true);
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySetupEmail.this.lambda$onPasscodeError$4();
}
}, 300L);
}
public void lambda$onPasscodeError$4() {
this.emailField.requestFocus();
}
@Override
public void lambda$onNextPressed$14(String str) {
if (this.nextPressed) {
return;
}
GoogleSignInAccount googleSignInAccount = this.googleAccount;
String email = googleSignInAccount != null ? googleSignInAccount.getEmail() : this.emailField.getText().toString();
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("email", email);
bundle.putBoolean("setup", true);
if (this.googleAccount != null) {
final TLRPC$TL_account_verifyEmail tLRPC$TL_account_verifyEmail = new TLRPC$TL_account_verifyEmail();
if (LoginActivity.this.activityMode == 3) {
tLRPC$TL_account_verifyEmail.purpose = new TLRPC$TL_emailVerifyPurposeLoginChange();
} else {
TLRPC$TL_emailVerifyPurposeLoginSetup tLRPC$TL_emailVerifyPurposeLoginSetup = new TLRPC$TL_emailVerifyPurposeLoginSetup();
tLRPC$TL_emailVerifyPurposeLoginSetup.phone_number = this.requestPhone;
tLRPC$TL_emailVerifyPurposeLoginSetup.phone_code_hash = this.phoneHash;
tLRPC$TL_account_verifyEmail.purpose = tLRPC$TL_emailVerifyPurposeLoginSetup;
}
TLRPC$TL_emailVerificationGoogle tLRPC$TL_emailVerificationGoogle = new TLRPC$TL_emailVerificationGoogle();
tLRPC$TL_emailVerificationGoogle.token = this.googleAccount.getIdToken();
tLRPC$TL_account_verifyEmail.verification = tLRPC$TL_emailVerificationGoogle;
this.googleAccount = null;
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_account_verifyEmail, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySetupEmail.this.lambda$onNextPressed$6(bundle, tLRPC$TL_account_verifyEmail, tLObject, tLRPC$TL_error);
}
}, 10);
return;
}
if (TextUtils.isEmpty(email)) {
onPasscodeError(false);
return;
}
this.nextPressed = true;
LoginActivity.this.needShowProgress(0);
final TLRPC$TL_account_sendVerifyEmailCode tLRPC$TL_account_sendVerifyEmailCode = new TLRPC$TL_account_sendVerifyEmailCode();
if (LoginActivity.this.activityMode == 3) {
tLRPC$TL_account_sendVerifyEmailCode.purpose = new TLRPC$TL_emailVerifyPurposeLoginChange();
} else {
TLRPC$TL_emailVerifyPurposeLoginSetup tLRPC$TL_emailVerifyPurposeLoginSetup2 = new TLRPC$TL_emailVerifyPurposeLoginSetup();
tLRPC$TL_emailVerifyPurposeLoginSetup2.phone_number = this.requestPhone;
tLRPC$TL_emailVerifyPurposeLoginSetup2.phone_code_hash = this.phoneHash;
tLRPC$TL_account_sendVerifyEmailCode.purpose = tLRPC$TL_emailVerifyPurposeLoginSetup2;
}
tLRPC$TL_account_sendVerifyEmailCode.email = email;
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_account_sendVerifyEmailCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivitySetupEmail.this.lambda$onNextPressed$8(bundle, tLRPC$TL_account_sendVerifyEmailCode, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$onNextPressed$6(final Bundle bundle, final TLRPC$TL_account_verifyEmail tLRPC$TL_account_verifyEmail, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySetupEmail.this.lambda$onNextPressed$5(tLObject, bundle, tLRPC$TL_error, tLRPC$TL_account_verifyEmail);
}
});
}
public void lambda$onNextPressed$5(TLObject tLObject, Bundle bundle, TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_account_verifyEmail tLRPC$TL_account_verifyEmail) {
if ((tLObject instanceof TLRPC$TL_account_emailVerified) && LoginActivity.this.activityMode == 3) {
LoginActivity.this.finishFragment();
LoginActivity.this.emailChangeFinishCallback.run();
return;
}
if (tLObject instanceof TLRPC$TL_account_emailVerifiedLogin) {
TLRPC$TL_account_emailVerifiedLogin tLRPC$TL_account_emailVerifiedLogin = (TLRPC$TL_account_emailVerifiedLogin) tLObject;
bundle.putString("email", tLRPC$TL_account_emailVerifiedLogin.email);
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, tLRPC$TL_account_emailVerifiedLogin.sent_code);
} else if (tLRPC$TL_error != null) {
if (tLRPC$TL_error.text.contains("EMAIL_NOT_ALLOWED")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString(org.telegram.messenger.R.string.EmailNotAllowed));
} else if (tLRPC$TL_error.text.contains("EMAIL_TOKEN_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString(org.telegram.messenger.R.string.EmailTokenInvalid));
} else if (tLRPC$TL_error.code != -1000) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_account_verifyEmail, new Object[0]);
}
}
}
public void lambda$onNextPressed$8(final Bundle bundle, final TLRPC$TL_account_sendVerifyEmailCode tLRPC$TL_account_sendVerifyEmailCode, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySetupEmail.this.lambda$onNextPressed$7(tLObject, bundle, tLRPC$TL_error, tLRPC$TL_account_sendVerifyEmailCode);
}
});
}
public void lambda$onNextPressed$7(TLObject tLObject, Bundle bundle, TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_account_sendVerifyEmailCode tLRPC$TL_account_sendVerifyEmailCode) {
LoginActivity.this.needHideProgress(false);
this.nextPressed = false;
if (tLObject instanceof TLRPC$TL_account_sentEmailCode) {
LoginActivity.this.fillNextCodeParams(bundle, (TLRPC$TL_account_sentEmailCode) tLObject);
return;
}
String str = tLRPC$TL_error.text;
if (str != null) {
if (str.contains("EMAIL_INVALID")) {
onPasscodeError(false);
return;
}
if (tLRPC$TL_error.text.contains("EMAIL_NOT_ALLOWED")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString(org.telegram.messenger.R.string.EmailNotAllowed));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_PASSWORD_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_NUMBER_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("PhoneNumberFlood", org.telegram.messenger.R.string.PhoneNumberFlood));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", org.telegram.messenger.R.string.InvalidCode));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else if (tLRPC$TL_error.code != -1000) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_account_sendVerifyEmailCode, this.requestPhone);
}
}
}
@Override
public void onShow() {
super.onShow();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySetupEmail.this.lambda$onShow$9();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$9() {
this.inboxImageView.getAnimatedDrawable().setCurrentFrame(0, false);
this.inboxImageView.playAnimation();
this.emailField.requestFocus();
AndroidUtilities.showKeyboard(this.emailField);
}
@Override
public void saveStateParams(Bundle bundle) {
String obj = this.emailField.getText().toString();
if (obj != null && obj.length() != 0) {
bundle.putString("emailsetup_email", obj);
}
Bundle bundle2 = this.currentParams;
if (bundle2 != null) {
bundle.putBundle("emailsetup_params", bundle2);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
Bundle bundle2 = bundle.getBundle("emailsetup_params");
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
String string = bundle.getString("emailsetup_email");
if (string != null) {
this.emailField.setText(string);
}
}
}
public class LoginActivityEmailCodeView extends SlideView {
private FrameLayout cantAccessEmailFrameLayout;
private TextView cantAccessEmailView;
private CodeFieldContainer codeFieldContainer;
private TextView confirmTextView;
private Bundle currentParams;
private String email;
private String emailPhone;
private TextView emailResetInView;
private Runnable errorColorTimeout;
private ViewSwitcher errorViewSwitcher;
private GoogleSignInAccount googleAccount;
private RLottieImageView inboxImageView;
private boolean isFromSetup;
private boolean isSetup;
private int length;
private LoginOrView loginOrView;
private boolean nextPressed;
private String phone;
private String phoneHash;
private boolean postedErrorColorTimeout;
private String requestPhone;
private boolean requestingEmailReset;
private Runnable resendCodeTimeout;
private TextView resendCodeView;
private FrameLayout resendFrameLayout;
private int resetAvailablePeriod;
private int resetPendingDate;
private boolean resetRequestPending;
private TextView signInWithGoogleView;
private TextView titleView;
private Runnable updateResetPendingDateCallback;
private TextView wrongCodeView;
@Override
public boolean hasCustomKeyboard() {
return true;
}
@Override
public boolean needBackButton() {
return true;
}
public void lambda$new$0() {
boolean z = false;
this.postedErrorColorTimeout = false;
int i = 0;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
if (this.errorViewSwitcher.getCurrentView() != this.resendFrameLayout) {
this.errorViewSwitcher.showNext();
FrameLayout frameLayout = this.cantAccessEmailFrameLayout;
if (this.resendCodeView.getVisibility() != 0 && LoginActivity.this.activityMode != 3 && !this.isSetup) {
z = true;
}
AndroidUtilities.updateViewVisibilityAnimated(frameLayout, z, 1.0f, true);
}
}
public void lambda$new$1() {
showResendCodeView(true);
}
public LoginActivityEmailCodeView(final Context context, boolean z) {
super(context);
int i;
this.errorColorTimeout = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$0();
}
};
this.resendCodeTimeout = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$1();
}
};
this.updateResetPendingDateCallback = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.updateResetPendingDate();
}
};
this.isSetup = z;
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
this.inboxImageView = new RLottieImageView(context);
if (!z || LoginActivity.this.activityMode == 3) {
this.inboxImageView.setAnimation(org.telegram.messenger.R.raw.email_check_inbox, 120, 120);
} else {
this.inboxImageView.setAnimation(org.telegram.messenger.R.raw.email_setup_heart, 120, 120);
}
this.inboxImageView.setAutoRepeat(false);
frameLayout.addView(this.inboxImageView, LayoutHelper.createFrame(120, 120, 1));
if (!AndroidUtilities.isSmallScreen()) {
Point point = AndroidUtilities.displaySize;
if (point.x <= point.y || AndroidUtilities.isTablet()) {
i = 0;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.CheckYourNewEmail : z ? org.telegram.messenger.R.string.VerificationCode : org.telegram.messenger.R.string.CheckYourEmail));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
SpoilersTextView spoilersTextView = new SpoilersTextView(context, false);
this.confirmTextView = spoilersTextView;
spoilersTextView.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(17);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 24, 8, 24, 0));
CodeFieldContainer codeFieldContainer = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivityEmailCodeView.this.lambda$onNextPressed$14(null);
}
};
this.codeFieldContainer = codeFieldContainer;
addView(codeFieldContainer, LayoutHelper.createLinear(-2, 42, 1, 0, !z ? 48 : 32, 0, 0));
TextView textView2 = new TextView(context);
this.signInWithGoogleView = textView2;
textView2.setGravity(17);
this.signInWithGoogleView.setTextSize(1, 14.0f);
this.signInWithGoogleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.signInWithGoogleView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.signInWithGoogleView.setMaxLines(2);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("d ");
Drawable drawable = ContextCompat.getDrawable(context, org.telegram.messenger.R.drawable.googleg_standard_color_18);
drawable.setBounds(0, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(18.0f), AndroidUtilities.dp(27.0f));
spannableStringBuilder.setSpan(new ImageSpan(drawable, 0), 0, 1, 33);
spannableStringBuilder.setSpan(new ReplacementSpan(this, LoginActivity.this) {
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i2, int i3, float f, int i4, int i5, int i6, Paint paint) {
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i2, int i3, Paint.FontMetricsInt fontMetricsInt) {
return AndroidUtilities.dp(12.0f);
}
}, 1, 2, 33);
spannableStringBuilder.append((CharSequence) LocaleController.getString(org.telegram.messenger.R.string.SignInWithGoogle));
this.signInWithGoogleView.setText(spannableStringBuilder);
this.signInWithGoogleView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$3(view);
}
});
FrameLayout frameLayout2 = new FrameLayout(context);
this.cantAccessEmailFrameLayout = frameLayout2;
AndroidUtilities.updateViewVisibilityAnimated(frameLayout2, LoginActivity.this.activityMode == 3 && !this.isSetup, 1.0f, false);
TextView textView3 = new TextView(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.cantAccessEmailView = textView3;
textView3.setText(LocaleController.getString(org.telegram.messenger.R.string.LoginCantAccessThisEmail));
this.cantAccessEmailView.setGravity(17);
this.cantAccessEmailView.setTextSize(1, 14.0f);
this.cantAccessEmailView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.cantAccessEmailView.setMaxLines(2);
this.cantAccessEmailView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$7(context, view);
}
});
this.cantAccessEmailFrameLayout.addView(this.cantAccessEmailView);
TextView textView4 = new TextView(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(Math.max(View.MeasureSpec.getSize(i3), AndroidUtilities.dp(100.0f)), Integer.MIN_VALUE));
}
};
this.emailResetInView = textView4;
textView4.setGravity(17);
this.emailResetInView.setTextSize(1, 14.0f);
this.emailResetInView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.emailResetInView.setMaxLines(3);
this.emailResetInView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$8(view);
}
});
this.emailResetInView.setPadding(0, AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f));
this.emailResetInView.setVisibility(8);
this.cantAccessEmailFrameLayout.addView(this.emailResetInView);
TextView textView5 = new TextView(context);
this.resendCodeView = textView5;
textView5.setGravity(17);
this.resendCodeView.setTextSize(1, 14.0f);
this.resendCodeView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.resendCodeView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.resendCodeView.setMaxLines(2);
this.resendCodeView.setText(LocaleController.getString(org.telegram.messenger.R.string.ResendCode));
this.resendCodeView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$11(view);
}
});
AndroidUtilities.updateViewVisibilityAnimated(this.resendCodeView, false, 1.0f, false);
LoginOrView loginOrView = new LoginOrView(context);
this.loginOrView = loginOrView;
VerticalPositionAutoAnimator.attach(loginOrView);
this.errorViewSwitcher = new ViewSwitcher(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
Animation loadAnimation = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_in);
Interpolator interpolator = Easings.easeInOutQuad;
loadAnimation.setInterpolator(interpolator);
this.errorViewSwitcher.setInAnimation(loadAnimation);
Animation loadAnimation2 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_out);
loadAnimation2.setInterpolator(interpolator);
this.errorViewSwitcher.setOutAnimation(loadAnimation2);
FrameLayout frameLayout3 = new FrameLayout(context);
this.resendFrameLayout = frameLayout3;
frameLayout3.addView(this.resendCodeView, LayoutHelper.createFrame(-2, -2, 17));
this.errorViewSwitcher.addView(this.resendFrameLayout);
TextView textView6 = new TextView(context);
this.wrongCodeView = textView6;
textView6.setText(LocaleController.getString("WrongCode", org.telegram.messenger.R.string.WrongCode));
this.wrongCodeView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.wrongCodeView.setTextSize(1, 15.0f);
this.wrongCodeView.setGravity(49);
this.wrongCodeView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.errorViewSwitcher.addView(this.wrongCodeView);
FrameLayout frameLayout4 = new FrameLayout(context);
if (!z) {
frameLayout4.addView(this.errorViewSwitcher, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 0.0f, 32.0f));
} else {
frameLayout4.addView(this.errorViewSwitcher, LayoutHelper.createFrame(-1, -2, 48));
frameLayout4.addView(this.cantAccessEmailFrameLayout, LayoutHelper.createFrame(-1, -2, 48));
frameLayout4.addView(this.loginOrView, LayoutHelper.createFrame(-1, 16.0f, 17, 0.0f, 0.0f, 0.0f, 16.0f));
frameLayout4.addView(this.signInWithGoogleView, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 0.0f, 16.0f));
}
addView(frameLayout4, LayoutHelper.createLinear(-1, 0, 1.0f));
}
}
i = 8;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView7 = new TextView(context);
this.titleView = textView7;
textView7.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(LoginActivity.this.activityMode != 3 ? org.telegram.messenger.R.string.CheckYourNewEmail : z ? org.telegram.messenger.R.string.VerificationCode : org.telegram.messenger.R.string.CheckYourEmail));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
SpoilersTextView spoilersTextView2 = new SpoilersTextView(context, false);
this.confirmTextView = spoilersTextView2;
spoilersTextView2.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(17);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 24, 8, 24, 0));
CodeFieldContainer codeFieldContainer2 = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivityEmailCodeView.this.lambda$onNextPressed$14(null);
}
};
this.codeFieldContainer = codeFieldContainer2;
addView(codeFieldContainer2, LayoutHelper.createLinear(-2, 42, 1, 0, !z ? 48 : 32, 0, 0));
TextView textView22 = new TextView(context);
this.signInWithGoogleView = textView22;
textView22.setGravity(17);
this.signInWithGoogleView.setTextSize(1, 14.0f);
this.signInWithGoogleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.signInWithGoogleView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.signInWithGoogleView.setMaxLines(2);
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder("d ");
Drawable drawable2 = ContextCompat.getDrawable(context, org.telegram.messenger.R.drawable.googleg_standard_color_18);
drawable2.setBounds(0, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(18.0f), AndroidUtilities.dp(27.0f));
spannableStringBuilder2.setSpan(new ImageSpan(drawable2, 0), 0, 1, 33);
spannableStringBuilder2.setSpan(new ReplacementSpan(this, LoginActivity.this) {
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i2, int i3, float f, int i4, int i5, int i6, Paint paint) {
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i2, int i3, Paint.FontMetricsInt fontMetricsInt) {
return AndroidUtilities.dp(12.0f);
}
}, 1, 2, 33);
spannableStringBuilder2.append((CharSequence) LocaleController.getString(org.telegram.messenger.R.string.SignInWithGoogle));
this.signInWithGoogleView.setText(spannableStringBuilder2);
this.signInWithGoogleView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$3(view);
}
});
FrameLayout frameLayout22 = new FrameLayout(context);
this.cantAccessEmailFrameLayout = frameLayout22;
AndroidUtilities.updateViewVisibilityAnimated(frameLayout22, LoginActivity.this.activityMode == 3 && !this.isSetup, 1.0f, false);
TextView textView32 = new TextView(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.cantAccessEmailView = textView32;
textView32.setText(LocaleController.getString(org.telegram.messenger.R.string.LoginCantAccessThisEmail));
this.cantAccessEmailView.setGravity(17);
this.cantAccessEmailView.setTextSize(1, 14.0f);
this.cantAccessEmailView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.cantAccessEmailView.setMaxLines(2);
this.cantAccessEmailView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$7(context, view);
}
});
this.cantAccessEmailFrameLayout.addView(this.cantAccessEmailView);
TextView textView42 = new TextView(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(Math.max(View.MeasureSpec.getSize(i3), AndroidUtilities.dp(100.0f)), Integer.MIN_VALUE));
}
};
this.emailResetInView = textView42;
textView42.setGravity(17);
this.emailResetInView.setTextSize(1, 14.0f);
this.emailResetInView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.emailResetInView.setMaxLines(3);
this.emailResetInView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$8(view);
}
});
this.emailResetInView.setPadding(0, AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f));
this.emailResetInView.setVisibility(8);
this.cantAccessEmailFrameLayout.addView(this.emailResetInView);
TextView textView52 = new TextView(context);
this.resendCodeView = textView52;
textView52.setGravity(17);
this.resendCodeView.setTextSize(1, 14.0f);
this.resendCodeView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.resendCodeView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.resendCodeView.setMaxLines(2);
this.resendCodeView.setText(LocaleController.getString(org.telegram.messenger.R.string.ResendCode));
this.resendCodeView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$11(view);
}
});
AndroidUtilities.updateViewVisibilityAnimated(this.resendCodeView, false, 1.0f, false);
LoginOrView loginOrView2 = new LoginOrView(context);
this.loginOrView = loginOrView2;
VerticalPositionAutoAnimator.attach(loginOrView2);
this.errorViewSwitcher = new ViewSwitcher(this, context, LoginActivity.this) {
@Override
protected void onMeasure(int i2, int i3) {
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
Animation loadAnimation3 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_in);
Interpolator interpolator2 = Easings.easeInOutQuad;
loadAnimation3.setInterpolator(interpolator2);
this.errorViewSwitcher.setInAnimation(loadAnimation3);
Animation loadAnimation22 = AnimationUtils.loadAnimation(context, org.telegram.messenger.R.anim.text_out);
loadAnimation22.setInterpolator(interpolator2);
this.errorViewSwitcher.setOutAnimation(loadAnimation22);
FrameLayout frameLayout32 = new FrameLayout(context);
this.resendFrameLayout = frameLayout32;
frameLayout32.addView(this.resendCodeView, LayoutHelper.createFrame(-2, -2, 17));
this.errorViewSwitcher.addView(this.resendFrameLayout);
TextView textView62 = new TextView(context);
this.wrongCodeView = textView62;
textView62.setText(LocaleController.getString("WrongCode", org.telegram.messenger.R.string.WrongCode));
this.wrongCodeView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.wrongCodeView.setTextSize(1, 15.0f);
this.wrongCodeView.setGravity(49);
this.wrongCodeView.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.errorViewSwitcher.addView(this.wrongCodeView);
FrameLayout frameLayout42 = new FrameLayout(context);
if (!z) {
}
addView(frameLayout42, LayoutHelper.createLinear(-1, 0, 1.0f));
}
public void lambda$new$3(View view) {
NotificationCenter.getGlobalInstance().addObserver(new NotificationCenter.NotificationCenterDelegate() {
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
int intValue = ((Integer) objArr[0]).intValue();
((Integer) objArr[1]).intValue();
Intent intent = (Intent) objArr[2];
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.onActivityResultReceived);
if (intValue == 200) {
try {
LoginActivityEmailCodeView.this.googleAccount = GoogleSignIn.getSignedInAccountFromIntent(intent).getResult(ApiException.class);
LoginActivityEmailCodeView.this.lambda$onNextPressed$14(null);
} catch (ApiException e) {
FileLog.e(e);
}
}
}
}, NotificationCenter.onActivityResultReceived);
final GoogleSignInClient client = GoogleSignIn.getClient(getContext(), new GoogleSignInOptions.Builder().requestIdToken(BuildVars.GOOGLE_AUTH_CLIENT_ID).requestEmail().build());
client.signOut().addOnCompleteListener(new OnCompleteListener() {
@Override
public final void onComplete(Task task) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$2(client, task);
}
});
}
public void lambda$new$2(GoogleSignInClient googleSignInClient, Task task) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
LoginActivity.this.getParentActivity().startActivityForResult(googleSignInClient.getSignInIntent(), 200);
}
public void lambda$new$7(Context context, View view) {
String string = this.currentParams.getString("emailPattern");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
int indexOf = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
if (indexOf != lastIndexOf && indexOf != -1 && lastIndexOf != -1) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 256;
textStyleRun.start = indexOf;
int i = lastIndexOf + 1;
textStyleRun.end = i;
spannableStringBuilder.setSpan(new TextStyleSpan(textStyleRun), indexOf, i, 0);
}
new AlertDialog.Builder(context).setTitle(LocaleController.getString(org.telegram.messenger.R.string.LoginEmailResetTitle)).setMessage(AndroidUtilities.formatSpannable(AndroidUtilities.replaceTags(LocaleController.getString(org.telegram.messenger.R.string.LoginEmailResetMessage)), spannableStringBuilder, getTimePattern(this.resetAvailablePeriod))).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.LoginEmailResetButton), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$6(dialogInterface, i2);
}
}).setNegativeButton(LocaleController.getString(org.telegram.messenger.R.string.Cancel), null).show();
}
public void lambda$new$6(DialogInterface dialogInterface, int i) {
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
final TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail = new TLRPC$TL_auth_resetLoginEmail();
tLRPC$TL_auth_resetLoginEmail.phone_number = this.requestPhone;
tLRPC$TL_auth_resetLoginEmail.phone_code_hash = this.phoneHash;
LoginActivity.this.getConnectionsManager().sendRequest(tLRPC$TL_auth_resetLoginEmail, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$5(bundle, tLRPC$TL_auth_resetLoginEmail, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$new$5(final Bundle bundle, final TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$4(tLObject, bundle, tLRPC$TL_error, tLRPC$TL_auth_resetLoginEmail);
}
});
}
public void lambda$new$4(TLObject tLObject, Bundle bundle, TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail) {
String str;
if (tLObject instanceof TLRPC$TL_auth_sentCode) {
TLRPC$TL_auth_sentCode tLRPC$TL_auth_sentCode = (TLRPC$TL_auth_sentCode) tLObject;
TLRPC$auth_SentCodeType tLRPC$auth_SentCodeType = tLRPC$TL_auth_sentCode.type;
if (tLRPC$auth_SentCodeType instanceof TLRPC$TL_auth_sentCodeTypeEmailCode) {
tLRPC$auth_SentCodeType.email_pattern = this.currentParams.getString("emailPattern");
this.resetRequestPending = true;
}
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, tLRPC$TL_auth_sentCode);
return;
}
if (tLRPC$TL_error == null || (str = tLRPC$TL_error.text) == null) {
return;
}
if (!str.contains("PHONE_CODE_EXPIRED")) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_auth_resetLoginEmail, new Object[0]);
return;
}
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
}
public void lambda$new$8(View view) {
requestEmailReset();
}
public void lambda$new$11(View view) {
if (this.resendCodeView.getVisibility() == 0 && this.resendCodeView.getAlpha() == 1.0f) {
showResendCodeView(false);
final TLRPC$TL_auth_resendCode tLRPC$TL_auth_resendCode = new TLRPC$TL_auth_resendCode();
tLRPC$TL_auth_resendCode.phone_number = this.requestPhone;
tLRPC$TL_auth_resendCode.phone_code_hash = this.phoneHash;
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$10(bundle, tLRPC$TL_auth_resendCode, tLObject, tLRPC$TL_error);
}
}, 10);
}
}
public void lambda$new$10(final Bundle bundle, final TLRPC$TL_auth_resendCode tLRPC$TL_auth_resendCode, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$new$9(tLObject, bundle, tLRPC$TL_error, tLRPC$TL_auth_resendCode);
}
});
}
public void lambda$new$9(TLObject tLObject, Bundle bundle, TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_auth_resendCode tLRPC$TL_auth_resendCode) {
if (tLObject instanceof TLRPC$TL_auth_sentCode) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, (TLRPC$TL_auth_sentCode) tLObject);
} else {
if (tLRPC$TL_error == null || tLRPC$TL_error.text == null) {
return;
}
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_auth_resendCode, new Object[0]);
}
}
public void requestEmailReset() {
if (this.requestingEmailReset) {
return;
}
this.requestingEmailReset = true;
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
final TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail = new TLRPC$TL_auth_resetLoginEmail();
tLRPC$TL_auth_resetLoginEmail.phone_number = this.requestPhone;
tLRPC$TL_auth_resetLoginEmail.phone_code_hash = this.phoneHash;
LoginActivity.this.getConnectionsManager().sendRequest(tLRPC$TL_auth_resetLoginEmail, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$requestEmailReset$13(bundle, tLRPC$TL_auth_resetLoginEmail, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$requestEmailReset$13(final Bundle bundle, final TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$requestEmailReset$12(tLObject, bundle, tLRPC$TL_error, tLRPC$TL_auth_resetLoginEmail);
}
});
}
public void lambda$requestEmailReset$12(TLObject tLObject, Bundle bundle, TLRPC$TL_error tLRPC$TL_error, TLRPC$TL_auth_resetLoginEmail tLRPC$TL_auth_resetLoginEmail) {
String str;
if (LoginActivity.this.getParentActivity() == null) {
return;
}
this.requestingEmailReset = false;
if (tLObject instanceof TLRPC$TL_auth_sentCode) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, (TLRPC$TL_auth_sentCode) tLObject);
return;
}
if (tLRPC$TL_error == null || (str = tLRPC$TL_error.text) == null) {
return;
}
if (str.contains("TASK_ALREADY_EXISTS")) {
new AlertDialog.Builder(getContext()).setTitle(LocaleController.getString(org.telegram.messenger.R.string.LoginEmailResetPremiumRequiredTitle)).setMessage(AndroidUtilities.replaceTags(LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetPremiumRequiredMessage, LocaleController.addNbsp(PhoneFormat.getInstance().format("+" + this.requestPhone))))).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.OK), null).show();
return;
}
if (!tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
AlertsCreator.processError(((BaseFragment) LoginActivity.this).currentAccount, tLRPC$TL_error, LoginActivity.this, tLRPC$TL_auth_resetLoginEmail, new Object[0]);
return;
}
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
}
@Override
public void updateColors() {
this.titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
TextView textView = this.confirmTextView;
int i = Theme.key_windowBackgroundWhiteGrayText6;
textView.setTextColor(Theme.getColor(i));
TextView textView2 = this.signInWithGoogleView;
int i2 = Theme.key_windowBackgroundWhiteBlueText4;
textView2.setTextColor(Theme.getColor(i2));
this.loginOrView.updateColors();
this.resendCodeView.setTextColor(Theme.getColor(i2));
this.cantAccessEmailView.setTextColor(Theme.getColor(i2));
this.emailResetInView.setTextColor(Theme.getColor(i));
this.wrongCodeView.setTextColor(Theme.getColor(Theme.key_text_RedBold));
this.codeFieldContainer.invalidate();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this.errorColorTimeout);
removeCallbacks(this.resendCodeTimeout);
}
private void showResendCodeView(boolean z) {
AndroidUtilities.updateViewVisibilityAnimated(this.resendCodeView, z);
AndroidUtilities.updateViewVisibilityAnimated(this.cantAccessEmailFrameLayout, (z || LoginActivity.this.activityMode == 3 || this.isSetup) ? false : true);
if (this.loginOrView.getVisibility() != 8) {
this.loginOrView.setLayoutParams(LayoutHelper.createFrame(-1, 16.0f, 17, 0.0f, 0.0f, 0.0f, z ? 8.0f : 16.0f));
this.loginOrView.requestLayout();
}
}
@Override
public String getHeaderName() {
return LocaleController.getString(org.telegram.messenger.R.string.VerificationCode);
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
this.currentParams = bundle;
this.requestPhone = bundle.getString("phoneFormated");
this.phoneHash = this.currentParams.getString("phoneHash");
this.phone = this.currentParams.getString("phone");
this.emailPhone = this.currentParams.getString("ephone");
this.isFromSetup = this.currentParams.getBoolean("setup");
this.length = this.currentParams.getInt("length");
this.email = this.currentParams.getString("email");
this.resetAvailablePeriod = this.currentParams.getInt("resetAvailablePeriod");
this.resetPendingDate = this.currentParams.getInt("resetPendingDate");
int i = 8;
if (LoginActivity.this.activityMode == 3) {
this.confirmTextView.setText(LocaleController.formatString(org.telegram.messenger.R.string.CheckYourNewEmailSubtitle, this.email));
AndroidUtilities.updateViewVisibilityAnimated(this.cantAccessEmailFrameLayout, false, 1.0f, false);
} else if (this.isSetup) {
this.confirmTextView.setText(LocaleController.formatString(org.telegram.messenger.R.string.VerificationCodeSubtitle, this.email));
AndroidUtilities.updateViewVisibilityAnimated(this.cantAccessEmailFrameLayout, false, 1.0f, false);
} else {
AndroidUtilities.updateViewVisibilityAnimated(this.cantAccessEmailFrameLayout, true, 1.0f, false);
this.cantAccessEmailView.setVisibility(this.resetPendingDate == 0 ? 0 : 8);
this.emailResetInView.setVisibility(this.resetPendingDate != 0 ? 0 : 8);
if (this.resetPendingDate != 0) {
updateResetPendingDate();
}
}
this.codeFieldContainer.setNumbersCount(this.length, 1);
for (CodeNumberField codeNumberField : this.codeFieldContainer.codeField) {
codeNumberField.setShowSoftInputOnFocusCompat(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
codeNumberField.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
if (LoginActivityEmailCodeView.this.postedErrorColorTimeout) {
LoginActivityEmailCodeView loginActivityEmailCodeView = LoginActivityEmailCodeView.this;
loginActivityEmailCodeView.removeCallbacks(loginActivityEmailCodeView.errorColorTimeout);
LoginActivityEmailCodeView.this.errorColorTimeout.run();
}
}
});
codeNumberField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z2) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$setParams$14(view, z2);
}
});
}
this.codeFieldContainer.setText("");
if (!this.isFromSetup && LoginActivity.this.activityMode != 3) {
String string = this.currentParams.getString("emailPattern");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
int indexOf = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
if (indexOf != lastIndexOf && indexOf != -1 && lastIndexOf != -1) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 256;
textStyleRun.start = indexOf;
int i2 = lastIndexOf + 1;
textStyleRun.end = i2;
spannableStringBuilder.setSpan(new TextStyleSpan(textStyleRun), indexOf, i2, 0);
}
this.confirmTextView.setText(AndroidUtilities.formatSpannable(LocaleController.getString(org.telegram.messenger.R.string.CheckYourEmailSubtitle), spannableStringBuilder));
}
if (bundle.getBoolean("googleSignInAllowed") && PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices()) {
i = 0;
}
this.loginOrView.setVisibility(i);
this.signInWithGoogleView.setVisibility(i);
LoginActivity.this.showKeyboard(this.codeFieldContainer.codeField[0]);
this.codeFieldContainer.requestFocus();
if (!z && bundle.containsKey("nextType")) {
AndroidUtilities.runOnUIThread(this.resendCodeTimeout, bundle.getInt("timeout"));
}
if (this.resetPendingDate != 0) {
AndroidUtilities.runOnUIThread(this.updateResetPendingDateCallback, 1000L);
}
}
public void lambda$setParams$14(View view, boolean z) {
if (z) {
LoginActivity.this.keyboardView.setEditText((EditText) view);
LoginActivity.this.keyboardView.setDispatchBackWhenEmpty(true);
}
}
@Override
public void onHide() {
super.onHide();
if (this.resetPendingDate != 0) {
AndroidUtilities.cancelRunOnUIThread(this.updateResetPendingDateCallback);
}
}
private String getTimePatternForTimer(int i) {
int i2 = i / 86400;
int i3 = i % 86400;
int i4 = i3 / 3600;
int i5 = i3 % 3600;
int i6 = i5 / 60;
int i7 = i5 % 60;
if (i4 >= 16) {
i2++;
}
if (i2 != 0) {
return LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Days", i2, new Object[0]));
}
StringBuilder sb = new StringBuilder();
sb.append(i4 != 0 ? String.format(Locale.ROOT, "%02d:", Integer.valueOf(i4)) : "");
Locale locale = Locale.ROOT;
sb.append(String.format(locale, "%02d:", Integer.valueOf(i6)));
sb.append(String.format(locale, "%02d", Integer.valueOf(i7)));
return LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInSinglePattern, sb.toString());
}
private String getTimePattern(int i) {
int i2 = i / 86400;
int i3 = i % 86400;
int i4 = i3 / 3600;
int i5 = (i3 % 3600) / 60;
if (i2 == 0 && i4 == 0) {
i5 = Math.max(1, i5);
}
return (i2 == 0 || i4 == 0) ? (i4 == 0 || i5 == 0) ? i2 != 0 ? LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Days", i2, new Object[0])) : i4 != 0 ? LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Hours", i2, new Object[0])) : LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Minutes", i5, new Object[0])) : LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInDoublePattern, LocaleController.formatPluralString("Hours", i4, new Object[0]), LocaleController.formatPluralString("Minutes", i5, new Object[0])) : LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInDoublePattern, LocaleController.formatPluralString("Days", i2, new Object[0]), LocaleController.formatPluralString("Hours", i4, new Object[0]));
}
public void updateResetPendingDate() {
int currentTimeMillis = (int) (this.resetPendingDate - (System.currentTimeMillis() / 1000));
if (this.resetPendingDate <= 0 || currentTimeMillis <= 0) {
this.emailResetInView.setVisibility(0);
this.emailResetInView.setText(LocaleController.getString(org.telegram.messenger.R.string.LoginEmailResetPleaseWait));
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.requestEmailReset();
}
}, 1000L);
return;
}
String formatString = LocaleController.formatString(org.telegram.messenger.R.string.LoginEmailResetInTime, getTimePatternForTimer(currentTimeMillis));
SpannableStringBuilder valueOf = SpannableStringBuilder.valueOf(formatString);
int indexOf = formatString.indexOf(42);
int lastIndexOf = formatString.lastIndexOf(42);
if (indexOf != lastIndexOf && indexOf != -1 && lastIndexOf != -1) {
valueOf.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) "");
valueOf.replace(indexOf, indexOf + 1, (CharSequence) "");
valueOf.setSpan(new ForegroundColorSpan(LoginActivity.this.getThemedColor(Theme.key_windowBackgroundWhiteBlueText4)), indexOf, lastIndexOf - 1, 33);
}
this.emailResetInView.setText(valueOf);
AndroidUtilities.runOnUIThread(this.updateResetPendingDateCallback, 1000L);
}
private void onPasscodeError(boolean z) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
try {
this.codeFieldContainer.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
if (z) {
for (CodeNumberField codeNumberField : this.codeFieldContainer.codeField) {
codeNumberField.setText("");
}
}
for (CodeNumberField codeNumberField2 : this.codeFieldContainer.codeField) {
codeNumberField2.animateErrorProgress(1.0f);
}
this.codeFieldContainer.codeField[0].requestFocus();
AndroidUtilities.shakeViewSpring(this.codeFieldContainer, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onPasscodeError$16();
}
});
}
public void lambda$onPasscodeError$16() {
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onPasscodeError$15();
}
}, 150L);
removeCallbacks(this.errorColorTimeout);
postDelayed(this.errorColorTimeout, 3000L);
this.postedErrorColorTimeout = true;
}
public void lambda$onPasscodeError$15() {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
int i = 0;
codeFieldContainer.isFocusSuppressed = false;
codeFieldContainer.codeField[0].requestFocus();
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
return;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
}
@Override
public void lambda$onNextPressed$14(String str) {
TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn;
if (this.nextPressed) {
return;
}
AndroidUtilities.cancelRunOnUIThread(this.resendCodeTimeout);
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
codeFieldContainer.isFocusSuppressed = true;
CodeNumberField[] codeNumberFieldArr = codeFieldContainer.codeField;
if (codeNumberFieldArr != null) {
for (CodeNumberField codeNumberField : codeNumberFieldArr) {
codeNumberField.animateFocusedProgress(0.0f);
}
}
final String code = this.codeFieldContainer.getCode();
if (code.length() == 0 && this.googleAccount == null) {
onPasscodeError(false);
return;
}
this.nextPressed = true;
LoginActivity.this.needShowProgress(0);
if (LoginActivity.this.activityMode == 3) {
TLRPC$TL_account_verifyEmail tLRPC$TL_account_verifyEmail = new TLRPC$TL_account_verifyEmail();
tLRPC$TL_account_verifyEmail.purpose = new TLRPC$TL_emailVerifyPurposeLoginChange();
TLRPC$TL_emailVerificationCode tLRPC$TL_emailVerificationCode = new TLRPC$TL_emailVerificationCode();
tLRPC$TL_emailVerificationCode.code = code;
tLRPC$TL_account_verifyEmail.verification = tLRPC$TL_emailVerificationCode;
tLRPC$TL_auth_signIn = tLRPC$TL_account_verifyEmail;
} else if (this.isFromSetup) {
TLRPC$TL_account_verifyEmail tLRPC$TL_account_verifyEmail2 = new TLRPC$TL_account_verifyEmail();
TLRPC$TL_emailVerifyPurposeLoginSetup tLRPC$TL_emailVerifyPurposeLoginSetup = new TLRPC$TL_emailVerifyPurposeLoginSetup();
tLRPC$TL_emailVerifyPurposeLoginSetup.phone_number = this.requestPhone;
tLRPC$TL_emailVerifyPurposeLoginSetup.phone_code_hash = this.phoneHash;
tLRPC$TL_account_verifyEmail2.purpose = tLRPC$TL_emailVerifyPurposeLoginSetup;
TLRPC$TL_emailVerificationCode tLRPC$TL_emailVerificationCode2 = new TLRPC$TL_emailVerificationCode();
tLRPC$TL_emailVerificationCode2.code = code;
tLRPC$TL_account_verifyEmail2.verification = tLRPC$TL_emailVerificationCode2;
tLRPC$TL_auth_signIn = tLRPC$TL_account_verifyEmail2;
} else {
TLRPC$TL_auth_signIn tLRPC$TL_auth_signIn2 = new TLRPC$TL_auth_signIn();
tLRPC$TL_auth_signIn2.phone_number = this.requestPhone;
tLRPC$TL_auth_signIn2.phone_code_hash = this.phoneHash;
if (this.googleAccount != null) {
TLRPC$TL_emailVerificationGoogle tLRPC$TL_emailVerificationGoogle = new TLRPC$TL_emailVerificationGoogle();
tLRPC$TL_emailVerificationGoogle.token = this.googleAccount.getIdToken();
tLRPC$TL_auth_signIn2.email_verification = tLRPC$TL_emailVerificationGoogle;
} else {
TLRPC$TL_emailVerificationCode tLRPC$TL_emailVerificationCode3 = new TLRPC$TL_emailVerificationCode();
tLRPC$TL_emailVerificationCode3.code = code;
tLRPC$TL_auth_signIn2.email_verification = tLRPC$TL_emailVerificationCode3;
}
tLRPC$TL_auth_signIn2.flags |= 2;
tLRPC$TL_auth_signIn = tLRPC$TL_auth_signIn2;
}
CodeFieldContainer codeFieldContainer2 = this.codeFieldContainer;
codeFieldContainer2.isFocusSuppressed = true;
CodeNumberField[] codeNumberFieldArr2 = codeFieldContainer2.codeField;
if (codeNumberFieldArr2 != null) {
for (CodeNumberField codeNumberField2 : codeNumberFieldArr2) {
codeNumberField2.animateFocusedProgress(0.0f);
}
}
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_signIn, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$23(code, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$onNextPressed$23(final String str, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$22(tLRPC$TL_error, str, tLObject);
}
});
}
public void lambda$onNextPressed$22(TLRPC$TL_error tLRPC$TL_error, final String str, final TLObject tLObject) {
CodeNumberField[] codeNumberFieldArr;
LoginActivity.this.needHideProgress(false);
boolean z = true;
if (tLRPC$TL_error == null) {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
bundle.putString("ephone", this.emailPhone);
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", str);
if (tLObject instanceof TLRPC$TL_auth_authorizationSignUpRequired) {
TLRPC$TL_help_termsOfService tLRPC$TL_help_termsOfService = ((TLRPC$TL_auth_authorizationSignUpRequired) tLObject).terms_of_service;
if (tLRPC$TL_help_termsOfService != null) {
LoginActivity.this.currentTermsOfService = tLRPC$TL_help_termsOfService;
}
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$17(bundle);
}
});
} else {
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$18(tLObject, bundle);
}
});
}
} else if (tLRPC$TL_error.text.contains("SESSION_PASSWORD_NEEDED")) {
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_account_getPassword(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC$TL_error tLRPC$TL_error2) {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$21(str, tLObject2, tLRPC$TL_error2);
}
}, 10);
} else {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
if (tLRPC$TL_error.text.contains("EMAIL_ADDRESS_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString(org.telegram.messenger.R.string.EmailAddressInvalid));
} else if (tLRPC$TL_error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidPhoneNumber", org.telegram.messenger.R.string.InvalidPhoneNumber));
} else if (tLRPC$TL_error.text.contains("CODE_EMPTY") || tLRPC$TL_error.text.contains("CODE_INVALID") || tLRPC$TL_error.text.contains("EMAIL_CODE_INVALID") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
shakeWrongCode();
if (!z) {
if (this.codeFieldContainer.codeField != null) {
int i = 0;
while (true) {
codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i].setText("");
i++;
}
codeNumberFieldArr[0].requestFocus();
}
this.codeFieldContainer.isFocusSuppressed = false;
}
} else if (tLRPC$TL_error.text.contains("EMAIL_TOKEN_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString(org.telegram.messenger.R.string.EmailTokenInvalid));
} else if (tLRPC$TL_error.text.contains("EMAIL_VERIFY_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
} else if (tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", org.telegram.messenger.R.string.FloodWait));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ErrorOccurred", org.telegram.messenger.R.string.ErrorOccurred) + "\n" + tLRPC$TL_error.text);
}
z = false;
if (!z) {
}
}
this.googleAccount = null;
}
public void lambda$onNextPressed$17(Bundle bundle) {
LoginActivity.this.setPage(5, true, bundle, false);
}
public void lambda$onNextPressed$18(TLObject tLObject, Bundle bundle) {
if ((tLObject instanceof TLRPC$TL_account_emailVerified) && LoginActivity.this.activityMode == 3) {
LoginActivity.this.finishFragment();
LoginActivity.this.emailChangeFinishCallback.run();
} else if (tLObject instanceof TLRPC$TL_account_emailVerifiedLogin) {
LoginActivity.this.lambda$resendCodeFromSafetyNet$19(bundle, ((TLRPC$TL_account_emailVerifiedLogin) tLObject).sent_code);
} else if (tLObject instanceof TLRPC$TL_auth_authorization) {
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLObject);
}
}
public void lambda$onNextPressed$21(final String str, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$20(tLRPC$TL_error, tLObject, str);
}
});
}
public void lambda$onNextPressed$20(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, String str) {
this.nextPressed = false;
LoginActivity.this.showDoneButton(false, true);
if (tLRPC$TL_error != null) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
TLRPC$account_Password tLRPC$account_Password = (TLRPC$account_Password) tLObject;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(tLRPC$account_Password, true)) {
AlertsCreator.showUpdateAppAlert(LoginActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", org.telegram.messenger.R.string.UpdateAppAlert), true);
return;
}
final Bundle bundle = new Bundle();
SerializedData serializedData = new SerializedData(tLRPC$account_Password.getObjectSize());
tLRPC$account_Password.serializeToStream(serializedData);
bundle.putString("password", Utilities.bytesToHex(serializedData.toByteArray()));
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", str);
animateSuccess(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onNextPressed$19(bundle);
}
});
}
public void lambda$onNextPressed$19(Bundle bundle) {
LoginActivity.this.setPage(6, true, bundle, false);
}
private void animateSuccess(final Runnable runnable) {
if (this.googleAccount != null) {
runnable.run();
return;
}
final int i = 0;
while (true) {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (i < codeFieldContainer.codeField.length) {
codeFieldContainer.postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$animateSuccess$24(i);
}
}, i * 75);
i++;
} else {
codeFieldContainer.postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$animateSuccess$25(runnable);
}
}, (this.codeFieldContainer.codeField.length * 75) + 400);
return;
}
}
}
public void lambda$animateSuccess$24(int i) {
this.codeFieldContainer.codeField[i].animateSuccessProgress(1.0f);
}
public void lambda$animateSuccess$25(Runnable runnable) {
int i = 0;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i < codeNumberFieldArr.length) {
codeNumberFieldArr[i].animateSuccessProgress(0.0f);
i++;
} else {
runnable.run();
this.codeFieldContainer.isFocusSuppressed = false;
return;
}
}
}
private void shakeWrongCode() {
try {
this.codeFieldContainer.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
int i = 0;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
break;
}
codeNumberFieldArr[i].setText("");
this.codeFieldContainer.codeField[i].animateErrorProgress(1.0f);
i++;
}
if (this.errorViewSwitcher.getCurrentView() == this.resendFrameLayout) {
this.errorViewSwitcher.showNext();
AndroidUtilities.updateViewVisibilityAnimated(this.cantAccessEmailFrameLayout, false, 1.0f, true);
}
this.codeFieldContainer.codeField[0].requestFocus();
AndroidUtilities.shakeViewSpring(this.codeFieldContainer, 10.0f, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$shakeWrongCode$27();
}
});
removeCallbacks(this.errorColorTimeout);
postDelayed(this.errorColorTimeout, 5000L);
this.postedErrorColorTimeout = true;
}
public void lambda$shakeWrongCode$27() {
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$shakeWrongCode$26();
}
}, 150L);
}
public void lambda$shakeWrongCode$26() {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
int i = 0;
codeFieldContainer.isFocusSuppressed = false;
codeFieldContainer.codeField[0].requestFocus();
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
return;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
}
@Override
public void onShow() {
super.onShow();
if (this.resetRequestPending) {
this.resetRequestPending = false;
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityEmailCodeView.this.lambda$onShow$28();
}
}, LoginActivity.SHOW_DELAY);
}
}
public void lambda$onShow$28() {
this.inboxImageView.getAnimatedDrawable().setCurrentFrame(0, false);
this.inboxImageView.playAnimation();
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer == null || codeFieldContainer.codeField == null) {
return;
}
codeFieldContainer.setText("");
this.codeFieldContainer.codeField[0].requestFocus();
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeFieldContainer.getCode();
if (code != null && code.length() != 0) {
bundle.putString("emailcode_code", code);
}
Bundle bundle2 = this.currentParams;
if (bundle2 != null) {
bundle.putBundle("emailcode_params", bundle2);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
Bundle bundle2 = bundle.getBundle("emailcode_params");
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
String string = bundle.getString("emailcode_code");
if (string != null) {
this.codeFieldContainer.setText(string);
}
}
}
public class LoginActivityRecoverView extends SlideView {
private CodeFieldContainer codeFieldContainer;
private TextView confirmTextView;
private Bundle currentParams;
private Runnable errorColorTimeout;
private RLottieImageView inboxImageView;
private boolean nextPressed;
private String passwordString;
private String phoneCode;
private String phoneHash;
private boolean postedErrorColorTimeout;
private String requestPhone;
private TextView titleView;
private TextView troubleButton;
@Override
public boolean hasCustomKeyboard() {
return true;
}
@Override
public boolean needBackButton() {
return true;
}
public void lambda$new$0() {
int i = 0;
this.postedErrorColorTimeout = false;
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
return;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
}
public LoginActivityRecoverView(Context context) {
super(context);
int i;
this.errorColorTimeout = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.lambda$new$0();
}
};
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.inboxImageView = rLottieImageView;
rLottieImageView.setAnimation(org.telegram.messenger.R.raw.tsv_setup_mail, 120, 120);
this.inboxImageView.setAutoRepeat(false);
frameLayout.addView(this.inboxImageView, LayoutHelper.createFrame(120, 120, 1));
if (!AndroidUtilities.isSmallScreen()) {
Point point = AndroidUtilities.displaySize;
if (point.x <= point.y || AndroidUtilities.isTablet()) {
i = 0;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(org.telegram.messenger.R.string.EnterCode));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView2 = new TextView(context);
this.confirmTextView = textView2;
textView2.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(17);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString(org.telegram.messenger.R.string.RestoreEmailSentInfo));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 12, 8, 12, 0));
CodeFieldContainer codeFieldContainer = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivityRecoverView.this.lambda$onNextPressed$14(null);
}
};
this.codeFieldContainer = codeFieldContainer;
codeFieldContainer.setNumbersCount(6, 1);
for (CodeNumberField codeNumberField : this.codeFieldContainer.codeField) {
codeNumberField.setShowSoftInputOnFocusCompat(!hasCustomKeyboard() || LoginActivity.this.isCustomKeyboardForceDisabled());
codeNumberField.addTextChangedListener(new TextWatcher(LoginActivity.this) {
@Override
public void afterTextChanged(Editable editable) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
if (LoginActivityRecoverView.this.postedErrorColorTimeout) {
LoginActivityRecoverView loginActivityRecoverView = LoginActivityRecoverView.this;
loginActivityRecoverView.removeCallbacks(loginActivityRecoverView.errorColorTimeout);
LoginActivityRecoverView.this.errorColorTimeout.run();
}
}
});
codeNumberField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
LoginActivity.LoginActivityRecoverView.this.lambda$new$1(view, z);
}
});
}
addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, 42, 1, 0, 32, 0, 0));
SpoilersTextView spoilersTextView = new SpoilersTextView(context, false);
this.troubleButton = spoilersTextView;
spoilersTextView.setGravity(17);
this.troubleButton.setTextSize(1, 14.0f);
this.troubleButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.troubleButton.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.troubleButton.setMaxLines(2);
this.troubleButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityRecoverView.this.lambda$new$4(view);
}
});
FrameLayout frameLayout2 = new FrameLayout(context);
frameLayout2.addView(this.troubleButton, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 0.0f, 32.0f));
addView(frameLayout2, LayoutHelper.createLinear(-1, 0, 1.0f));
VerticalPositionAutoAnimator.attach(this.troubleButton);
}
}
i = 8;
frameLayout.setVisibility(i);
addView(frameLayout, LayoutHelper.createFrame(-1, -2, 1));
TextView textView3 = new TextView(context);
this.titleView = textView3;
textView3.setTextSize(1, 18.0f);
this.titleView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleView.setText(LocaleController.getString(org.telegram.messenger.R.string.EnterCode));
this.titleView.setGravity(17);
this.titleView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.titleView, LayoutHelper.createFrame(-1, -2.0f, 1, 32.0f, 16.0f, 32.0f, 0.0f));
TextView textView22 = new TextView(context);
this.confirmTextView = textView22;
textView22.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(17);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString(org.telegram.messenger.R.string.RestoreEmailSentInfo));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 12, 8, 12, 0));
CodeFieldContainer codeFieldContainer2 = new CodeFieldContainer(context, LoginActivity.this) {
@Override
protected void processNextPressed() {
LoginActivityRecoverView.this.lambda$onNextPressed$14(null);
}
};
this.codeFieldContainer = codeFieldContainer2;
codeFieldContainer2.setNumbersCount(6, 1);
while (r12 < r11) {
}
addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, 42, 1, 0, 32, 0, 0));
SpoilersTextView spoilersTextView2 = new SpoilersTextView(context, false);
this.troubleButton = spoilersTextView2;
spoilersTextView2.setGravity(17);
this.troubleButton.setTextSize(1, 14.0f);
this.troubleButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.troubleButton.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.troubleButton.setMaxLines(2);
this.troubleButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityRecoverView.this.lambda$new$4(view);
}
});
FrameLayout frameLayout22 = new FrameLayout(context);
frameLayout22.addView(this.troubleButton, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 0.0f, 32.0f));
addView(frameLayout22, LayoutHelper.createLinear(-1, 0, 1.0f));
VerticalPositionAutoAnimator.attach(this.troubleButton);
}
public void lambda$new$1(View view, boolean z) {
if (z) {
LoginActivity.this.keyboardView.setEditText((EditText) view);
LoginActivity.this.keyboardView.setDispatchBackWhenEmpty(true);
}
}
public void lambda$new$4(View view) {
Dialog showDialog = LoginActivity.this.showDialog(new AlertDialog.Builder(LoginActivity.this.getParentActivity()).setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", org.telegram.messenger.R.string.RestorePasswordNoEmailTitle)).setMessage(LocaleController.getString("RestoreEmailTroubleText", org.telegram.messenger.R.string.RestoreEmailTroubleText)).setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRecoverView.this.lambda$new$2(dialogInterface, i);
}
}).setNegativeButton(LocaleController.getString(org.telegram.messenger.R.string.ResetAccount), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRecoverView.this.lambda$new$3(dialogInterface, i);
}
}).create());
if (showDialog != null) {
showDialog.setCanceledOnTouchOutside(false);
showDialog.setCancelable(false);
}
}
public void lambda$new$2(DialogInterface dialogInterface, int i) {
LoginActivity.this.setPage(6, true, new Bundle(), true);
}
public void lambda$new$3(DialogInterface dialogInterface, int i) {
LoginActivity.this.tryResetAccount(this.requestPhone, this.phoneHash, this.phoneCode);
}
@Override
public void updateColors() {
this.titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.confirmTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.troubleButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.codeFieldContainer.invalidate();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this.errorColorTimeout);
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public String getHeaderName() {
return LocaleController.getString("LoginPassword", org.telegram.messenger.R.string.LoginPassword);
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
this.codeFieldContainer.setText("");
this.currentParams = bundle;
this.passwordString = bundle.getString("password");
this.requestPhone = this.currentParams.getString("requestPhone");
this.phoneHash = this.currentParams.getString("phoneHash");
this.phoneCode = this.currentParams.getString("phoneCode");
String string = this.currentParams.getString("email_unconfirmed_pattern");
SpannableStringBuilder valueOf = SpannableStringBuilder.valueOf(string);
int indexOf = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
if (indexOf != lastIndexOf && indexOf != -1 && lastIndexOf != -1) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 256;
textStyleRun.start = indexOf;
int i = lastIndexOf + 1;
textStyleRun.end = i;
valueOf.setSpan(new TextStyleSpan(textStyleRun), indexOf, i, 0);
}
this.troubleButton.setText(AndroidUtilities.formatSpannable(LocaleController.getString(org.telegram.messenger.R.string.RestoreEmailNoAccess), valueOf));
LoginActivity.this.showKeyboard(this.codeFieldContainer);
this.codeFieldContainer.requestFocus();
}
private void onPasscodeError(boolean z) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
try {
this.codeFieldContainer.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
if (z) {
for (CodeNumberField codeNumberField : this.codeFieldContainer.codeField) {
codeNumberField.setText("");
}
}
for (CodeNumberField codeNumberField2 : this.codeFieldContainer.codeField) {
codeNumberField2.animateErrorProgress(1.0f);
}
this.codeFieldContainer.codeField[0].requestFocus();
AndroidUtilities.shakeViewSpring(this.codeFieldContainer, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.lambda$onPasscodeError$6();
}
});
}
public void lambda$onPasscodeError$6() {
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.lambda$onPasscodeError$5();
}
}, 150L);
removeCallbacks(this.errorColorTimeout);
postDelayed(this.errorColorTimeout, 3000L);
this.postedErrorColorTimeout = true;
}
public void lambda$onPasscodeError$5() {
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
int i = 0;
codeFieldContainer.isFocusSuppressed = false;
codeFieldContainer.codeField[0].requestFocus();
while (true) {
CodeNumberField[] codeNumberFieldArr = this.codeFieldContainer.codeField;
if (i >= codeNumberFieldArr.length) {
return;
}
codeNumberFieldArr[i].animateErrorProgress(0.0f);
i++;
}
}
@Override
public void lambda$onNextPressed$14(String str) {
if (this.nextPressed) {
return;
}
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
codeFieldContainer.isFocusSuppressed = true;
for (CodeNumberField codeNumberField : codeFieldContainer.codeField) {
codeNumberField.animateFocusedProgress(0.0f);
}
final String code = this.codeFieldContainer.getCode();
if (code.length() == 0) {
onPasscodeError(false);
return;
}
this.nextPressed = true;
LoginActivity.this.needShowProgress(0);
TLRPC$TL_auth_checkRecoveryPassword tLRPC$TL_auth_checkRecoveryPassword = new TLRPC$TL_auth_checkRecoveryPassword();
tLRPC$TL_auth_checkRecoveryPassword.code = code;
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_checkRecoveryPassword, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityRecoverView.this.lambda$onNextPressed$8(code, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$onNextPressed$8(final String str, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.lambda$onNextPressed$7(tLObject, str, tLRPC$TL_error);
}
});
}
public void lambda$onNextPressed$7(TLObject tLObject, String str, TLRPC$TL_error tLRPC$TL_error) {
String formatPluralString;
LoginActivity.this.needHideProgress(false);
this.nextPressed = false;
if (tLObject instanceof TLRPC$TL_boolTrue) {
Bundle bundle = new Bundle();
bundle.putString("emailCode", str);
bundle.putString("password", this.passwordString);
LoginActivity.this.setPage(9, true, bundle, false);
return;
}
if (tLRPC$TL_error == null || tLRPC$TL_error.text.startsWith("CODE_INVALID")) {
onPasscodeError(true);
return;
}
if (!tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
int intValue = Utilities.parseInt((CharSequence) tLRPC$TL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.formatString("FloodWaitTime", org.telegram.messenger.R.string.FloodWaitTime, formatPluralString));
}
@Override
public boolean onBackPressed(boolean z) {
LoginActivity.this.needHideProgress(true);
this.currentParams = null;
this.nextPressed = false;
return true;
}
@Override
public void onShow() {
super.onShow();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.lambda$onShow$9();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$9() {
this.inboxImageView.getAnimatedDrawable().setCurrentFrame(0, false);
this.inboxImageView.playAnimation();
CodeFieldContainer codeFieldContainer = this.codeFieldContainer;
if (codeFieldContainer != null) {
codeFieldContainer.codeField[0].requestFocus();
}
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeFieldContainer.getCode();
if (code != null && code.length() != 0) {
bundle.putString("recoveryview_code", code);
}
Bundle bundle2 = this.currentParams;
if (bundle2 != null) {
bundle.putBundle("recoveryview_params", bundle2);
}
}
@Override
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.codeFieldContainer.setText(string);
}
}
}
public class LoginActivityNewPasswordView extends SlideView {
private TextView cancelButton;
private EditTextBoldCursor[] codeField;
private TextView confirmTextView;
private Bundle currentParams;
private TLRPC$account_Password currentPassword;
private int currentStage;
private String emailCode;
private boolean isPasswordVisible;
private String newPassword;
private boolean nextPressed;
private OutlineTextContainerView[] outlineFields;
private ImageView passwordButton;
private String passwordString;
private TextView titleTextView;
@Override
public boolean needBackButton() {
return true;
}
public LoginActivityNewPasswordView(Context context, int i) {
super(context);
int i2;
this.currentStage = i;
setOrientation(1);
EditTextBoldCursor[] editTextBoldCursorArr = new EditTextBoldCursor[i == 1 ? 1 : 2];
this.codeField = editTextBoldCursorArr;
this.outlineFields = new OutlineTextContainerView[editTextBoldCursorArr.length];
TextView textView = new TextView(context);
this.titleTextView = textView;
float f = 18.0f;
textView.setTextSize(1, 18.0f);
this.titleTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.titleTextView.setGravity(49);
this.titleTextView.setText(LocaleController.getString(org.telegram.messenger.R.string.SetNewPassword));
addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 1, 8, AndroidUtilities.isSmallScreen() ? 16 : 72, 8, 0));
TextView textView2 = new TextView(context);
this.confirmTextView = textView2;
textView2.setTextSize(1, 16.0f);
this.confirmTextView.setGravity(1);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 1, 8, 6, 8, 16));
final int i3 = 0;
while (i3 < this.codeField.length) {
final OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context);
this.outlineFields[i3] = outlineTextContainerView;
if (i == 0) {
i2 = i3 == 0 ? org.telegram.messenger.R.string.PleaseEnterNewFirstPasswordHint : org.telegram.messenger.R.string.PleaseEnterNewSecondPasswordHint;
} else {
i2 = org.telegram.messenger.R.string.PasswordHintPlaceholder;
}
outlineTextContainerView.setText(LocaleController.getString(i2));
this.codeField[i3] = new EditTextBoldCursor(context);
this.codeField[i3].setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField[i3].setCursorWidth(1.5f);
this.codeField[i3].setImeOptions(268435461);
this.codeField[i3].setTextSize(1, f);
this.codeField[i3].setMaxLines(1);
this.codeField[i3].setBackground(null);
int dp = AndroidUtilities.dp(16.0f);
this.codeField[i3].setPadding(dp, dp, dp, dp);
if (i == 0) {
this.codeField[i3].setInputType(129);
this.codeField[i3].setTransformationMethod(PasswordTransformationMethod.getInstance());
}
this.codeField[i3].setTypeface(Typeface.DEFAULT);
this.codeField[i3].setGravity(LocaleController.isRTL ? 5 : 3);
EditTextBoldCursor editTextBoldCursor = this.codeField[i3];
boolean z = i3 == 0 && i == 0;
editTextBoldCursor.addTextChangedListener(new TextWatcher(LoginActivity.this, z) {
final boolean val$showPasswordButton;
@Override
public void beforeTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i4, int i5, int i6) {
}
{
this.val$showPasswordButton = z;
}
@Override
public void afterTextChanged(Editable editable) {
if (this.val$showPasswordButton) {
if (LoginActivityNewPasswordView.this.passwordButton.getVisibility() == 0 || TextUtils.isEmpty(editable)) {
if (LoginActivityNewPasswordView.this.passwordButton.getVisibility() == 8 || !TextUtils.isEmpty(editable)) {
return;
}
AndroidUtilities.updateViewVisibilityAnimated(LoginActivityNewPasswordView.this.passwordButton, false, 0.1f, true);
return;
}
if (LoginActivityNewPasswordView.this.isPasswordVisible) {
LoginActivityNewPasswordView.this.passwordButton.callOnClick();
}
AndroidUtilities.updateViewVisibilityAnimated(LoginActivityNewPasswordView.this.passwordButton, true, 0.1f, true);
}
}
});
this.codeField[i3].setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z2) {
LoginActivity.LoginActivityNewPasswordView.lambda$new$0(OutlineTextContainerView.this, view, z2);
}
});
if (z) {
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
linearLayout.setGravity(16);
linearLayout.addView(this.codeField[i3], LayoutHelper.createLinear(0, -2, 1.0f));
ImageView imageView = new ImageView(context);
this.passwordButton = imageView;
imageView.setImageResource(org.telegram.messenger.R.drawable.msg_message);
AndroidUtilities.updateViewVisibilityAnimated(this.passwordButton, true, 0.1f, false);
this.passwordButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityNewPasswordView.this.lambda$new$1(view);
}
});
linearLayout.addView(this.passwordButton, LayoutHelper.createLinearRelatively(24.0f, 24.0f, 0, 0.0f, 0.0f, 14.0f, 0.0f));
outlineTextContainerView.addView(linearLayout, LayoutHelper.createFrame(-1, -2.0f));
} else {
outlineTextContainerView.addView(this.codeField[i3], LayoutHelper.createFrame(-1, -2.0f));
}
outlineTextContainerView.attachEditText(this.codeField[i3]);
addView(outlineTextContainerView, LayoutHelper.createLinear(-1, -2, 1, 16, 16, 16, 0));
this.codeField[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i4, KeyEvent keyEvent) {
boolean lambda$new$2;
lambda$new$2 = LoginActivity.LoginActivityNewPasswordView.this.lambda$new$2(i3, textView3, i4, keyEvent);
return lambda$new$2;
}
});
i3++;
f = 18.0f;
}
if (i == 0) {
this.confirmTextView.setText(LocaleController.getString("PleaseEnterNewFirstPasswordLogin", org.telegram.messenger.R.string.PleaseEnterNewFirstPasswordLogin));
} else {
this.confirmTextView.setText(LocaleController.getString("PasswordHintTextLogin", org.telegram.messenger.R.string.PasswordHintTextLogin));
}
TextView textView3 = new TextView(context);
this.cancelButton = textView3;
textView3.setGravity(19);
this.cancelButton.setTextSize(1, 15.0f);
this.cancelButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.cancelButton.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), 0);
this.cancelButton.setText(LocaleController.getString(org.telegram.messenger.R.string.YourEmailSkip));
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.addView(this.cancelButton, LayoutHelper.createFrame(-1, Build.VERSION.SDK_INT >= 21 ? 56 : 60, 80, 0.0f, 0.0f, 0.0f, 32.0f));
addView(frameLayout, LayoutHelper.createLinear(-1, -1, 80));
VerticalPositionAutoAnimator.attach(this.cancelButton);
this.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityNewPasswordView.this.lambda$new$3(view);
}
});
}
public static void lambda$new$0(OutlineTextContainerView outlineTextContainerView, View view, boolean z) {
outlineTextContainerView.animateSelection(z ? 1.0f : 0.0f);
}
public void lambda$new$1(View view) {
this.isPasswordVisible = !this.isPasswordVisible;
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i >= editTextBoldCursorArr.length) {
break;
}
int selectionStart = editTextBoldCursorArr[i].getSelectionStart();
int selectionEnd = this.codeField[i].getSelectionEnd();
this.codeField[i].setInputType((this.isPasswordVisible ? 144 : 128) | 1);
this.codeField[i].setSelection(selectionStart, selectionEnd);
i++;
}
this.passwordButton.setTag(Boolean.valueOf(this.isPasswordVisible));
this.passwordButton.setColorFilter(Theme.getColor(this.isPasswordVisible ? Theme.key_windowBackgroundWhiteInputFieldActivated : Theme.key_windowBackgroundWhiteHintText));
}
public boolean lambda$new$2(int i, TextView textView, int i2, KeyEvent keyEvent) {
if (i == 0) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (editTextBoldCursorArr.length == 2) {
editTextBoldCursorArr[1].requestFocus();
return true;
}
}
if (i2 != 5) {
return false;
}
lambda$onNextPressed$14(null);
return true;
}
public void lambda$new$3(View view) {
if (this.currentStage == 0) {
recoverPassword(null, null);
} else {
recoverPassword(this.newPassword, null);
}
}
@Override
public void updateColors() {
this.titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.confirmTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
for (EditTextBoldCursor editTextBoldCursor : this.codeField) {
editTextBoldCursor.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
editTextBoldCursor.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated));
}
for (OutlineTextContainerView outlineTextContainerView : this.outlineFields) {
outlineTextContainerView.updateColor();
}
this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
ImageView imageView = this.passwordButton;
if (imageView != null) {
imageView.setColorFilter(Theme.getColor(this.isPasswordVisible ? Theme.key_windowBackgroundWhiteInputFieldActivated : Theme.key_windowBackgroundWhiteHintText));
this.passwordButton.setBackground(Theme.createSelectorDrawable(LoginActivity.this.getThemedColor(Theme.key_listSelector), 1));
}
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public String getHeaderName() {
return LocaleController.getString("NewPassword", org.telegram.messenger.R.string.NewPassword);
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i >= editTextBoldCursorArr.length) {
break;
}
editTextBoldCursorArr[i].setText("");
i++;
}
this.currentParams = bundle;
this.emailCode = bundle.getString("emailCode");
String string = this.currentParams.getString("password");
this.passwordString = string;
if (string != null) {
SerializedData serializedData = new SerializedData(Utilities.hexToBytes(string));
TLRPC$account_Password TLdeserialize = TLRPC$account_Password.TLdeserialize(serializedData, serializedData.readInt32(false), false);
this.currentPassword = TLdeserialize;
TwoStepVerificationActivity.initPasswordNewAlgo(TLdeserialize);
}
this.newPassword = this.currentParams.getString("new_password");
LoginActivity.this.showKeyboard(this.codeField[0]);
this.codeField[0].requestFocus();
}
private void onPasscodeError(boolean z, int i) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
try {
this.codeField[i].performHapticFeedback(3, 2);
} catch (Exception unused) {
}
AndroidUtilities.shakeView(this.codeField[i]);
}
@Override
public void lambda$onNextPressed$14(String str) {
if (this.nextPressed) {
return;
}
String obj = this.codeField[0].getText().toString();
if (obj.length() == 0) {
onPasscodeError(false, 0);
return;
}
if (this.currentStage == 0) {
if (!obj.equals(this.codeField[1].getText().toString())) {
onPasscodeError(false, 1);
return;
}
Bundle bundle = new Bundle();
bundle.putString("emailCode", this.emailCode);
bundle.putString("new_password", obj);
bundle.putString("password", this.passwordString);
LoginActivity.this.setPage(10, true, bundle, false);
return;
}
this.nextPressed = true;
LoginActivity.this.needShowProgress(0);
recoverPassword(this.newPassword, obj);
}
private void recoverPassword(final String str, final String str2) {
final TLRPC$TL_auth_recoverPassword tLRPC$TL_auth_recoverPassword = new TLRPC$TL_auth_recoverPassword();
tLRPC$TL_auth_recoverPassword.code = this.emailCode;
if (!TextUtils.isEmpty(str)) {
tLRPC$TL_auth_recoverPassword.flags |= 1;
TLRPC$TL_account_passwordInputSettings tLRPC$TL_account_passwordInputSettings = new TLRPC$TL_account_passwordInputSettings();
tLRPC$TL_auth_recoverPassword.new_settings = tLRPC$TL_account_passwordInputSettings;
tLRPC$TL_account_passwordInputSettings.flags |= 1;
tLRPC$TL_account_passwordInputSettings.hint = str2 != null ? str2 : "";
tLRPC$TL_account_passwordInputSettings.new_algo = this.currentPassword.new_algo;
}
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$9(str, str2, tLRPC$TL_auth_recoverPassword);
}
});
}
public void lambda$recoverPassword$9(final String str, final String str2, TLRPC$TL_auth_recoverPassword tLRPC$TL_auth_recoverPassword) {
byte[] stringBytes = str != null ? AndroidUtilities.getStringBytes(str) : null;
RequestDelegate requestDelegate = new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$8(str, str2, tLObject, tLRPC$TL_error);
}
};
TLRPC$PasswordKdfAlgo tLRPC$PasswordKdfAlgo = this.currentPassword.new_algo;
if (tLRPC$PasswordKdfAlgo instanceof TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
if (str != null) {
tLRPC$TL_auth_recoverPassword.new_settings.new_password_hash = SRPHelper.getVBytes(stringBytes, (TLRPC$TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) tLRPC$PasswordKdfAlgo);
if (tLRPC$TL_auth_recoverPassword.new_settings.new_password_hash == null) {
TLRPC$TL_error tLRPC$TL_error = new TLRPC$TL_error();
tLRPC$TL_error.text = "ALGO_INVALID";
requestDelegate.run(null, tLRPC$TL_error);
}
}
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_recoverPassword, requestDelegate, 10);
return;
}
TLRPC$TL_error tLRPC$TL_error2 = new TLRPC$TL_error();
tLRPC$TL_error2.text = "PASSWORD_HASH_INVALID";
requestDelegate.run(null, tLRPC$TL_error2);
}
public void lambda$recoverPassword$8(final String str, final String str2, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$7(tLRPC$TL_error, str, str2, tLObject);
}
});
}
public void lambda$recoverPassword$7(TLRPC$TL_error tLRPC$TL_error, final String str, final String str2, final TLObject tLObject) {
String formatPluralString;
if (tLRPC$TL_error == null || (!"SRP_ID_INVALID".equals(tLRPC$TL_error.text) && !"NEW_SALT_INVALID".equals(tLRPC$TL_error.text))) {
LoginActivity.this.needHideProgress(false);
if (tLObject instanceof TLRPC$auth_Authorization) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setPositiveButton(LocaleController.getString(org.telegram.messenger.R.string.Continue), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$6(tLObject, dialogInterface, i);
}
});
if (TextUtils.isEmpty(str)) {
builder.setMessage(LocaleController.getString(org.telegram.messenger.R.string.YourPasswordReset));
} else {
builder.setMessage(LocaleController.getString(org.telegram.messenger.R.string.YourPasswordChangedSuccessText));
}
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.TwoStepVerificationTitle));
Dialog showDialog = LoginActivity.this.showDialog(builder.create());
if (showDialog != null) {
showDialog.setCanceledOnTouchOutside(false);
showDialog.setCancelable(false);
return;
}
return;
}
if (tLRPC$TL_error != null) {
this.nextPressed = false;
if (!tLRPC$TL_error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
int intValue = Utilities.parseInt((CharSequence) tLRPC$TL_error.text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.formatString("FloodWaitTime", org.telegram.messenger.R.string.FloodWaitTime, formatPluralString));
return;
}
return;
}
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(new TLRPC$TL_account_getPassword(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject2, TLRPC$TL_error tLRPC$TL_error2) {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$5(str, str2, tLObject2, tLRPC$TL_error2);
}
}, 8);
}
public void lambda$recoverPassword$5(final String str, final String str2, final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityNewPasswordView.this.lambda$recoverPassword$4(tLRPC$TL_error, tLObject, str, str2);
}
});
}
public void lambda$recoverPassword$4(TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, String str, String str2) {
if (tLRPC$TL_error == null) {
TLRPC$account_Password tLRPC$account_Password = (TLRPC$account_Password) tLObject;
this.currentPassword = tLRPC$account_Password;
TwoStepVerificationActivity.initPasswordNewAlgo(tLRPC$account_Password);
recoverPassword(str, str2);
}
}
public void lambda$recoverPassword$6(TLObject tLObject, DialogInterface dialogInterface, int i) {
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLObject);
}
@Override
public boolean onBackPressed(boolean z) {
LoginActivity.this.needHideProgress(true);
this.currentParams = null;
this.nextPressed = false;
return true;
}
@Override
public void onShow() {
super.onShow();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityNewPasswordView.this.lambda$onShow$10();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$10() {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (editTextBoldCursorArr != null) {
editTextBoldCursorArr[0].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
editTextBoldCursorArr2[0].setSelection(editTextBoldCursorArr2[0].length());
AndroidUtilities.showKeyboard(this.codeField[0]);
}
}
@Override
public void saveStateParams(Bundle bundle) {
if (this.currentParams != null) {
bundle.putBundle("recoveryview_params" + this.currentStage, this.currentParams);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
Bundle bundle2 = bundle.getBundle("recoveryview_params" + this.currentStage);
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
}
}
public class LoginActivityRegisterView extends SlideView implements ImageUpdater.ImageUpdaterDelegate {
private TLRPC$FileLocation avatar;
private AnimatorSet avatarAnimation;
private TLRPC$FileLocation avatarBig;
private AvatarDrawable avatarDrawable;
private RLottieImageView avatarEditor;
private BackupImageView avatarImage;
private View avatarOverlay;
private RadialProgressView avatarProgressView;
private RLottieDrawable cameraDrawable;
private RLottieDrawable cameraWaitDrawable;
private Bundle currentParams;
private TextView descriptionTextView;
private FrameLayout editTextContainer;
private EditTextBoldCursor firstNameField;
private OutlineTextContainerView firstNameOutlineView;
private ImageUpdater imageUpdater;
private boolean isCameraWaitAnimationAllowed;
private EditTextBoldCursor lastNameField;
private OutlineTextContainerView lastNameOutlineView;
private boolean nextPressed;
private String phoneHash;
private TextView privacyView;
private String requestPhone;
private TextView titleTextView;
private TextView wrongNumber;
@Override
public boolean canFinishFragment() {
return ImageUpdater.ImageUpdaterDelegate.CC.$default$canFinishFragment(this);
}
@Override
public void didStartUpload(boolean z) {
ImageUpdater.ImageUpdaterDelegate.CC.$default$didStartUpload(this, z);
}
@Override
public void didUploadFailed() {
ImageUpdater.ImageUpdaterDelegate.CC.$default$didUploadFailed(this);
}
@Override
public String getInitialSearchString() {
return ImageUpdater.ImageUpdaterDelegate.CC.$default$getInitialSearchString(this);
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public void onUploadProgressChanged(float f) {
ImageUpdater.ImageUpdaterDelegate.CC.$default$onUploadProgressChanged(this, f);
}
public class LinkSpan extends ClickableSpan {
public LinkSpan() {
}
@Override
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setUnderlineText(false);
}
@Override
public void onClick(View view) {
LoginActivityRegisterView.this.showTermsOfService(false);
}
}
public void showTermsOfService(boolean z) {
if (LoginActivity.this.currentTermsOfService == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("TermsOfService", org.telegram.messenger.R.string.TermsOfService));
if (z) {
builder.setPositiveButton(LocaleController.getString("Accept", org.telegram.messenger.R.string.Accept), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$0(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Decline", org.telegram.messenger.R.string.Decline), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$3(dialogInterface, i);
}
});
} else {
builder.setPositiveButton(LocaleController.getString("OK", org.telegram.messenger.R.string.OK), null);
}
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(LoginActivity.this.currentTermsOfService.text);
MessageObject.addEntitiesToText(spannableStringBuilder, LoginActivity.this.currentTermsOfService.entities, false, false, false, false);
builder.setMessage(spannableStringBuilder);
LoginActivity.this.showDialog(builder.create());
}
public void lambda$showTermsOfService$0(DialogInterface dialogInterface, int i) {
LoginActivity.this.currentTermsOfService.popup = false;
lambda$onNextPressed$14(null);
}
public void lambda$showTermsOfService$3(DialogInterface dialogInterface, int i) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("TermsOfService", org.telegram.messenger.R.string.TermsOfService));
builder.setMessage(LocaleController.getString("TosDecline", org.telegram.messenger.R.string.TosDecline));
builder.setPositiveButton(LocaleController.getString("SignUp", org.telegram.messenger.R.string.SignUp), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface2, int i2) {
LoginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$1(dialogInterface2, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Decline", org.telegram.messenger.R.string.Decline), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface2, int i2) {
LoginActivity.LoginActivityRegisterView.this.lambda$showTermsOfService$2(dialogInterface2, i2);
}
});
LoginActivity.this.showDialog(builder.create());
}
public void lambda$showTermsOfService$1(DialogInterface dialogInterface, int i) {
LoginActivity.this.currentTermsOfService.popup = false;
lambda$onNextPressed$14(null);
}
public void lambda$showTermsOfService$2(DialogInterface dialogInterface, int i) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
public LoginActivityRegisterView(Context context) {
super(context);
this.nextPressed = false;
this.isCameraWaitAnimationAllowed = true;
setOrientation(1);
ImageUpdater imageUpdater = new ImageUpdater(false, 0, false);
this.imageUpdater = imageUpdater;
imageUpdater.setOpenWithFrontfaceCamera(true);
this.imageUpdater.setSearchAvailable(false);
this.imageUpdater.setUploadAfterSelect(false);
ImageUpdater imageUpdater2 = this.imageUpdater;
imageUpdater2.parentFragment = LoginActivity.this;
imageUpdater2.setDelegate(this);
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, LayoutHelper.createLinear(78, 78, 1));
this.avatarDrawable = new AvatarDrawable();
BackupImageView backupImageView = new BackupImageView(context, LoginActivity.this) {
@Override
public void invalidate() {
if (LoginActivityRegisterView.this.avatarOverlay != null) {
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
super.invalidate();
}
@Override
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 = backupImageView;
backupImageView.setRoundRadius(AndroidUtilities.dp(64.0f));
this.avatarDrawable.setAvatarType(13);
this.avatarDrawable.setInfo(5L, null, null);
this.avatarImage.setImageDrawable(this.avatarDrawable);
frameLayout.addView(this.avatarImage, LayoutHelper.createFrame(-1, -1.0f));
Paint paint = new Paint(1);
paint.setColor(1426063360);
View view = new View(context, LoginActivity.this, paint) {
final Paint val$paint;
{
this.val$paint = paint;
}
@Override
protected void onDraw(Canvas canvas) {
if (LoginActivityRegisterView.this.avatarImage == null || LoginActivityRegisterView.this.avatarProgressView.getVisibility() != 0) {
return;
}
this.val$paint.setAlpha((int) (LoginActivityRegisterView.this.avatarImage.getImageReceiver().getCurrentAlpha() * 85.0f * LoginActivityRegisterView.this.avatarProgressView.getAlpha()));
canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, this.val$paint);
}
};
this.avatarOverlay = view;
frameLayout.addView(view, LayoutHelper.createFrame(-1, -1.0f));
this.avatarOverlay.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
LoginActivity.LoginActivityRegisterView.this.lambda$new$7(view2);
}
});
int i = org.telegram.messenger.R.raw.camera;
this.cameraDrawable = new RLottieDrawable(i, String.valueOf(i), AndroidUtilities.dp(70.0f), AndroidUtilities.dp(70.0f), false, null);
int i2 = org.telegram.messenger.R.raw.camera_wait;
this.cameraWaitDrawable = new RLottieDrawable(i2, String.valueOf(i2), AndroidUtilities.dp(70.0f), AndroidUtilities.dp(70.0f), false, null);
RLottieImageView rLottieImageView = new RLottieImageView(context, LoginActivity.this) {
@Override
public void invalidate(int i3, int i4, int i5, int i6) {
super.invalidate(i3, i4, i5, i6);
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
@Override
public void invalidate() {
super.invalidate();
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
};
this.avatarEditor = rLottieImageView;
rLottieImageView.setScaleType(ImageView.ScaleType.CENTER);
this.avatarEditor.setAnimation(this.cameraDrawable);
this.avatarEditor.setEnabled(false);
this.avatarEditor.setClickable(false);
frameLayout.addView(this.avatarEditor, LayoutHelper.createFrame(-1, -1.0f));
this.avatarEditor.addOnAttachStateChangeListener(new AnonymousClass4(LoginActivity.this));
RadialProgressView radialProgressView = new RadialProgressView(context, LoginActivity.this) {
@Override
public void setAlpha(float f) {
super.setAlpha(f);
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
};
this.avatarProgressView = radialProgressView;
radialProgressView.setSize(AndroidUtilities.dp(30.0f));
this.avatarProgressView.setProgressColor(-1);
frameLayout.addView(this.avatarProgressView, LayoutHelper.createFrame(-1, -1.0f));
showAvatarProgress(false, false);
TextView textView = new TextView(context);
this.titleTextView = textView;
textView.setText(LocaleController.getString(org.telegram.messenger.R.string.RegistrationProfileInfo));
this.titleTextView.setTextSize(1, 18.0f);
this.titleTextView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.titleTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.titleTextView.setGravity(1);
addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 1, 8, 12, 8, 0));
TextView textView2 = new TextView(context);
this.descriptionTextView = textView2;
textView2.setText(LocaleController.getString("RegisterText2", org.telegram.messenger.R.string.RegisterText2));
this.descriptionTextView.setGravity(1);
this.descriptionTextView.setTextSize(1, 14.0f);
this.descriptionTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.descriptionTextView, LayoutHelper.createLinear(-2, -2, 1, 8, 6, 8, 0));
FrameLayout frameLayout2 = new FrameLayout(context);
this.editTextContainer = frameLayout2;
addView(frameLayout2, LayoutHelper.createLinear(-1, -2, 8.0f, 21.0f, 8.0f, 0.0f));
OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context);
this.firstNameOutlineView = outlineTextContainerView;
outlineTextContainerView.setText(LocaleController.getString(org.telegram.messenger.R.string.FirstName));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.firstNameField = editTextBoldCursor;
editTextBoldCursor.setCursorSize(AndroidUtilities.dp(20.0f));
this.firstNameField.setCursorWidth(1.5f);
this.firstNameField.setImeOptions(268435461);
this.firstNameField.setTextSize(1, 17.0f);
this.firstNameField.setMaxLines(1);
this.firstNameField.setInputType(LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM);
this.firstNameField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view2, boolean z) {
LoginActivity.LoginActivityRegisterView.this.lambda$new$8(view2, z);
}
});
this.firstNameField.setBackground(null);
this.firstNameField.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.firstNameOutlineView.attachEditText(this.firstNameField);
this.firstNameOutlineView.addView(this.firstNameField, LayoutHelper.createFrame(-1, -2, 48));
this.firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i3, KeyEvent keyEvent) {
boolean lambda$new$9;
lambda$new$9 = LoginActivity.LoginActivityRegisterView.this.lambda$new$9(textView3, i3, keyEvent);
return lambda$new$9;
}
});
OutlineTextContainerView outlineTextContainerView2 = new OutlineTextContainerView(context);
this.lastNameOutlineView = outlineTextContainerView2;
outlineTextContainerView2.setText(LocaleController.getString(org.telegram.messenger.R.string.LastName));
EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
this.lastNameField = editTextBoldCursor2;
editTextBoldCursor2.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(LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM);
this.lastNameField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view2, boolean z) {
LoginActivity.LoginActivityRegisterView.this.lambda$new$10(view2, z);
}
});
this.lastNameField.setBackground(null);
this.lastNameField.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
this.lastNameOutlineView.attachEditText(this.lastNameField);
this.lastNameOutlineView.addView(this.lastNameField, LayoutHelper.createFrame(-1, -2, 48));
this.lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i3, KeyEvent keyEvent) {
boolean lambda$new$11;
lambda$new$11 = LoginActivity.LoginActivityRegisterView.this.lambda$new$11(textView3, i3, keyEvent);
return lambda$new$11;
}
});
buildEditTextLayout(AndroidUtilities.isSmallScreen());
TextView textView3 = new TextView(context);
this.wrongNumber = textView3;
textView3.setText(LocaleController.getString("CancelRegistration", org.telegram.messenger.R.string.CancelRegistration));
this.wrongNumber.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
this.wrongNumber.setTextSize(1, 14.0f);
this.wrongNumber.setLineSpacing(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() {
@Override
public final void onClick(View view2) {
LoginActivity.LoginActivityRegisterView.this.lambda$new$12(view2);
}
});
FrameLayout frameLayout3 = new FrameLayout(context);
addView(frameLayout3, LayoutHelper.createLinear(-1, -1, 83));
TextView textView4 = new TextView(context);
this.privacyView = textView4;
textView4.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
this.privacyView.setTextSize(1, AndroidUtilities.isSmallScreen() ? 13.0f : 14.0f);
this.privacyView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.privacyView.setGravity(16);
frameLayout3.addView(this.privacyView, LayoutHelper.createFrame(-2, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, 83, 14.0f, 0.0f, 70.0f, 32.0f));
VerticalPositionAutoAnimator.attach(this.privacyView);
String string = LocaleController.getString("TermsOfServiceLogin", org.telegram.messenger.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 void lambda$new$7(View view) {
this.imageUpdater.openMenu(this.avatar != null, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$new$4();
}
}, new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
LoginActivity.LoginActivityRegisterView.this.lambda$new$6(dialogInterface);
}
}, 0);
this.isCameraWaitAnimationAllowed = false;
this.avatarEditor.setAnimation(this.cameraDrawable);
this.cameraDrawable.setCurrentFrame(0);
this.cameraDrawable.setCustomEndFrame(43);
this.avatarEditor.playAnimation();
}
public void lambda$new$4() {
this.avatar = null;
this.avatarBig = null;
showAvatarProgress(false, true);
this.avatarImage.setImage((ImageLocation) null, (String) null, this.avatarDrawable, (Object) null);
this.avatarEditor.setAnimation(this.cameraDrawable);
this.cameraDrawable.setCurrentFrame(0);
this.isCameraWaitAnimationAllowed = true;
}
public void lambda$new$6(DialogInterface dialogInterface) {
if (!this.imageUpdater.isUploadingImage()) {
this.avatarEditor.setAnimation(this.cameraDrawable);
this.cameraDrawable.setCustomEndFrame(86);
this.avatarEditor.setOnAnimationEndListener(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$new$5();
}
});
this.avatarEditor.playAnimation();
return;
}
this.avatarEditor.setAnimation(this.cameraDrawable);
this.cameraDrawable.setCurrentFrame(0, false);
this.isCameraWaitAnimationAllowed = true;
}
public void lambda$new$5() {
this.isCameraWaitAnimationAllowed = true;
}
public class AnonymousClass4 implements View.OnAttachStateChangeListener {
private boolean isAttached;
private long lastRun = System.currentTimeMillis();
private Runnable cameraWaitCallback = new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.AnonymousClass4.this.lambda$$2();
}
};
AnonymousClass4(LoginActivity loginActivity) {
}
public void lambda$$2() {
if (this.isAttached) {
if (LoginActivityRegisterView.this.isCameraWaitAnimationAllowed && System.currentTimeMillis() - this.lastRun >= 10000) {
LoginActivityRegisterView.this.avatarEditor.setAnimation(LoginActivityRegisterView.this.cameraWaitDrawable);
LoginActivityRegisterView.this.cameraWaitDrawable.setCurrentFrame(0, false);
LoginActivityRegisterView.this.cameraWaitDrawable.setOnAnimationEndListener(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.AnonymousClass4.this.lambda$$1();
}
});
LoginActivityRegisterView.this.avatarEditor.playAnimation();
this.lastRun = System.currentTimeMillis();
}
LoginActivityRegisterView.this.avatarEditor.postDelayed(this.cameraWaitCallback, 1000L);
}
}
public void lambda$$1() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.AnonymousClass4.this.lambda$$0();
}
});
}
public void lambda$$0() {
LoginActivityRegisterView.this.cameraDrawable.setCurrentFrame(0, false);
LoginActivityRegisterView.this.avatarEditor.setAnimation(LoginActivityRegisterView.this.cameraDrawable);
}
@Override
public void onViewAttachedToWindow(View view) {
this.isAttached = true;
view.post(this.cameraWaitCallback);
}
@Override
public void onViewDetachedFromWindow(View view) {
this.isAttached = false;
view.removeCallbacks(this.cameraWaitCallback);
}
}
public void lambda$new$8(View view, boolean z) {
this.firstNameOutlineView.animateSelection(z ? 1.0f : 0.0f);
}
public boolean lambda$new$9(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
this.lastNameField.requestFocus();
return true;
}
public void lambda$new$10(View view, boolean z) {
this.lastNameOutlineView.animateSelection(z ? 1.0f : 0.0f);
}
public boolean lambda$new$11(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6 && i != 5) {
return false;
}
lambda$onNextPressed$14(null);
return true;
}
public void lambda$new$12(View view) {
if (LoginActivity.this.radialProgressView.getTag() != null) {
return;
}
onBackPressed(false);
}
@Override
public void updateColors() {
this.avatarDrawable.invalidateSelf();
TextView textView = this.titleTextView;
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i));
TextView textView2 = this.descriptionTextView;
int i2 = Theme.key_windowBackgroundWhiteGrayText6;
textView2.setTextColor(Theme.getColor(i2));
this.firstNameField.setTextColor(Theme.getColor(i));
EditTextBoldCursor editTextBoldCursor = this.firstNameField;
int i3 = Theme.key_windowBackgroundWhiteInputFieldActivated;
editTextBoldCursor.setCursorColor(Theme.getColor(i3));
this.lastNameField.setTextColor(Theme.getColor(i));
this.lastNameField.setCursorColor(Theme.getColor(i3));
this.wrongNumber.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.privacyView.setTextColor(Theme.getColor(i2));
this.privacyView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkText));
this.firstNameOutlineView.updateColor();
this.lastNameOutlineView.updateColor();
}
private void buildEditTextLayout(boolean z) {
boolean hasFocus = this.firstNameField.hasFocus();
boolean hasFocus2 = this.lastNameField.hasFocus();
this.editTextContainer.removeAllViews();
if (z) {
LinearLayout linearLayout = new LinearLayout(LoginActivity.this.getParentActivity());
linearLayout.setOrientation(0);
this.firstNameOutlineView.setText(LocaleController.getString(org.telegram.messenger.R.string.FirstNameSmall));
this.lastNameOutlineView.setText(LocaleController.getString(org.telegram.messenger.R.string.LastNameSmall));
linearLayout.addView(this.firstNameOutlineView, LayoutHelper.createLinear(0, -2, 1.0f, 0, 0, 8, 0));
linearLayout.addView(this.lastNameOutlineView, LayoutHelper.createLinear(0, -2, 1.0f, 8, 0, 0, 0));
this.editTextContainer.addView(linearLayout);
if (hasFocus) {
this.firstNameField.requestFocus();
AndroidUtilities.showKeyboard(this.firstNameField);
return;
} else {
if (hasFocus2) {
this.lastNameField.requestFocus();
AndroidUtilities.showKeyboard(this.lastNameField);
return;
}
return;
}
}
this.firstNameOutlineView.setText(LocaleController.getString(org.telegram.messenger.R.string.FirstName));
this.lastNameOutlineView.setText(LocaleController.getString(org.telegram.messenger.R.string.LastName));
this.editTextContainer.addView(this.firstNameOutlineView, LayoutHelper.createFrame(-1, -2.0f, 48, 8.0f, 0.0f, 8.0f, 0.0f));
this.editTextContainer.addView(this.lastNameOutlineView, LayoutHelper.createFrame(-1, -2.0f, 48, 8.0f, 82.0f, 8.0f, 0.0f));
}
@Override
public void didUploadPhoto(TLRPC$InputFile tLRPC$InputFile, TLRPC$InputFile tLRPC$InputFile2, double d, String str, final TLRPC$PhotoSize tLRPC$PhotoSize, final TLRPC$PhotoSize tLRPC$PhotoSize2, boolean z, TLRPC$VideoSize tLRPC$VideoSize) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$didUploadPhoto$13(tLRPC$PhotoSize2, tLRPC$PhotoSize);
}
});
}
public void lambda$didUploadPhoto$13(TLRPC$PhotoSize tLRPC$PhotoSize, TLRPC$PhotoSize tLRPC$PhotoSize2) {
TLRPC$FileLocation tLRPC$FileLocation = tLRPC$PhotoSize.location;
this.avatar = tLRPC$FileLocation;
this.avatarBig = tLRPC$PhotoSize2.location;
this.avatarImage.setImage(ImageLocation.getForLocal(tLRPC$FileLocation), "50_50", this.avatarDrawable, (Object) null);
}
private void showAvatarProgress(final boolean z, boolean z2) {
if (this.avatarEditor == null) {
return;
}
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, (Property<RLottieImageView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.avatarProgressView, (Property<RadialProgressView, Float>) View.ALPHA, 1.0f));
} else {
this.avatarEditor.setVisibility(0);
this.avatarAnimation.playTogether(ObjectAnimator.ofFloat(this.avatarEditor, (Property<RLottieImageView, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.avatarProgressView, (Property<RadialProgressView, Float>) View.ALPHA, 0.0f));
}
this.avatarAnimation.setDuration(180L);
this.avatarAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (LoginActivityRegisterView.this.avatarAnimation == null || LoginActivityRegisterView.this.avatarEditor == null) {
return;
}
if (z) {
LoginActivityRegisterView.this.avatarEditor.setVisibility(4);
} else {
LoginActivityRegisterView.this.avatarProgressView.setVisibility(4);
}
LoginActivityRegisterView.this.avatarAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
LoginActivityRegisterView.this.avatarAnimation = null;
}
});
this.avatarAnimation.start();
return;
}
if (z) {
this.avatarEditor.setAlpha(1.0f);
this.avatarEditor.setVisibility(4);
this.avatarProgressView.setAlpha(1.0f);
this.avatarProgressView.setVisibility(0);
return;
}
this.avatarEditor.setAlpha(1.0f);
this.avatarEditor.setVisibility(0);
this.avatarProgressView.setAlpha(0.0f);
this.avatarProgressView.setVisibility(4);
}
@Override
public boolean onBackPressed(boolean z) {
if (z) {
LoginActivity.this.needHideProgress(true);
this.nextPressed = false;
this.currentParams = null;
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString(org.telegram.messenger.R.string.Warning));
builder.setMessage(LocaleController.getString("AreYouSureRegistration", org.telegram.messenger.R.string.AreYouSureRegistration));
builder.setNegativeButton(LocaleController.getString("Stop", org.telegram.messenger.R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.lambda$onBackPressed$14(dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("Continue", org.telegram.messenger.R.string.Continue), null);
LoginActivity.this.showDialog(builder.create());
return false;
}
public void lambda$onBackPressed$14(DialogInterface dialogInterface, int i) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
hidePrivacyView();
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourName", org.telegram.messenger.R.string.YourName);
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void onShow() {
super.onShow();
if (this.privacyView != null) {
if (LoginActivity.this.restoringState) {
this.privacyView.setAlpha(1.0f);
} else {
this.privacyView.setAlpha(0.0f);
this.privacyView.animate().alpha(1.0f).setDuration(200L).setStartDelay(300L).setInterpolator(AndroidUtilities.decelerateInterpolator).start();
}
}
EditTextBoldCursor editTextBoldCursor = this.firstNameField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.firstNameField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
AndroidUtilities.showKeyboard(this.firstNameField);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$onShow$15();
}
}, LoginActivity.SHOW_DELAY);
}
public void lambda$onShow$15() {
EditTextBoldCursor editTextBoldCursor = this.firstNameField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.firstNameField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
AndroidUtilities.showKeyboard(this.firstNameField);
}
}
@Override
public void setParams(Bundle bundle, boolean z) {
if (bundle == null) {
return;
}
this.firstNameField.setText("");
this.lastNameField.setText("");
this.requestPhone = bundle.getString("phoneFormated");
this.phoneHash = bundle.getString("phoneHash");
this.currentParams = bundle;
}
@Override
public void lambda$onNextPressed$14(String str) {
if (this.nextPressed) {
return;
}
if (LoginActivity.this.currentTermsOfService != null && LoginActivity.this.currentTermsOfService.popup) {
showTermsOfService(true);
return;
}
if (this.firstNameField.length() == 0) {
LoginActivity.this.onFieldError(this.firstNameOutlineView, true);
return;
}
this.nextPressed = true;
TLRPC$TL_auth_signUp tLRPC$TL_auth_signUp = new TLRPC$TL_auth_signUp();
tLRPC$TL_auth_signUp.phone_code_hash = this.phoneHash;
tLRPC$TL_auth_signUp.phone_number = this.requestPhone;
tLRPC$TL_auth_signUp.first_name = this.firstNameField.getText().toString();
tLRPC$TL_auth_signUp.last_name = this.lastNameField.getText().toString();
LoginActivity.this.needShowProgress(0);
ConnectionsManager.getInstance(((BaseFragment) LoginActivity.this).currentAccount).sendRequest(tLRPC$TL_auth_signUp, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.LoginActivityRegisterView.this.lambda$onNextPressed$19(tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$onNextPressed$19(final TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$onNextPressed$18(tLObject, tLRPC$TL_error);
}
});
}
public void lambda$onNextPressed$18(final TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
this.nextPressed = false;
if (!(tLObject instanceof TLRPC$TL_auth_authorization)) {
LoginActivity.this.needHideProgress(false);
if (tLRPC$TL_error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidPhoneNumber", org.telegram.messenger.R.string.InvalidPhoneNumber));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_CODE_EMPTY") || tLRPC$TL_error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", org.telegram.messenger.R.string.InvalidCode));
return;
}
if (tLRPC$TL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", org.telegram.messenger.R.string.CodeExpired));
return;
} else if (tLRPC$TL_error.text.contains("FIRSTNAME_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidFirstName", org.telegram.messenger.R.string.InvalidFirstName));
return;
} else if (tLRPC$TL_error.text.contains("LASTNAME_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidLastName", org.telegram.messenger.R.string.InvalidLastName));
return;
} else {
LoginActivity.this.needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
return;
}
}
hidePrivacyView();
LoginActivity.this.showDoneButton(false, true);
postDelayed(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$onNextPressed$17(tLObject);
}
}, 150L);
}
public void lambda$onNextPressed$17(TLObject tLObject) {
LoginActivity.this.needHideProgress(false, false);
AndroidUtilities.hideKeyboard(LoginActivity.this.fragmentView.findFocus());
LoginActivity.this.onAuthSuccess((TLRPC$TL_auth_authorization) tLObject, true);
final TLRPC$FileLocation tLRPC$FileLocation = this.avatarBig;
if (tLRPC$FileLocation != null) {
Utilities.cacheClearQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.lambda$onNextPressed$16(tLRPC$FileLocation);
}
});
}
}
public void lambda$onNextPressed$16(TLRPC$FileLocation tLRPC$FileLocation) {
MessagesController.getInstance(((BaseFragment) LoginActivity.this).currentAccount).uploadAndApplyUserAvatar(tLRPC$FileLocation);
}
@Override
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 (LoginActivity.this.currentTermsOfService != null) {
SerializedData serializedData = new SerializedData(LoginActivity.this.currentTermsOfService.getObjectSize());
LoginActivity.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
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);
LoginActivity.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);
}
}
private void hidePrivacyView() {
this.privacyView.animate().alpha(0.0f).setDuration(150L).setStartDelay(0L).setInterpolator(AndroidUtilities.accelerateInterpolator).start();
}
}
public boolean showKeyboard(View view) {
if (isCustomKeyboardVisible()) {
return true;
}
return AndroidUtilities.showKeyboard(view);
}
public LoginActivity setIntroView(View view, TextView textView) {
this.introView = view;
this.startMessagingButton = textView;
this.isAnimatingIntro = true;
return this;
}
@Override
public AnimatorSet onCustomTransitionAnimation(boolean z, final Runnable runnable) {
if (!z || this.introView == null) {
return null;
}
if (this.fragmentView.getParent() instanceof View) {
((View) this.fragmentView.getParent()).setTranslationX(0.0f);
}
final TransformableLoginButtonView transformableLoginButtonView = new TransformableLoginButtonView(this.fragmentView.getContext());
transformableLoginButtonView.setButtonText(this.startMessagingButton.getPaint(), this.startMessagingButton.getText().toString());
final int width = this.startMessagingButton.getWidth();
final int height = this.startMessagingButton.getHeight();
final int i = this.floatingButtonIcon.getLayoutParams().width;
final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(width, height);
transformableLoginButtonView.setLayoutParams(layoutParams);
int[] iArr = new int[2];
this.fragmentView.getLocationInWindow(iArr);
int i2 = iArr[0];
int i3 = iArr[1];
this.startMessagingButton.getLocationInWindow(iArr);
final float f = iArr[0] - i2;
final float f2 = iArr[1] - i3;
transformableLoginButtonView.setTranslationX(f);
transformableLoginButtonView.setTranslationY(f2);
final int width2 = (((getParentLayout().getView().getWidth() - this.floatingButtonIcon.getLayoutParams().width) - ((ViewGroup.MarginLayoutParams) this.floatingButtonContainer.getLayoutParams()).rightMargin) - getParentLayout().getView().getPaddingLeft()) - getParentLayout().getView().getPaddingRight();
final int height2 = ((((getParentLayout().getView().getHeight() - this.floatingButtonIcon.getLayoutParams().height) - ((ViewGroup.MarginLayoutParams) this.floatingButtonContainer.getLayoutParams()).bottomMargin) - (isCustomKeyboardVisible() ? AndroidUtilities.dp(230.0f) : 0)) - getParentLayout().getView().getPaddingTop()) - getParentLayout().getView().getPaddingBottom();
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
LoginActivity.this.floatingButtonContainer.setVisibility(4);
LoginActivity.this.keyboardLinearLayout.setAlpha(0.0f);
LoginActivity.this.fragmentView.setBackgroundColor(0);
LoginActivity.this.startMessagingButton.setVisibility(4);
((FrameLayout) LoginActivity.this.fragmentView).addView(transformableLoginButtonView);
}
@Override
public void onAnimationEnd(Animator animator) {
LoginActivity.this.keyboardLinearLayout.setAlpha(1.0f);
LoginActivity.this.startMessagingButton.setVisibility(0);
LoginActivity.this.fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
LoginActivity.this.floatingButtonContainer.setVisibility(0);
((FrameLayout) LoginActivity.this.fragmentView).removeView(transformableLoginButtonView);
if (LoginActivity.this.animationFinishCallback != null) {
AndroidUtilities.runOnUIThread(LoginActivity.this.animationFinishCallback);
LoginActivity.this.animationFinishCallback = null;
}
LoginActivity.this.isAnimatingIntro = false;
runnable.run();
}
});
final int color = Theme.getColor(Theme.key_windowBackgroundWhite);
final int alpha = Color.alpha(color);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.this.lambda$onCustomTransitionAnimation$27(color, alpha, layoutParams, width, i, height, transformableLoginButtonView, f, width2, f2, height2, valueAnimator);
}
});
ofFloat.setInterpolator(CubicBezierInterpolator.DEFAULT);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(300L);
animatorSet.playTogether(ofFloat);
animatorSet.start();
return animatorSet;
}
public void lambda$onCustomTransitionAnimation$27(int i, int i2, ViewGroup.MarginLayoutParams marginLayoutParams, int i3, int i4, int i5, TransformableLoginButtonView transformableLoginButtonView, float f, int i6, float f2, int i7, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.keyboardLinearLayout.setAlpha(floatValue);
this.fragmentView.setBackgroundColor(ColorUtils.setAlphaComponent(i, (int) (i2 * floatValue)));
float f3 = 1.0f - floatValue;
this.slideViewsContainer.setTranslationY(AndroidUtilities.dp(20.0f) * f3);
if (!isCustomKeyboardForceDisabled()) {
this.keyboardView.setTranslationY(r4.getLayoutParams().height * f3);
this.floatingButtonContainer.setTranslationY(this.keyboardView.getLayoutParams().height * f3);
}
this.introView.setTranslationY((-AndroidUtilities.dp(20.0f)) * floatValue);
float f4 = (f3 * 0.05f) + 0.95f;
this.introView.setScaleX(f4);
this.introView.setScaleY(f4);
marginLayoutParams.width = (int) (i3 + ((i4 - i3) * floatValue));
marginLayoutParams.height = (int) (i5 + ((i4 - i5) * floatValue));
transformableLoginButtonView.requestLayout();
transformableLoginButtonView.setProgress(floatValue);
transformableLoginButtonView.setTranslationX(f + ((i6 - f) * floatValue));
transformableLoginButtonView.setTranslationY(f2 + ((i7 - f2) * floatValue));
}
public void updateColors() {
this.fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
Activity parentActivity = getParentActivity();
int dp = AndroidUtilities.dp(56.0f);
int i = Theme.key_chats_actionBackground;
Drawable createSimpleSelectorCircleDrawable = Theme.createSimpleSelectorCircleDrawable(dp, Theme.getColor(i), Theme.getColor(Theme.key_chats_actionPressedBackground));
if (Build.VERSION.SDK_INT < 21) {
Drawable mutate = parentActivity.getResources().getDrawable(org.telegram.messenger.R.drawable.floating_shadow).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, createSimpleSelectorCircleDrawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
createSimpleSelectorCircleDrawable = combinedDrawable;
}
this.floatingButtonContainer.setBackground(createSimpleSelectorCircleDrawable);
ImageView imageView = this.backButtonView;
int i2 = Theme.key_windowBackgroundWhiteBlackText;
imageView.setColorFilter(Theme.getColor(i2));
ImageView imageView2 = this.backButtonView;
int i3 = Theme.key_listSelector;
imageView2.setBackground(Theme.createSelectorDrawable(Theme.getColor(i3)));
this.proxyDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(i2), PorterDuff.Mode.SRC_IN));
this.proxyDrawable.setColorKey(i2);
this.proxyButtonView.setBackground(Theme.createSelectorDrawable(Theme.getColor(i3)));
this.radialProgressView.setProgressColor(Theme.getColor(i));
TransformableLoginButtonView transformableLoginButtonView = this.floatingButtonIcon;
int i4 = Theme.key_chats_actionIcon;
transformableLoginButtonView.setColor(Theme.getColor(i4));
this.floatingButtonIcon.setBackgroundColor(Theme.getColor(i));
this.floatingProgressView.setProgressColor(Theme.getColor(i4));
for (SlideView slideView : this.views) {
slideView.updateColors();
}
this.keyboardView.updateColors();
PhoneNumberConfirmView phoneNumberConfirmView = this.phoneNumberConfirmView;
if (phoneNumberConfirmView != null) {
phoneNumberConfirmView.updateColors();
}
}
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
return SimpleThemeDescription.createThemeDescriptions(new ThemeDescription.ThemeDescriptionDelegate() {
@Override
public final void didSetColor() {
LoginActivity.this.updateColors();
}
@Override
public void onAnimationProgress(float f) {
ThemeDescription.ThemeDescriptionDelegate.CC.$default$onAnimationProgress(this, f);
}
}, Theme.key_windowBackgroundWhiteBlackText, Theme.key_windowBackgroundWhiteGrayText6, Theme.key_windowBackgroundWhiteHintText, Theme.key_listSelector, Theme.key_chats_actionBackground, Theme.key_chats_actionIcon, Theme.key_windowBackgroundWhiteInputField, Theme.key_windowBackgroundWhiteInputFieldActivated, Theme.key_windowBackgroundWhiteValueText, Theme.key_text_RedBold, Theme.key_windowBackgroundWhiteGrayText, Theme.key_checkbox, Theme.key_windowBackgroundWhiteBlueText4, Theme.key_changephoneinfo_image2, Theme.key_chats_actionPressedBackground, Theme.key_text_RedRegular, Theme.key_windowBackgroundWhiteLinkText, Theme.key_checkboxSquareUnchecked, Theme.key_checkboxSquareBackground, Theme.key_checkboxSquareCheck, Theme.key_dialogBackground, Theme.key_dialogTextGray2, Theme.key_dialogTextBlack);
}
public void tryResetAccount(final String str, final String str2, final String str3) {
if (this.radialProgressView.getTag() != null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("ResetMyAccountWarningText", org.telegram.messenger.R.string.ResetMyAccountWarningText));
builder.setTitle(LocaleController.getString("ResetMyAccountWarning", org.telegram.messenger.R.string.ResetMyAccountWarning));
builder.setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", org.telegram.messenger.R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.this.lambda$tryResetAccount$30(str, str2, str3, dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", org.telegram.messenger.R.string.Cancel), null);
showDialog(builder.create());
}
public void lambda$tryResetAccount$30(final String str, final String str2, final String str3, DialogInterface dialogInterface, int i) {
needShowProgress(0);
TLRPC$TL_account_deleteAccount tLRPC$TL_account_deleteAccount = new TLRPC$TL_account_deleteAccount();
tLRPC$TL_account_deleteAccount.reason = "Forgot password";
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tLRPC$TL_account_deleteAccount, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
LoginActivity.this.lambda$tryResetAccount$29(str, str2, str3, tLObject, tLRPC$TL_error);
}
}, 10);
}
public void lambda$tryResetAccount$29(final String str, final String str2, final String str3, TLObject tLObject, final TLRPC$TL_error tLRPC$TL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$tryResetAccount$28(tLRPC$TL_error, str, str2, str3);
}
});
}
public void lambda$tryResetAccount$28(TLRPC$TL_error tLRPC$TL_error, String str, String str2, String str3) {
needHideProgress(false);
if (tLRPC$TL_error == null) {
if (str == null || str2 == null || str3 == null) {
setPage(0, true, null, true);
return;
}
Bundle bundle = new Bundle();
bundle.putString("phoneFormated", str);
bundle.putString("phoneHash", str2);
bundle.putString("code", str3);
setPage(5, true, bundle, false);
return;
}
if (tLRPC$TL_error.text.equals("2FA_RECENT_CONFIRM")) {
needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), LocaleController.getString("ResetAccountCancelledAlert", org.telegram.messenger.R.string.ResetAccountCancelledAlert));
return;
}
if (tLRPC$TL_error.text.startsWith("2FA_CONFIRM_WAIT_")) {
Bundle bundle2 = new Bundle();
bundle2.putString("phoneFormated", str);
bundle2.putString("phoneHash", str2);
bundle2.putString("code", str3);
bundle2.putInt("startTime", ConnectionsManager.getInstance(this.currentAccount).getCurrentTime());
bundle2.putInt("waitTime", Utilities.parseInt((CharSequence) tLRPC$TL_error.text.replace("2FA_CONFIRM_WAIT_", "")).intValue());
setPage(8, true, bundle2, false);
return;
}
needShowAlert(LocaleController.getString(org.telegram.messenger.R.string.RestorePasswordNoEmailTitle), tLRPC$TL_error.text);
}
public static final class PhoneNumberConfirmView extends FrameLayout {
private View blurredView;
private IConfirmDialogCallback callback;
private TextView confirmMessageView;
private TextView confirmTextView;
private View dimmView;
private boolean dismissed;
private TextView editTextView;
private View fabContainer;
private TransformableLoginButtonView fabTransform;
private RadialProgressView floatingProgressView;
private ViewGroup fragmentView;
private TextView numberView;
private FrameLayout popupFabContainer;
private FrameLayout popupLayout;
public interface IConfirmDialogCallback {
void onConfirmPressed(PhoneNumberConfirmView phoneNumberConfirmView, TextView textView);
void onDismiss(PhoneNumberConfirmView phoneNumberConfirmView);
void onEditPressed(PhoneNumberConfirmView phoneNumberConfirmView, TextView textView);
void onFabPressed(PhoneNumberConfirmView phoneNumberConfirmView, TransformableLoginButtonView transformableLoginButtonView);
}
private PhoneNumberConfirmView(Context context, ViewGroup viewGroup, View view, String str, final IConfirmDialogCallback iConfirmDialogCallback) {
super(context);
this.fragmentView = viewGroup;
this.fabContainer = view;
this.callback = iConfirmDialogCallback;
View view2 = new View(getContext());
this.blurredView = view2;
view2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
LoginActivity.PhoneNumberConfirmView.this.lambda$new$0(view3);
}
});
addView(this.blurredView, LayoutHelper.createFrame(-1, -1.0f));
View view3 = new View(getContext());
this.dimmView = view3;
view3.setBackgroundColor(1073741824);
this.dimmView.setAlpha(0.0f);
addView(this.dimmView, LayoutHelper.createFrame(-1, -1.0f));
TransformableLoginButtonView transformableLoginButtonView = new TransformableLoginButtonView(getContext());
this.fabTransform = transformableLoginButtonView;
transformableLoginButtonView.setTransformType(1);
this.fabTransform.setDrawBackground(false);
FrameLayout frameLayout = new FrameLayout(context);
this.popupFabContainer = frameLayout;
frameLayout.addView(this.fabTransform, LayoutHelper.createFrame(-1, -1.0f));
this.popupFabContainer.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view4) {
LoginActivity.PhoneNumberConfirmView.this.lambda$new$1(iConfirmDialogCallback, view4);
}
});
RadialProgressView radialProgressView = new RadialProgressView(context);
this.floatingProgressView = radialProgressView;
radialProgressView.setSize(AndroidUtilities.dp(22.0f));
this.floatingProgressView.setAlpha(0.0f);
this.floatingProgressView.setScaleX(0.1f);
this.floatingProgressView.setScaleY(0.1f);
this.popupFabContainer.addView(this.floatingProgressView, LayoutHelper.createFrame(-1, -1.0f));
this.popupFabContainer.setContentDescription(LocaleController.getString(org.telegram.messenger.R.string.Done));
View view4 = this.popupFabContainer;
int i = Build.VERSION.SDK_INT;
addView(view4, LayoutHelper.createFrame(i >= 21 ? 56 : 60, i >= 21 ? 56.0f : 60.0f));
FrameLayout frameLayout2 = new FrameLayout(context);
this.popupLayout = frameLayout2;
addView(frameLayout2, LayoutHelper.createFrame(-1, 140.0f, 49, 24.0f, 0.0f, 24.0f, 0.0f));
TextView textView = new TextView(context);
this.confirmMessageView = textView;
textView.setText(LocaleController.getString(org.telegram.messenger.R.string.ConfirmCorrectNumber));
this.confirmMessageView.setTextSize(1, 14.0f);
this.confirmMessageView.setSingleLine();
this.popupLayout.addView(this.confirmMessageView, LayoutHelper.createFrame(-1, -2.0f, LocaleController.isRTL ? 5 : 3, 24.0f, 20.0f, 24.0f, 0.0f));
TextView textView2 = new TextView(context);
this.numberView = textView2;
textView2.setText(str);
this.numberView.setTextSize(1, 18.0f);
this.numberView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
this.numberView.setSingleLine();
this.popupLayout.addView(this.numberView, LayoutHelper.createFrame(-1, -2.0f, LocaleController.isRTL ? 5 : 3, 24.0f, 48.0f, 24.0f, 0.0f));
int dp = AndroidUtilities.dp(16.0f);
TextView textView3 = new TextView(context);
this.editTextView = textView3;
textView3.setText(LocaleController.getString(org.telegram.messenger.R.string.Edit));
this.editTextView.setSingleLine();
this.editTextView.setTextSize(1, 16.0f);
TextView textView4 = this.editTextView;
int dp2 = AndroidUtilities.dp(6.0f);
int i2 = Theme.key_changephoneinfo_image2;
textView4.setBackground(Theme.getRoundRectSelectorDrawable(dp2, Theme.getColor(i2)));
this.editTextView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
LoginActivity.PhoneNumberConfirmView.this.lambda$new$2(iConfirmDialogCallback, view5);
}
});
this.editTextView.setTypeface(Typeface.DEFAULT_BOLD);
int i3 = dp / 2;
this.editTextView.setPadding(dp, i3, dp, i3);
float f = 8;
this.popupLayout.addView(this.editTextView, LayoutHelper.createFrame(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 80, f, f, f, f));
TextView textView5 = new TextView(context);
this.confirmTextView = textView5;
textView5.setText(LocaleController.getString(org.telegram.messenger.R.string.CheckPhoneNumberYes));
this.confirmTextView.setSingleLine();
this.confirmTextView.setTextSize(1, 16.0f);
this.confirmTextView.setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(6.0f), Theme.getColor(i2)));
this.confirmTextView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
LoginActivity.PhoneNumberConfirmView.this.lambda$new$3(iConfirmDialogCallback, view5);
}
});
this.confirmTextView.setTypeface(Typeface.DEFAULT_BOLD);
this.confirmTextView.setPadding(dp, i3, dp, i3);
this.popupLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-2, -2.0f, (LocaleController.isRTL ? 3 : 5) | 80, f, f, f, f));
updateFabPosition();
updateColors();
}
public void lambda$new$0(View view) {
dismiss();
}
public void lambda$new$1(IConfirmDialogCallback iConfirmDialogCallback, View view) {
iConfirmDialogCallback.onFabPressed(this, this.fabTransform);
}
public void lambda$new$2(IConfirmDialogCallback iConfirmDialogCallback, View view) {
iConfirmDialogCallback.onEditPressed(this, this.editTextView);
}
public void lambda$new$3(IConfirmDialogCallback iConfirmDialogCallback, View view) {
iConfirmDialogCallback.onConfirmPressed(this, this.confirmTextView);
}
public void updateFabPosition() {
int[] iArr = new int[2];
this.fragmentView.getLocationInWindow(iArr);
int i = iArr[0];
int i2 = iArr[1];
this.fabContainer.getLocationInWindow(iArr);
this.popupFabContainer.setTranslationX(iArr[0] - i);
this.popupFabContainer.setTranslationY(iArr[1] - i2);
requestLayout();
}
public void updateColors() {
TransformableLoginButtonView transformableLoginButtonView = this.fabTransform;
int i = Theme.key_chats_actionIcon;
transformableLoginButtonView.setColor(Theme.getColor(i));
TransformableLoginButtonView transformableLoginButtonView2 = this.fabTransform;
int i2 = Theme.key_chats_actionBackground;
transformableLoginButtonView2.setBackgroundColor(Theme.getColor(i2));
this.popupLayout.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(12.0f), Theme.getColor(Theme.key_dialogBackground)));
this.confirmMessageView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2));
this.numberView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
TextView textView = this.editTextView;
int i3 = Theme.key_changephoneinfo_image2;
textView.setTextColor(Theme.getColor(i3));
this.confirmTextView.setTextColor(Theme.getColor(i3));
this.popupFabContainer.setBackground(Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), Theme.getColor(i2), Theme.getColor(Theme.key_chats_actionPressedBackground)));
this.floatingProgressView.setProgressColor(Theme.getColor(i));
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
int measuredHeight = this.popupLayout.getMeasuredHeight();
int translationY = (int) (this.popupFabContainer.getTranslationY() - AndroidUtilities.dp(32.0f));
FrameLayout frameLayout = this.popupLayout;
frameLayout.layout(frameLayout.getLeft(), translationY - measuredHeight, this.popupLayout.getRight(), translationY);
}
public void show() {
if (Build.VERSION.SDK_INT >= 21) {
View view = this.fabContainer;
ObjectAnimator.ofFloat(view, (Property<View, Float>) View.TRANSLATION_Z, view.getTranslationZ(), 0.0f).setDuration(150L).start();
}
ValueAnimator duration = ValueAnimator.ofFloat(0.0f, 1.0f).setDuration(250L);
duration.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
PhoneNumberConfirmView.this.fabContainer.setVisibility(8);
int measuredWidth = (int) (PhoneNumberConfirmView.this.fragmentView.getMeasuredWidth() / 10.0f);
int measuredHeight = (int) (PhoneNumberConfirmView.this.fragmentView.getMeasuredHeight() / 10.0f);
Bitmap createBitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
canvas.scale(0.1f, 0.1f);
canvas.drawColor(Theme.getColor(Theme.key_windowBackgroundWhite));
PhoneNumberConfirmView.this.fragmentView.draw(canvas);
Utilities.stackBlurBitmap(createBitmap, Math.max(8, Math.max(measuredWidth, measuredHeight) / ImageReceiver.DEFAULT_CROSSFADE_DURATION));
PhoneNumberConfirmView.this.blurredView.setBackground(new BitmapDrawable(PhoneNumberConfirmView.this.getContext().getResources(), createBitmap));
PhoneNumberConfirmView.this.blurredView.setAlpha(0.0f);
PhoneNumberConfirmView.this.blurredView.setVisibility(0);
PhoneNumberConfirmView.this.fragmentView.addView(PhoneNumberConfirmView.this);
}
@Override
public void onAnimationEnd(Animator animator) {
if (AndroidUtilities.isAccessibilityTouchExplorationEnabled()) {
PhoneNumberConfirmView.this.popupFabContainer.requestFocus();
}
}
});
duration.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.PhoneNumberConfirmView.this.lambda$show$4(valueAnimator);
}
});
duration.setInterpolator(CubicBezierInterpolator.DEFAULT);
duration.start();
}
public void lambda$show$4(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.fabTransform.setProgress(floatValue);
this.blurredView.setAlpha(floatValue);
this.dimmView.setAlpha(floatValue);
this.popupLayout.setAlpha(floatValue);
float f = (floatValue * 0.5f) + 0.5f;
this.popupLayout.setScaleX(f);
this.popupLayout.setScaleY(f);
}
public void animateProgress(final Runnable runnable) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.addListener(new AnimatorListenerAdapter(this) {
@Override
public void onAnimationEnd(Animator animator) {
runnable.run();
}
});
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.PhoneNumberConfirmView.this.lambda$animateProgress$5(valueAnimator);
}
});
ofFloat.setDuration(150L);
ofFloat.start();
}
public void lambda$animateProgress$5(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
float f = 1.0f - floatValue;
float f2 = (f * 0.9f) + 0.1f;
this.fabTransform.setScaleX(f2);
this.fabTransform.setScaleY(f2);
this.fabTransform.setAlpha(f);
float f3 = (0.9f * floatValue) + 0.1f;
this.floatingProgressView.setScaleX(f3);
this.floatingProgressView.setScaleY(f3);
this.floatingProgressView.setAlpha(floatValue);
}
public void dismiss() {
if (this.dismissed) {
return;
}
this.dismissed = true;
this.callback.onDismiss(this);
ValueAnimator duration = ValueAnimator.ofFloat(1.0f, 0.0f).setDuration(250L);
duration.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (PhoneNumberConfirmView.this.getParent() instanceof ViewGroup) {
((ViewGroup) PhoneNumberConfirmView.this.getParent()).removeView(PhoneNumberConfirmView.this);
}
if (Build.VERSION.SDK_INT >= 21) {
ObjectAnimator.ofFloat(PhoneNumberConfirmView.this.fabContainer, (Property<View, Float>) View.TRANSLATION_Z, 0.0f, AndroidUtilities.dp(2.0f)).setDuration(150L).start();
}
PhoneNumberConfirmView.this.fabContainer.setVisibility(0);
}
});
duration.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
LoginActivity.PhoneNumberConfirmView.this.lambda$dismiss$6(valueAnimator);
}
});
duration.setInterpolator(CubicBezierInterpolator.DEFAULT);
duration.start();
}
public void lambda$dismiss$6(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.blurredView.setAlpha(floatValue);
this.dimmView.setAlpha(floatValue);
this.fabTransform.setProgress(floatValue);
this.popupLayout.setAlpha(floatValue);
float f = (floatValue * 0.5f) + 0.5f;
this.popupLayout.setScaleX(f);
this.popupLayout.setScaleY(f);
}
}
public static final class PhoneInputData {
private CountrySelectActivity.Country country;
private List<String> patterns;
private String phoneNumber;
private PhoneInputData() {
}
}
@Override
public boolean isLightStatusBar() {
return ColorUtils.calculateLuminance(Theme.getColor(Theme.key_windowBackgroundWhite, null, true)) > 0.699999988079071d;
}
private void updateProxyButton(boolean z, boolean z2) {
if (this.proxyDrawable == null) {
return;
}
int connectionState = getConnectionsManager().getConnectionState();
if (this.currentConnectionState != connectionState || z2) {
this.currentConnectionState = connectionState;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
boolean z3 = sharedPreferences.getBoolean("proxy_enabled", false) && !TextUtils.isEmpty(sharedPreferences.getString("proxy_ip", ""));
int i = this.currentConnectionState;
boolean z4 = i == 3 || i == 5;
boolean z5 = i == 1 || i == 2 || i == 4;
if (z3) {
this.proxyDrawable.setConnected(true, z4, z);
showProxyButton(true, z);
} else if ((getMessagesController().blockedCountry && !SharedConfig.proxyList.isEmpty()) || z5) {
this.proxyDrawable.setConnected(true, z4, z);
showProxyButtonDelayed();
} else {
showProxyButton(false, z);
}
}
}
private void showProxyButtonDelayed() {
if (this.proxyButtonVisible) {
return;
}
Runnable runnable = this.showProxyButtonDelayed;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
this.proxyButtonVisible = true;
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$showProxyButtonDelayed$31();
}
};
this.showProxyButtonDelayed = runnable2;
AndroidUtilities.runOnUIThread(runnable2, 5000L);
}
public void lambda$showProxyButtonDelayed$31() {
this.proxyButtonVisible = false;
showProxyButton(true, true);
}
private void showProxyButton(final boolean z, boolean z2) {
if (z == this.proxyButtonVisible) {
return;
}
Runnable runnable = this.showProxyButtonDelayed;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.showProxyButtonDelayed = null;
}
this.proxyButtonVisible = z;
this.proxyButtonView.clearAnimation();
if (z2) {
this.proxyButtonView.setVisibility(0);
this.proxyButtonView.animate().alpha(z ? 1.0f : 0.0f).withEndAction(new Runnable() {
@Override
public final void run() {
LoginActivity.this.lambda$showProxyButton$32(z);
}
}).start();
} else {
this.proxyButtonView.setVisibility(z ? 0 : 8);
this.proxyButtonView.setAlpha(z ? 1.0f : 0.0f);
}
}
public void lambda$showProxyButton$32(boolean z) {
if (z) {
return;
}
this.proxyButtonView.setVisibility(8);
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (i == NotificationCenter.didUpdateConnectionState) {
updateProxyButton(true, false);
}
}
}