ЙЖ v1.1.1版本的 MD5 值为:8a99f876f523791304117b6ba699b758
以下内容为反编译后的 LoginActivity.java 源代码,内容仅作参考
package im.wsnshelzvi.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.util.Base64;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import com.bjz.comm.net.utils.AppPreferenceUtil;
import com.blankj.utilcode.constant.TimeConstants;
import com.coremedia.iso.boxes.TrackReferenceTypeBox;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
import com.king.zxing.util.LogUtils;
import im.wsnshelzvi.javaBean.fc.FollowedFcListBean;
import im.wsnshelzvi.javaBean.fc.HomeFcListBean;
import im.wsnshelzvi.javaBean.fc.RecommendFcListBean;
import im.wsnshelzvi.messenger.AndroidUtilities;
import im.wsnshelzvi.messenger.ApplicationLoader;
import im.wsnshelzvi.messenger.BuildVars;
import im.wsnshelzvi.messenger.ContactsController;
import im.wsnshelzvi.messenger.FileLog;
import im.wsnshelzvi.messenger.GcmPushListenerService;
import im.wsnshelzvi.messenger.ImageLocation;
import im.wsnshelzvi.messenger.LocaleController;
import im.wsnshelzvi.messenger.MessageObject;
import im.wsnshelzvi.messenger.MessagesController;
import im.wsnshelzvi.messenger.MessagesStorage;
import im.wsnshelzvi.messenger.NotificationCenter;
import im.wsnshelzvi.messenger.R;
import im.wsnshelzvi.messenger.SRPHelper;
import im.wsnshelzvi.messenger.UserConfig;
import im.wsnshelzvi.messenger.Utilities;
import im.wsnshelzvi.phoneformat.PhoneFormat;
import im.wsnshelzvi.tgnet.ConnectionsManager;
import im.wsnshelzvi.tgnet.RequestDelegate;
import im.wsnshelzvi.tgnet.SerializedData;
import im.wsnshelzvi.tgnet.TLObject;
import im.wsnshelzvi.tgnet.TLRPC;
import im.wsnshelzvi.ui.CountrySelectActivity;
import im.wsnshelzvi.ui.LoginActivity;
import im.wsnshelzvi.ui.actionbar.ActionBar;
import im.wsnshelzvi.ui.actionbar.ActionBarMenu;
import im.wsnshelzvi.ui.actionbar.ActionBarMenuItem;
import im.wsnshelzvi.ui.actionbar.AlertDialog;
import im.wsnshelzvi.ui.actionbar.BaseFragment;
import im.wsnshelzvi.ui.actionbar.Theme;
import im.wsnshelzvi.ui.actionbar.ThemeDescription;
import im.wsnshelzvi.ui.cells.CheckBoxCell;
import im.wsnshelzvi.ui.components.AlertsCreator;
import im.wsnshelzvi.ui.components.AvatarDrawable;
import im.wsnshelzvi.ui.components.BackupImageView;
import im.wsnshelzvi.ui.components.ContextProgressView;
import im.wsnshelzvi.ui.components.EditTextBoldCursor;
import im.wsnshelzvi.ui.components.HintEditText;
import im.wsnshelzvi.ui.components.ImageUpdater;
import im.wsnshelzvi.ui.components.LayoutHelper;
import im.wsnshelzvi.ui.components.RadialProgressView;
import im.wsnshelzvi.ui.components.SlideView;
import im.wsnshelzvi.ui.components.toast.ToastUtils;
import im.wsnshelzvi.ui.hui.friendscircle_v1.helper.FcDBHelper;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.text.Typography;
import org.slf4j.Marker;
@Deprecated
public class LoginActivity extends BaseFragment {
private static final int done_button = 1;
private boolean checkPermissions;
private boolean checkShowPermissions;
private TLRPC.TL_help_termsOfService currentTermsOfService;
private int currentViewNum;
private ActionBarMenuItem doneItem;
private AnimatorSet doneItemAnimation;
private ContextProgressView doneProgressView;
private boolean newAccount;
private Dialog permissionsDialog;
private ArrayList<String> permissionsItems;
private Dialog permissionsShowDialog;
private ArrayList<String> permissionsShowItems;
private int progressRequestId;
private int scrollHeight;
private boolean syncContacts;
private SlideView[] views;
public class ProgressView extends View {
private Paint paint;
private Paint paint2;
private float progress;
public ProgressView(Context context) {
super(context);
this.paint = new Paint();
this.paint2 = new Paint();
this.paint.setColor(Theme.getColor(Theme.key_login_progressInner));
this.paint2.setColor(Theme.getColor(Theme.key_login_progressOuter));
}
public void setProgress(float value) {
this.progress = value;
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
int start = (int) (getMeasuredWidth() * this.progress);
canvas.drawRect(0.0f, 0.0f, start, getMeasuredHeight(), this.paint2);
canvas.drawRect(start, 0.0f, getMeasuredWidth(), getMeasuredHeight(), this.paint);
}
}
public LoginActivity() {
this.views = new SlideView[9];
this.permissionsItems = new ArrayList<>();
this.permissionsShowItems = new ArrayList<>();
this.checkPermissions = true;
this.checkShowPermissions = true;
this.syncContacts = true;
}
public LoginActivity(int account) {
this.views = new SlideView[9];
this.permissionsItems = new ArrayList<>();
this.permissionsShowItems = new ArrayList<>();
this.checkPermissions = true;
this.checkShowPermissions = true;
this.syncContacts = true;
this.currentAccount = account;
this.newAccount = true;
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a < slideViewArr.length) {
SlideView slideView = slideViewArr[a];
if (slideView != null) {
slideView.onDestroyActivity();
}
a++;
} else {
return;
}
}
}
@Override
public View createView(Context context) {
AppPreferenceUtil.putString("PublishFcBean", "");
FcDBHelper.getInstance().deleteAll(HomeFcListBean.class);
FcDBHelper.getInstance().deleteAll(RecommendFcListBean.class);
FcDBHelper.getInstance().deleteAll(FollowedFcListBean.class);
this.actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
this.actionBar.setActionBarMenuOnItemClick(new AnonymousClass1());
ActionBarMenu menu = this.actionBar.createMenu();
this.actionBar.setAllowOverlayTitle(true);
this.doneItem = menu.addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56.0f));
ContextProgressView contextProgressView = new ContextProgressView(context, 1);
this.doneProgressView = contextProgressView;
contextProgressView.setAlpha(0.0f);
this.doneProgressView.setScaleX(0.1f);
this.doneProgressView.setScaleY(0.1f);
this.doneProgressView.setVisibility(4);
this.doneItem.addView(this.doneProgressView, LayoutHelper.createFrame(-1, -1.0f));
this.doneItem.setContentDescription(LocaleController.getString("Done", R.string.Done));
ScrollView scrollView = new ScrollView(context) {
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
if (LoginActivity.this.currentViewNum == 1 || LoginActivity.this.currentViewNum == 2 || LoginActivity.this.currentViewNum == 4) {
rectangle.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
LoginActivity.this.scrollHeight = View.MeasureSpec.getSize(heightMeasureSpec) - AndroidUtilities.dp(30.0f);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
scrollView.setFillViewport(true);
this.fragmentView = scrollView;
FrameLayout frameLayout = new FrameLayout(context);
scrollView.addView(frameLayout, LayoutHelper.createScroll(-1, -2, 51));
this.views[0] = new PhoneView(context);
this.views[1] = new LoginActivitySmsView(context, 1);
this.views[2] = new LoginActivitySmsView(context, 2);
this.views[3] = new LoginActivitySmsView(context, 3);
this.views[4] = new LoginActivitySmsView(context, 4);
this.views[5] = new LoginActivityRegisterView(context);
this.views[6] = new LoginActivityPasswordView(context);
this.views[7] = new LoginActivityRecoverView(context);
this.views[8] = new LoginActivityResetWaitView(context);
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a >= slideViewArr.length) {
break;
}
slideViewArr[a].setVisibility(a == 0 ? 0 : 8);
SlideView slideView = this.views[a];
float f = 18.0f;
float f2 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
if (AndroidUtilities.isTablet()) {
f = 26.0f;
}
frameLayout.addView(slideView, LayoutHelper.createFrame(-1.0f, -1.0f, 51, f2, 30.0f, f, 0.0f));
a++;
}
Bundle savedInstanceState = loadCurrentState();
if (savedInstanceState != null) {
this.currentViewNum = savedInstanceState.getInt("currentViewNum", 0);
this.syncContacts = savedInstanceState.getInt("syncContacts", 1) == 1;
int i = this.currentViewNum;
if (i >= 1 && i <= 4) {
int time = savedInstanceState.getInt("open");
if (time != 0 && Math.abs((System.currentTimeMillis() / 1000) - time) >= 86400) {
this.currentViewNum = 0;
savedInstanceState = null;
clearCurrentState();
}
} else if (i == 6) {
LoginActivityPasswordView view = (LoginActivityPasswordView) this.views[6];
if (view.passwordType == 0 || view.current_salt1 == null || view.current_salt2 == null) {
this.currentViewNum = 0;
savedInstanceState = null;
clearCurrentState();
}
}
}
int a2 = 0;
while (true) {
SlideView[] slideViewArr2 = this.views;
if (a2 >= slideViewArr2.length) {
this.actionBar.setTitle(this.views[this.currentViewNum].getHeaderName());
return this.fragmentView;
}
if (savedInstanceState != null) {
if (a2 >= 1 && a2 <= 4) {
if (a2 == this.currentViewNum) {
slideViewArr2[a2].restoreStateParams(savedInstanceState);
}
} else {
slideViewArr2[a2].restoreStateParams(savedInstanceState);
}
}
if (this.currentViewNum == a2) {
this.actionBar.setBackButtonImage((this.views[a2].needBackButton() || this.newAccount) ? R.mipmap.ic_back : 0);
this.views[a2].setVisibility(0);
this.views[a2].onShow();
if (a2 == 3 || a2 == 8) {
this.doneItem.setVisibility(8);
}
} else {
this.views[a2].setVisibility(8);
}
a2++;
}
}
public class AnonymousClass1 extends ActionBar.ActionBarMenuOnItemClick {
AnonymousClass1() {
}
@Override
public void onItemClick(int id) {
if (id == 1) {
if (LoginActivity.this.doneProgressView.getTag() == null) {
LoginActivity.this.views[LoginActivity.this.currentViewNum].onNextPressed();
return;
}
if (LoginActivity.this.getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("StopLoading", R.string.StopLoading));
builder.setPositiveButton(LocaleController.getString("WaitMore", R.string.WaitMore), null);
builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.AnonymousClass1.this.m1709lambda$onItemClick$0$imwsnshelzviuiLoginActivity$1(dialogInterface, i);
}
});
LoginActivity.this.showDialog(builder.create());
return;
}
if (id == -1 && LoginActivity.this.onBackPressed()) {
LoginActivity.this.finishFragment();
}
}
public void m1709lambda$onItemClick$0$imwsnshelzviuiLoginActivity$1(DialogInterface dialogInterface, int i) {
LoginActivity.this.views[LoginActivity.this.currentViewNum].onCancelPressed();
LoginActivity.this.needHideProgress(true);
}
}
@Override
public void onPause() {
super.onPause();
AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid);
if (this.newAccount) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
}
}
@Override
public void onResume() {
int time;
super.onResume();
if (this.newAccount) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
}
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
try {
int i = this.currentViewNum;
if (i >= 1 && i <= 4) {
SlideView slideView = this.views[i];
if ((slideView instanceof LoginActivitySmsView) && (time = ((LoginActivitySmsView) slideView).openTime) != 0 && Math.abs((System.currentTimeMillis() / 1000) - time) >= 86400) {
this.views[this.currentViewNum].onBackPressed(true);
setPage(0, false, null, true);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == 6) {
this.checkPermissions = false;
int i = this.currentViewNum;
if (i == 0) {
this.views[i].onNextPressed();
return;
}
return;
}
if (requestCode == 7) {
this.checkShowPermissions = false;
int i2 = this.currentViewNum;
if (i2 == 0) {
((PhoneView) this.views[i2]).fillNumber();
}
}
}
private Bundle loadCurrentState() {
if (this.newAccount) {
return null;
}
try {
Bundle bundle = new Bundle();
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0);
Map<String, ?> params = preferences.getAll();
for (Map.Entry<String, ?> entry : params.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
String[] args = key.split("_\\|_");
if (args.length == 1) {
if (value instanceof String) {
bundle.putString(key, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(key, ((Integer) value).intValue());
}
} else if (args.length == 2) {
Bundle inner = bundle.getBundle(args[0]);
if (inner == null) {
inner = new Bundle();
bundle.putBundle(args[0], inner);
}
if (value instanceof String) {
inner.putString(args[1], (String) value);
} else if (value instanceof Integer) {
inner.putInt(args[1], ((Integer) value).intValue());
}
}
}
return bundle;
} catch (Exception e) {
FileLog.e(e);
return null;
}
}
private void clearCurrentState() {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
}
private void putBundleToEditor(Bundle bundle, SharedPreferences.Editor editor, String prefix) {
Set<String> keys = bundle.keySet();
for (String key : keys) {
Object obj = bundle.get(key);
if (obj instanceof String) {
if (prefix != null) {
editor.putString(prefix + "_|_" + key, (String) obj);
} else {
editor.putString(key, (String) obj);
}
} else if (obj instanceof Integer) {
if (prefix != null) {
editor.putInt(prefix + "_|_" + key, ((Integer) obj).intValue());
} else {
editor.putInt(key, ((Integer) obj).intValue());
}
} else if (obj instanceof Bundle) {
putBundleToEditor((Bundle) obj, editor, key);
}
}
}
@Override
public void onDialogDismiss(Dialog dialog) {
if (Build.VERSION.SDK_INT >= 23) {
if (dialog == this.permissionsDialog && !this.permissionsItems.isEmpty() && getParentActivity() != null) {
try {
getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
} catch (Exception e) {
}
} else if (dialog == this.permissionsShowDialog && !this.permissionsShowItems.isEmpty() && getParentActivity() != null) {
try {
getParentActivity().requestPermissions((String[]) this.permissionsShowItems.toArray(new String[0]), 7);
} catch (Exception e2) {
}
}
}
}
@Override
public boolean onBackPressed() {
if (ApplicationLoader.blnShowAuth && !UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
Intent intent = new Intent("app_user_authorize_result");
intent.putExtra("login", "0");
getParentActivity().sendBroadcast(intent);
}
ApplicationLoader.blnShowAuth = false;
int i = this.currentViewNum;
if (i == 0) {
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a < slideViewArr.length) {
SlideView slideView = slideViewArr[a];
if (slideView != null) {
slideView.onDestroyActivity();
}
a++;
} else {
clearCurrentState();
return true;
}
}
} else {
if (i == 6) {
this.views[i].onBackPressed(true);
setPage(0, true, null, true);
} else if (i == 7 || i == 8) {
this.views[i].onBackPressed(true);
setPage(6, true, null, true);
} else if (i >= 1 && i <= 4) {
if (this.views[i].onBackPressed(false)) {
setPage(0, true, null, true);
}
} else if (i == 5) {
((LoginActivityRegisterView) this.views[i]).wrongNumber.callOnClick();
}
return false;
}
}
@Override
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
LoginActivityRegisterView registerView = (LoginActivityRegisterView) this.views[5];
if (registerView == null) {
return;
}
registerView.imageUpdater.onActivityResult(requestCode, resultCode, data);
}
public void needShowAlert(String title, String text) {
if (text == null || getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(title);
builder.setMessage(text);
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
public void needShowInvalidAlert(final String phoneNumber, final boolean banned) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (banned) {
builder.setMessage(LocaleController.getString("BannedPhoneNumber", R.string.BannedPhoneNumber));
} else {
builder.setMessage(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
}
builder.setNeutralButton(LocaleController.getString("BotHelp", R.string.BotHelp), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.this.m1708lambda$needShowInvalidAlert$0$imwsnshelzviuiLoginActivity(banned, phoneNumber, dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
public void m1708lambda$needShowInvalidAlert$0$imwsnshelzviuiLoginActivity(boolean banned, String phoneNumber, DialogInterface dialog, int which) {
try {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, "%s (%d)", pInfo.versionName, Integer.valueOf(pInfo.versionCode));
Intent mailer = new Intent("android.intent.action.SEND");
mailer.setType("message/rfc822");
mailer.putExtra("android.intent.extra.EMAIL", new String[]{"login@stel.com"});
if (banned) {
mailer.putExtra("android.intent.extra.SUBJECT", "Banned phone number: " + phoneNumber);
mailer.putExtra("android.intent.extra.TEXT", "I'm trying to use my mobile phone number: " + phoneNumber + "\nBut App says it's banned. Please help.\n\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault());
} else {
mailer.putExtra("android.intent.extra.SUBJECT", "Invalid phone number: " + phoneNumber);
mailer.putExtra("android.intent.extra.TEXT", "I'm trying to use my mobile phone number: " + phoneNumber + "\nBut App says it's invalid. Please help.\n\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault());
}
getParentActivity().startActivity(Intent.createChooser(mailer, "Send email..."));
} catch (Exception e) {
needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
}
}
private void showEditDoneProgress(final boolean show) {
AnimatorSet animatorSet = this.doneItemAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
this.doneItemAnimation = new AnimatorSet();
if (show) {
this.doneProgressView.setTag(1);
this.doneProgressView.setVisibility(0);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.ALPHA, 1.0f));
} else {
this.doneProgressView.setTag(null);
this.doneItem.getContentView().setVisibility(0);
this.doneItemAnimation.playTogether(ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.doneProgressView, (Property<ContextProgressView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.doneItem.getContentView(), (Property<View, Float>) View.ALPHA, 1.0f));
}
this.doneItemAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (LoginActivity.this.doneItemAnimation != null && LoginActivity.this.doneItemAnimation.equals(animation)) {
if (!show) {
LoginActivity.this.doneProgressView.setVisibility(4);
} else {
LoginActivity.this.doneItem.getContentView().setVisibility(4);
}
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (LoginActivity.this.doneItemAnimation != null && LoginActivity.this.doneItemAnimation.equals(animation)) {
LoginActivity.this.doneItemAnimation = null;
}
}
});
this.doneItemAnimation.setDuration(150L);
this.doneItemAnimation.start();
}
public void needShowProgress(int reqiestId) {
this.progressRequestId = reqiestId;
showEditDoneProgress(true);
}
public void needHideProgress(boolean cancel) {
if (this.progressRequestId != 0) {
if (cancel) {
ConnectionsManager.getInstance(this.currentAccount).cancelRequest(this.progressRequestId, true);
}
this.progressRequestId = 0;
}
showEditDoneProgress(false);
}
public void setPage(int page, boolean animated, Bundle params, boolean back) {
if (page == 3 || page == 8) {
this.doneItem.setVisibility(8);
} else {
if (page == 0) {
this.checkPermissions = true;
this.checkShowPermissions = true;
}
this.doneItem.setVisibility(0);
}
int i = this.currentViewNum;
if (i == page) {
this.views[i].setParams(params, false);
return;
}
int i2 = R.mipmap.ic_back;
if (animated) {
SlideView[] slideViewArr = this.views;
final SlideView outView = slideViewArr[i];
SlideView newView = slideViewArr[page];
this.currentViewNum = page;
ActionBar actionBar = this.actionBar;
if (!newView.needBackButton() && !this.newAccount) {
i2 = 0;
}
actionBar.setBackButtonImage(i2);
newView.setParams(params, false);
this.actionBar.setTitle(newView.getHeaderName());
setParentActivityTitle(newView.getHeaderName());
newView.onShow();
int i3 = AndroidUtilities.displaySize.x;
if (back) {
i3 = -i3;
}
newView.setX(i3);
newView.setVisibility(0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
outView.setVisibility(8);
outView.setX(0.0f);
}
});
Animator[] animatorArr = new Animator[2];
Property property = View.TRANSLATION_X;
float[] fArr = new float[1];
int i4 = AndroidUtilities.displaySize.x;
if (!back) {
i4 = -i4;
}
fArr[0] = i4;
animatorArr[0] = ObjectAnimator.ofFloat(outView, (Property<SlideView, Float>) property, fArr);
animatorArr[1] = ObjectAnimator.ofFloat(newView, (Property<SlideView, Float>) View.TRANSLATION_X, 0.0f);
animatorSet.playTogether(animatorArr);
animatorSet.setDuration(300L);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.start();
return;
}
ActionBar actionBar2 = this.actionBar;
if (!this.views[page].needBackButton() && !this.newAccount) {
i2 = 0;
}
actionBar2.setBackButtonImage(i2);
this.views[this.currentViewNum].setVisibility(8);
this.currentViewNum = page;
this.views[page].setParams(params, false);
this.views[page].setVisibility(0);
this.actionBar.setTitle(this.views[page].getHeaderName());
setParentActivityTitle(this.views[page].getHeaderName());
this.views[page].onShow();
}
@Override
public void saveSelfArgs(Bundle outState) {
try {
Bundle bundle = new Bundle();
bundle.putInt("currentViewNum", this.currentViewNum);
bundle.putInt("syncContacts", this.syncContacts ? 1 : 0);
for (int a = 0; a <= this.currentViewNum; a++) {
SlideView v = this.views[a];
if (v != null) {
v.saveStateParams(bundle);
}
}
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
putBundleToEditor(bundle, editor, null);
editor.commit();
} catch (Exception e) {
FileLog.e(e);
}
}
private void needFinishActivity() {
clearCurrentState();
if (getParentActivity() instanceof LaunchActivity) {
if (this.newAccount) {
this.newAccount = false;
((LaunchActivity) getParentActivity()).switchToAccount(this.currentAccount, true);
finishFragment();
return;
} else {
presentFragment(new IndexActivity(), true);
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
return;
}
}
if (getParentActivity() instanceof ExternalActionActivity) {
((ExternalActionActivity) getParentActivity()).onFinishLogin();
}
}
public void onAuthSuccess(TLRPC.TL_auth_authorization res) {
ConnectionsManager.getInstance(this.currentAccount).setUserId(res.user.id);
UserConfig.getInstance(this.currentAccount).clearConfig();
MessagesController.getInstance(this.currentAccount).cleanup();
UserConfig.getInstance(this.currentAccount).syncContacts = this.syncContacts;
UserConfig.getInstance(this.currentAccount).setCurrentUser(res.user);
UserConfig.getInstance(this.currentAccount).saveConfig(true);
MessagesStorage.getInstance(this.currentAccount).cleanup(true);
ArrayList<TLRPC.User> users = new ArrayList<>();
users.add(res.user);
MessagesStorage.getInstance(this.currentAccount).putUsersAndChats(users, null, true, true);
MessagesController.getInstance(this.currentAccount).putUser(res.user, false);
ContactsController.getInstance(this.currentAccount).checkAppAccount();
MessagesController.getInstance(this.currentAccount).checkProxyInfo(true);
ConnectionsManager.getInstance(this.currentAccount).updateDcSettings();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
GcmPushListenerService.sendUPushRegistrationToServer(ApplicationLoader.strDeviceKey);
}
});
needFinishActivity();
}
public void fillNextCodeParams(Bundle params, TLRPC.TL_auth_sentCode res) {
params.putString("phoneHash", res.phone_code_hash);
if (res.next_type instanceof TLRPC.TL_auth_codeTypeCall) {
params.putInt("nextType", 4);
} else if (res.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) {
params.putInt("nextType", 3);
} else if (res.next_type instanceof TLRPC.TL_auth_codeTypeSms) {
params.putInt("nextType", 2);
}
if (res.type instanceof TLRPC.TL_auth_sentCodeTypeApp) {
params.putInt("type", 1);
params.putInt("length", res.type.length);
setPage(1, true, params, false);
return;
}
if (res.timeout == 0) {
res.timeout = 60;
}
params.putInt("timeout", res.timeout * 1000);
if (res.type instanceof TLRPC.TL_auth_sentCodeTypeCall) {
params.putInt("type", 4);
params.putInt("length", res.type.length);
setPage(4, true, params, false);
} else if (res.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
params.putInt("type", 3);
params.putString("pattern", res.type.pattern);
setPage(3, true, params, false);
} else if (res.type instanceof TLRPC.TL_auth_sentCodeTypeSms) {
params.putInt("type", 2);
params.putInt("length", res.type.length);
setPage(2, true, params, false);
}
}
public class PhoneView extends SlideView implements AdapterView.OnItemSelectedListener {
private CheckBoxCell checkBoxCell;
private EditTextBoldCursor codeField;
private HashMap<String, String> codesMap;
private ArrayList<String> countriesArray;
private HashMap<String, String> countriesMap;
private TextView countryButton;
private int countryState;
private boolean ignoreOnPhoneChange;
private boolean ignoreOnTextChange;
private boolean ignoreSelection;
private boolean nextPressed;
private HintEditText phoneField;
private HashMap<String, String> phoneFormatMap;
private TextView textView;
private TextView textView2;
private View view;
public PhoneView(Context context) {
super(context);
this.countryState = 0;
this.countriesArray = new ArrayList<>();
this.countriesMap = new HashMap<>();
this.codesMap = new HashMap<>();
this.phoneFormatMap = new HashMap<>();
this.ignoreSelection = false;
this.ignoreOnTextChange = false;
this.ignoreOnPhoneChange = false;
this.nextPressed = false;
setOrientation(1);
TextView textView = new TextView(context);
this.countryButton = textView;
textView.setTextSize(1, 18.0f);
this.countryButton.setPadding(AndroidUtilities.dp(12.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(12.0f), 0);
this.countryButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.countryButton.setMaxLines(1);
this.countryButton.setSingleLine(true);
this.countryButton.setEllipsize(TextUtils.TruncateAt.END);
this.countryButton.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
this.countryButton.setBackgroundResource(R.drawable.spinner_states);
addView(this.countryButton, LayoutHelper.createLinear(-1, 36, 0.0f, 0.0f, 0.0f, 14.0f));
this.countryButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.PhoneView.this.m1767lambda$new$2$imwsnshelzviuiLoginActivity$PhoneView(view);
}
});
View view = new View(context);
this.view = view;
view.setPadding(AndroidUtilities.dp(12.0f), 0, AndroidUtilities.dp(12.0f), 0);
this.view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayLine));
addView(this.view, LayoutHelper.createLinear(-1, 1, 4.0f, -17.5f, 4.0f, 0.0f));
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
addView(linearLayout, LayoutHelper.createLinear(-1, -2, 0.0f, 20.0f, 0.0f, 0.0f));
TextView textView2 = new TextView(context);
this.textView = textView2;
textView2.setText(Marker.ANY_NON_NULL_MARKER);
this.textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.textView.setTextSize(1, 18.0f);
linearLayout.addView(this.textView, LayoutHelper.createLinear(-2, -2));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.codeField = editTextBoldCursor;
editTextBoldCursor.setInputType(3);
this.codeField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
this.codeField.setTextSize(1, 18.0f);
this.codeField.setMaxLines(1);
this.codeField.setGravity(19);
this.codeField.setImeOptions(268435461);
InputFilter[] inputFilters = {new InputFilter.LengthFilter(5)};
this.codeField.setFilters(inputFilters);
linearLayout.addView(this.codeField, LayoutHelper.createLinear(55, 36, -9.0f, 0.0f, 16.0f, 0.0f));
this.codeField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
if (!PhoneView.this.ignoreOnTextChange) {
PhoneView.this.ignoreOnTextChange = true;
String text = PhoneFormat.stripExceptNumbers(PhoneView.this.codeField.getText().toString());
PhoneView.this.codeField.setText(text);
if (text.length() == 0) {
PhoneView.this.countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 1;
} else {
boolean ok = false;
String textToSet = null;
if (text.length() > 4) {
int a = 4;
while (true) {
if (a < 1) {
break;
}
String sub = text.substring(0, a);
if (((String) PhoneView.this.codesMap.get(sub)) == null) {
a--;
} else {
ok = true;
textToSet = text.substring(a) + PhoneView.this.phoneField.getText().toString();
text = sub;
PhoneView.this.codeField.setText(sub);
break;
}
}
if (!ok) {
textToSet = text.substring(1) + PhoneView.this.phoneField.getText().toString();
EditTextBoldCursor editTextBoldCursor2 = PhoneView.this.codeField;
String substring = text.substring(0, 1);
text = substring;
editTextBoldCursor2.setText(substring);
}
}
String country = (String) PhoneView.this.codesMap.get(text);
if (country != null) {
int index = PhoneView.this.countriesArray.indexOf(country);
if (index != -1) {
PhoneView.this.ignoreSelection = true;
PhoneView.this.countryButton.setText((CharSequence) PhoneView.this.countriesArray.get(index));
String hint = (String) PhoneView.this.phoneFormatMap.get(text);
PhoneView.this.phoneField.setHintText(hint != null ? hint.replace('X', Typography.ndash) : null);
PhoneView.this.countryState = 0;
} else {
PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 2;
}
} else {
PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 2;
}
if (!ok) {
PhoneView.this.codeField.setSelection(PhoneView.this.codeField.getText().length());
}
if (textToSet != null) {
PhoneView.this.phoneField.requestFocus();
PhoneView.this.phoneField.setText(textToSet);
PhoneView.this.phoneField.setSelection(PhoneView.this.phoneField.length());
}
}
PhoneView.this.ignoreOnTextChange = false;
}
}
});
this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i, KeyEvent keyEvent) {
return LoginActivity.PhoneView.this.m1768lambda$new$3$imwsnshelzviuiLoginActivity$PhoneView(textView3, i, keyEvent);
}
});
HintEditText hintEditText = new HintEditText(context) {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == 0 && !AndroidUtilities.showKeyboard(this)) {
clearFocus();
requestFocus();
}
return super.onTouchEvent(event);
}
};
this.phoneField = hintEditText;
hintEditText.setInputType(3);
this.phoneField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.phoneField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.phoneField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.phoneField.setPadding(0, 0, 0, 0);
this.phoneField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.phoneField.setCursorSize(AndroidUtilities.dp(20.0f));
this.phoneField.setCursorWidth(1.5f);
this.phoneField.setTextSize(1, 18.0f);
this.phoneField.setMaxLines(1);
this.phoneField.setGravity(19);
this.phoneField.setImeOptions(268435461);
linearLayout.addView(this.phoneField, LayoutHelper.createFrame(-1, 36.0f));
this.phoneField.addTextChangedListener(new TextWatcher() {
private int actionPosition;
private int characterAction = -1;
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (count == 0 && after == 1) {
this.characterAction = 1;
return;
}
if (count == 1 && after == 0) {
if (s.charAt(start) == ' ' && start > 0) {
this.characterAction = 3;
this.actionPosition = start - 1;
return;
} else {
this.characterAction = 2;
return;
}
}
this.characterAction = -1;
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
int i;
int i2;
if (!PhoneView.this.ignoreOnPhoneChange) {
int start = PhoneView.this.phoneField.getSelectionStart();
String str = PhoneView.this.phoneField.getText().toString();
if (this.characterAction == 3) {
str = str.substring(0, this.actionPosition) + str.substring(this.actionPosition + 1);
start--;
}
StringBuilder builder = new StringBuilder(str.length());
for (int a = 0; a < str.length(); a++) {
String ch = str.substring(a, a + 1);
if ("0123456789".contains(ch)) {
builder.append(ch);
}
}
PhoneView.this.ignoreOnPhoneChange = true;
String hint = PhoneView.this.phoneField.getHintText();
if (hint != null) {
int a2 = 0;
while (true) {
if (a2 >= builder.length()) {
break;
}
if (a2 < hint.length()) {
if (hint.charAt(a2) == ' ') {
builder.insert(a2, ' ');
a2++;
if (start == a2 && (i2 = this.characterAction) != 2 && i2 != 3) {
start++;
}
}
a2++;
} else {
builder.insert(a2, ' ');
if (start == a2 + 1 && (i = this.characterAction) != 2 && i != 3) {
start++;
}
}
}
}
s.replace(0, s.length(), builder);
if (start >= 0) {
PhoneView.this.phoneField.setSelection(start <= PhoneView.this.phoneField.length() ? start : PhoneView.this.phoneField.length());
}
PhoneView.this.phoneField.onTextChange();
PhoneView.this.ignoreOnPhoneChange = false;
}
}
});
this.phoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i, KeyEvent keyEvent) {
return LoginActivity.PhoneView.this.m1769lambda$new$4$imwsnshelzviuiLoginActivity$PhoneView(textView3, i, keyEvent);
}
});
this.phoneField.setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view2, int i, KeyEvent keyEvent) {
return LoginActivity.PhoneView.this.m1770lambda$new$5$imwsnshelzviuiLoginActivity$PhoneView(view2, i, keyEvent);
}
});
TextView textView3 = new TextView(context);
this.textView2 = textView3;
textView3.setText(LocaleController.getString("StartText", R.string.StartText));
this.textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.textView2.setTextSize(1, 14.0f);
this.textView2.setGravity(LocaleController.isRTL ? 5 : 3);
this.textView2.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.textView2, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 28, 0, 10));
if (LoginActivity.this.newAccount) {
CheckBoxCell checkBoxCell = new CheckBoxCell(context, 2);
this.checkBoxCell = checkBoxCell;
checkBoxCell.setText(LocaleController.getString("SyncContacts", R.string.SyncContacts), "", LoginActivity.this.syncContacts, false);
addView(this.checkBoxCell, LayoutHelper.createLinear(-2, -1, 51, 0, 0, 0, 0));
this.checkBoxCell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
CheckBoxCell cell = (CheckBoxCell) v;
LoginActivity.this.syncContacts = !LoginActivity.this.syncContacts;
cell.setChecked(LoginActivity.this.syncContacts, true);
if (LoginActivity.this.syncContacts) {
ToastUtils.show(R.string.SyncContactsOn);
} else {
ToastUtils.show(R.string.SyncContactsOff);
}
}
});
}
HashMap<String, String> languageMap = new HashMap<>();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt")));
while (true) {
String line = reader.readLine();
if (line == null) {
break;
}
String[] args = line.split(";");
this.countriesArray.add(0, args[2]);
this.countriesMap.put(args[2], args[0]);
this.codesMap.put(args[0], args[2]);
if (args.length > 3) {
this.phoneFormatMap.put(args[0], args[3]);
}
languageMap.put(args[1], args[2]);
}
reader.close();
} catch (Exception e) {
FileLog.e(e);
}
Collections.sort(this.countriesArray, new ChangePhoneActivity$PhoneView$$ExternalSyntheticLambda5());
String country = null;
try {
country = null;
} catch (Exception e2) {
FileLog.e(e2);
}
if (country != null) {
setCountry(languageMap, country.toUpperCase());
}
if (this.codeField.length() == 0) {
this.countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
this.phoneField.setHintText((String) null);
this.countryState = 1;
}
if (this.codeField.length() != 0) {
this.phoneField.requestFocus();
HintEditText hintEditText2 = this.phoneField;
hintEditText2.setSelection(hintEditText2.length());
return;
}
this.codeField.requestFocus();
}
public void m1767lambda$new$2$imwsnshelzviuiLoginActivity$PhoneView(View view) {
CountrySelectActivity fragment = new CountrySelectActivity(true);
fragment.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
LoginActivity.PhoneView.this.m1766lambda$new$1$imwsnshelzviuiLoginActivity$PhoneView(country);
}
});
LoginActivity.this.presentFragment(fragment);
}
public void m1766lambda$new$1$imwsnshelzviuiLoginActivity$PhoneView(CountrySelectActivity.Country country) {
selectCountry(null, country);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.m1765lambda$new$0$imwsnshelzviuiLoginActivity$PhoneView();
}
}, 300L);
this.phoneField.requestFocus();
HintEditText hintEditText = this.phoneField;
hintEditText.setSelection(hintEditText.length());
}
public void m1765lambda$new$0$imwsnshelzviuiLoginActivity$PhoneView() {
AndroidUtilities.showKeyboard(this.phoneField);
}
public boolean m1768lambda$new$3$imwsnshelzviuiLoginActivity$PhoneView(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
this.phoneField.requestFocus();
HintEditText hintEditText = this.phoneField;
hintEditText.setSelection(hintEditText.length());
return true;
}
return false;
}
public boolean m1769lambda$new$4$imwsnshelzviuiLoginActivity$PhoneView(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public boolean m1770lambda$new$5$imwsnshelzviuiLoginActivity$PhoneView(View v, int keyCode, KeyEvent event) {
if (keyCode == 67 && this.phoneField.length() == 0) {
this.codeField.requestFocus();
EditTextBoldCursor editTextBoldCursor = this.codeField;
editTextBoldCursor.setSelection(editTextBoldCursor.length());
this.codeField.dispatchKeyEvent(event);
return true;
}
return false;
}
public void selectCountry(String name, CountrySelectActivity.Country country) {
if (name != null) {
int index = this.countriesArray.indexOf(name);
if (index != -1) {
this.ignoreOnTextChange = true;
String code = this.countriesMap.get(name);
this.codeField.setText(code);
this.countryButton.setText(name);
String hint = this.phoneFormatMap.get(code);
this.phoneField.setHintText(hint != null ? hint.replace('X', Typography.ndash) : null);
this.countryState = 0;
this.ignoreOnTextChange = false;
return;
}
return;
}
if (country != null) {
this.ignoreOnTextChange = true;
this.codeField.setText(country.code + "");
if (country.phoneFormat != null) {
this.phoneField.setHintText(country.phoneFormat != null ? country.phoneFormat.replace('X', Typography.ndash) : null);
}
this.countryState = 0;
this.ignoreOnTextChange = false;
}
}
private void setCountry(HashMap<String, String> languageMap, String country) {
String countryName = languageMap.get(country);
if (countryName != null) {
int index = this.countriesArray.indexOf(countryName);
if (index != -1) {
this.codeField.setText(this.countriesMap.get(countryName));
this.countryState = 0;
}
}
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (this.ignoreSelection) {
this.ignoreSelection = false;
return;
}
this.ignoreOnTextChange = true;
String str = this.countriesArray.get(i);
this.codeField.setText(this.countriesMap.get(str));
this.ignoreOnTextChange = false;
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
@Override
public void onNextPressed() {
if (LoginActivity.this.getParentActivity() == null || this.nextPressed) {
return;
}
int i = this.countryState;
if (i == 1) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
return;
}
if (i == 2 && !BuildVars.DEBUG_VERSION) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("WrongCountry", R.string.WrongCountry));
return;
}
if (this.codeField.length() == 0) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
return;
}
String phone = PhoneFormat.stripExceptNumbers("" + ((Object) this.codeField.getText())) + " " + PhoneFormat.stripExceptNumbers("" + ((Object) this.phoneField.getText()));
if (LoginActivity.this.getParentActivity() instanceof LaunchActivity) {
for (int a = 0; a < 3; a++) {
UserConfig userConfig = UserConfig.getInstance(a);
if (userConfig.isClientActivated()) {
String userPhone = userConfig.getCurrentUser().phone;
if (PhoneNumberUtils.compare(phone, userPhone)) {
final int num = a;
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn));
builder.setPositiveButton(LocaleController.getString("AccountSwitch", R.string.AccountSwitch), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LoginActivity.PhoneView.this.m1771lambda$onNextPressed$6$imwsnshelzviuiLoginActivity$PhoneView(num, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
LoginActivity.this.showDialog(builder.create());
return;
}
}
}
}
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).cleanup(false);
final TLRPC.TL_auth_sendCode req = new TLRPC.TL_auth_sendCode();
req.api_hash = BuildVars.APP_HASH;
req.api_id = BuildVars.APP_ID;
req.phone_number = phone;
req.settings = new TLRPC.TL_codeSettings();
req.settings.allow_flashcall = false;
req.settings.allow_app_hash = ApplicationLoader.hasPlayServices;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
if (req.settings.allow_app_hash) {
preferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit();
} else {
preferences.edit().remove("sms_hash").commit();
}
final Bundle params = new Bundle();
params.putString("phone", Marker.ANY_NON_NULL_MARKER + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText()));
try {
params.putString("ephone", Marker.ANY_NON_NULL_MARKER + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString()));
} catch (Exception e) {
FileLog.e(e);
params.putString("ephone", Marker.ANY_NON_NULL_MARKER + phone);
}
params.putString("phoneFormated", phone);
this.nextPressed = true;
int reqId = ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.PhoneView.this.m1773lambda$onNextPressed$8$imwsnshelzviuiLoginActivity$PhoneView(params, req, tLObject, tL_error);
}
}, 27);
LoginActivity.this.needShowProgress(reqId);
}
public void m1771lambda$onNextPressed$6$imwsnshelzviuiLoginActivity$PhoneView(int num, DialogInterface dialog, int which) {
if (UserConfig.selectedAccount != num) {
((LaunchActivity) LoginActivity.this.getParentActivity()).switchToAccount(num, false);
}
LoginActivity.this.finishFragment();
}
public void m1773lambda$onNextPressed$8$imwsnshelzviuiLoginActivity$PhoneView(final Bundle params, final TLRPC.TL_auth_sendCode req, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.m1772lambda$onNextPressed$7$imwsnshelzviuiLoginActivity$PhoneView(error, params, response, req);
}
});
}
public void m1772lambda$onNextPressed$7$imwsnshelzviuiLoginActivity$PhoneView(TLRPC.TL_error error, Bundle params, TLObject response, TLRPC.TL_auth_sendCode req) {
this.nextPressed = false;
if (error == null) {
LoginActivity.this.fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response);
} else if (error.text != null) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowInvalidAlert(req.phone_number, false);
} else if (error.text.contains("PHONE_PASSWORD_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (error.text.contains("PHONE_NUMBER_FLOOD")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("PhoneNumberFlood", R.string.PhoneNumberFlood));
} else if (error.text.contains("PHONE_NUMBER_BANNED")) {
LoginActivity.this.needShowInvalidAlert(req.phone_number, true);
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (error.code != -1000) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
}
}
LoginActivity.this.needHideProgress(false);
}
public void fillNumber() {
}
@Override
public void onShow() {
super.onShow();
fillNumber();
CheckBoxCell checkBoxCell = this.checkBoxCell;
if (checkBoxCell != null) {
checkBoxCell.setChecked(LoginActivity.this.syncContacts, false);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.PhoneView.this.m1774lambda$onShow$9$imwsnshelzviuiLoginActivity$PhoneView();
}
}, 100L);
}
public void m1774lambda$onShow$9$imwsnshelzviuiLoginActivity$PhoneView() {
if (this.phoneField != null) {
if (this.codeField.length() != 0) {
this.phoneField.requestFocus();
HintEditText hintEditText = this.phoneField;
hintEditText.setSelection(hintEditText.length());
AndroidUtilities.showKeyboard(this.phoneField);
return;
}
this.codeField.requestFocus();
AndroidUtilities.showKeyboard(this.codeField);
}
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourPhone", R.string.YourPhone);
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeField.getText().toString();
if (code.length() != 0) {
bundle.putString("phoneview_code", code);
}
String phone = this.phoneField.getText().toString();
if (phone.length() != 0) {
bundle.putString("phoneview_phone", phone);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
String code = bundle.getString("phoneview_code");
if (code != null) {
this.codeField.setText(code);
}
String phone = bundle.getString("phoneview_phone");
if (phone != null) {
this.phoneField.setText(phone);
}
}
}
public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
private ImageView blackImageView;
private ImageView blueImageView;
private String catchedPhone;
private EditTextBoldCursor[] codeField;
private LinearLayout codeFieldContainer;
private int codeTime;
private Timer codeTimer;
private TextView confirmTextView;
private Bundle currentParams;
private int currentType;
private String emailPhone;
private boolean ignoreOnTextChange;
private boolean isRestored;
private double lastCodeTime;
private double lastCurrentTime;
private String lastError;
private int length;
private boolean nextPressed;
private int nextType;
private int openTime;
private String pattern;
private String phone;
private String phoneHash;
private AppCompatTextView problemText;
private ProgressView progressView;
private String requestPhone;
private int time;
private AppCompatTextView timeText;
private Timer timeTimer;
private int timeout;
private final Object timerSync;
private TextView titleTextView;
private boolean waitingForEvent;
static int access$3626(LoginActivitySmsView x0, double x1) {
int i = (int) (x0.codeTime - x1);
x0.codeTime = i;
return i;
}
static int access$4226(LoginActivitySmsView x0, double x1) {
int i = (int) (x0.time - x1);
x0.time = i;
return i;
}
public LoginActivitySmsView(Context context, int type) {
super(context);
this.timerSync = new Object();
this.time = TimeConstants.MIN;
this.codeTime = 15000;
this.lastError = "";
this.pattern = "*";
this.currentType = type;
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.confirmTextView.setTextSize(1, 14.0f);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
TextView textView2 = new TextView(context);
this.titleTextView = textView2;
textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.titleTextView.setTextSize(1, 18.0f);
this.titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.titleTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.titleTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.titleTextView.setGravity(49);
if (this.currentType == 3) {
this.confirmTextView.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
ImageView imageView = new ImageView(context);
imageView.setImageResource(R.drawable.phone_activate);
if (LocaleController.isRTL) {
frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f));
} else {
frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 21, 0.0f, 2.0f, 0.0f, 2.0f));
}
} else {
this.confirmTextView.setGravity(49);
FrameLayout frameLayout2 = new FrameLayout(context);
addView(frameLayout2, LayoutHelper.createLinear(-2, -2, 49));
if (this.currentType == 1) {
ImageView imageView2 = new ImageView(context);
this.blackImageView = imageView2;
imageView2.setImageResource(R.drawable.sms_devices);
this.blackImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.blackImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
ImageView imageView3 = new ImageView(context);
this.blueImageView = imageView3;
imageView3.setImageResource(R.drawable.sms_bubble);
this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
this.titleTextView.setText(LocaleController.getString("SentAppCodeTitle", R.string.SentAppCodeTitle));
} else {
ImageView imageView4 = new ImageView(context);
this.blueImageView = imageView4;
imageView4.setImageResource(R.drawable.sms_code);
this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
this.titleTextView.setText(LocaleController.getString("SentSmsCodeTitle", R.string.SentSmsCodeTitle));
}
addView(this.titleTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 18, 0, 0));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, 49, 0, 17, 0, 0));
}
LinearLayout linearLayout = new LinearLayout(context);
this.codeFieldContainer = linearLayout;
linearLayout.setOrientation(0);
addView(this.codeFieldContainer, LayoutHelper.createLinear(-2, 36, 1));
if (this.currentType == 3) {
this.codeFieldContainer.setVisibility(8);
}
AppCompatTextView appCompatTextView = new AppCompatTextView(context) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.timeText = appCompatTextView;
appCompatTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.timeText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
if (this.currentType == 3) {
this.timeText.setTextSize(1, 14.0f);
addView(this.timeText, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
this.progressView = new ProgressView(context);
this.timeText.setGravity(LocaleController.isRTL ? 5 : 3);
addView(this.progressView, LayoutHelper.createLinear(-1, 3, 0.0f, 12.0f, 0.0f, 0.0f));
} else {
this.timeText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
this.timeText.setTextSize(1, 15.0f);
this.timeText.setGravity(49);
addView(this.timeText, LayoutHelper.createLinear(-2, -2, 49));
}
AppCompatTextView appCompatTextView2 = new AppCompatTextView(context) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.problemText = appCompatTextView2;
appCompatTextView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.problemText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.problemText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
this.problemText.setTextSize(1, 15.0f);
this.problemText.setGravity(49);
if (this.currentType == 1) {
this.problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms));
} else {
this.problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode));
}
addView(this.problemText, LayoutHelper.createLinear(-2, -2, 49));
this.problemText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivitySmsView.this.m1750lambda$new$0$imwsnshelzviuiLoginActivity$LoginActivitySmsView(view);
}
});
}
public void m1750lambda$new$0$imwsnshelzviuiLoginActivity$LoginActivitySmsView(View v) {
if (this.nextPressed) {
return;
}
int i = this.nextType;
boolean email = (i == 4 && this.currentType == 2) || i == 0;
if (!email) {
if (LoginActivity.this.doneProgressView.getTag() != null) {
return;
}
resendCode();
return;
}
try {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, "%s (%d)", pInfo.versionName, Integer.valueOf(pInfo.versionCode));
Intent mailer = new Intent("android.intent.action.SEND");
mailer.setType("message/rfc822");
mailer.putExtra("android.intent.extra.EMAIL", new String[]{"sms@stel.com"});
mailer.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + version + " " + this.emailPhone);
mailer.putExtra("android.intent.extra.TEXT", "Phone: " + this.requestPhone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.lastError);
getContext().startActivity(Intent.createChooser(mailer, "Send email..."));
} catch (Exception e) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ImageView imageView;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (this.currentType != 3 && (imageView = this.blueImageView) != null) {
int innerHeight = imageView.getMeasuredHeight() + this.titleTextView.getMeasuredHeight() + this.confirmTextView.getMeasuredHeight() + AndroidUtilities.dp(35.0f);
int requiredHeight = AndroidUtilities.dp(80.0f);
int maxHeight = AndroidUtilities.dp(291.0f);
if (LoginActivity.this.scrollHeight - innerHeight >= requiredHeight) {
if (LoginActivity.this.scrollHeight <= maxHeight) {
setMeasuredDimension(getMeasuredWidth(), LoginActivity.this.scrollHeight);
return;
} else {
setMeasuredDimension(getMeasuredWidth(), maxHeight);
return;
}
}
setMeasuredDimension(getMeasuredWidth(), innerHeight + requiredHeight);
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int t2;
super.onLayout(changed, l, t, r, b);
if (this.currentType != 3 && this.blueImageView != null) {
int bottom = this.confirmTextView.getBottom();
int height = getMeasuredHeight() - bottom;
if (this.problemText.getVisibility() == 0) {
int h = this.problemText.getMeasuredHeight();
t2 = (bottom + height) - h;
AppCompatTextView appCompatTextView = this.problemText;
appCompatTextView.layout(appCompatTextView.getLeft(), t2, this.problemText.getRight(), t2 + h);
} else if (this.timeText.getVisibility() == 0) {
int h2 = this.timeText.getMeasuredHeight();
t2 = (bottom + height) - h2;
AppCompatTextView appCompatTextView2 = this.timeText;
appCompatTextView2.layout(appCompatTextView2.getLeft(), t2, this.timeText.getRight(), t2 + h2);
} else {
t2 = bottom + height;
}
int h3 = this.codeFieldContainer.getMeasuredHeight();
int t3 = (((t2 - bottom) - h3) / 2) + bottom;
LinearLayout linearLayout = this.codeFieldContainer;
linearLayout.layout(linearLayout.getLeft(), t3, this.codeFieldContainer.getRight(), t3 + h3);
}
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
public void resendCode() {
final Bundle params = new Bundle();
params.putString("phone", this.phone);
params.putString("ephone", this.emailPhone);
params.putString("phoneFormated", this.requestPhone);
this.nextPressed = true;
TLRPC.TL_auth_resendCode req = new TLRPC.TL_auth_resendCode();
req.phone_number = this.requestPhone;
req.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivitySmsView.this.m1758x49a565d5(params, tLObject, tL_error);
}
}, 10);
LoginActivity.this.needShowProgress(0);
}
public void m1758x49a565d5(final Bundle params, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.m1757xbc6ab454(error, params, response);
}
});
}
public void m1757xbc6ab454(TLRPC.TL_error error, Bundle params, TLObject response) {
this.nextPressed = false;
if (error == null) {
LoginActivity.this.fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response);
} else if (error.text != null) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (error.code != -1000) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text);
}
}
LoginActivity.this.needHideProgress(false);
}
@Override
public String getHeaderName() {
if (this.currentType == 1) {
return this.phone;
}
return LocaleController.getString("YourCode", R.string.YourCode);
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public void setParams(Bundle params, boolean restore) {
int i;
int i2;
if (params != null) {
this.isRestored = restore;
this.waitingForEvent = true;
int i3 = this.currentType;
if (i3 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i3 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
}
this.currentParams = params;
this.phone = params.getString("phone");
this.emailPhone = params.getString("ephone");
this.requestPhone = params.getString("phoneFormated");
this.phoneHash = params.getString("phoneHash");
int i4 = params.getInt("timeout");
this.time = i4;
this.timeout = i4;
this.openTime = (int) (System.currentTimeMillis() / 1000);
this.nextType = params.getInt("nextType");
this.pattern = params.getString("pattern");
int i5 = params.getInt("length");
this.length = i5;
if (i5 == 0) {
this.length = 5;
}
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
int i6 = 8;
if (editTextBoldCursorArr == null || editTextBoldCursorArr.length != this.length) {
int a = this.length;
this.codeField = new EditTextBoldCursor[a];
int a2 = 0;
while (a2 < this.length) {
final int num = a2;
this.codeField[a2] = new EditTextBoldCursor(getContext());
this.codeField[a2].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[a2].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[a2].setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField[a2].setCursorWidth(1.5f);
Drawable pressedDrawable = getResources().getDrawable(R.drawable.search_dark_activated).mutate();
pressedDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.MULTIPLY));
this.codeField[a2].setBackgroundDrawable(pressedDrawable);
this.codeField[a2].setImeOptions(268435461);
this.codeField[a2].setTextSize(1, 20.0f);
this.codeField[a2].setMaxLines(1);
this.codeField[a2].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.codeField[a2].setPadding(0, 0, 0, 0);
this.codeField[a2].setGravity(49);
if (this.currentType == 3) {
this.codeField[a2].setEnabled(false);
this.codeField[a2].setInputType(0);
this.codeField[a2].setVisibility(i6);
} else {
this.codeField[a2].setInputType(3);
}
this.codeFieldContainer.addView(this.codeField[a2], LayoutHelper.createLinear(34, 36, 1, 0, 0, a2 != this.length - 1 ? 7 : 0, 0));
this.codeField[a2].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
int len;
if (!LoginActivitySmsView.this.ignoreOnTextChange && (len = s.length()) >= 1) {
if (len > 1) {
String text = s.toString();
LoginActivitySmsView.this.ignoreOnTextChange = true;
for (int a3 = 0; a3 < Math.min(LoginActivitySmsView.this.length - num, len); a3++) {
if (a3 != 0) {
LoginActivitySmsView.this.codeField[num + a3].setText(text.substring(a3, a3 + 1));
} else {
s.replace(0, len, text.substring(a3, a3 + 1));
}
}
LoginActivitySmsView.this.ignoreOnTextChange = false;
}
if (num != LoginActivitySmsView.this.length - 1) {
LoginActivitySmsView.this.codeField[num + 1].setSelection(LoginActivitySmsView.this.codeField[num + 1].length());
LoginActivitySmsView.this.codeField[num + 1].requestFocus();
}
if ((num == LoginActivitySmsView.this.length - 1 || (num == LoginActivitySmsView.this.length - 2 && len >= 2)) && LoginActivitySmsView.this.getCode().length() == LoginActivitySmsView.this.length) {
LoginActivitySmsView.this.onNextPressed();
}
}
}
});
this.codeField[a2].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i7, KeyEvent keyEvent) {
return LoginActivity.LoginActivitySmsView.this.m1759xc2cc68fc(num, view, i7, keyEvent);
}
});
this.codeField[a2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i7, KeyEvent keyEvent) {
return LoginActivity.LoginActivitySmsView.this.m1760x50071a7d(textView, i7, keyEvent);
}
});
a2++;
i6 = 8;
}
} else {
int a3 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
if (a3 >= editTextBoldCursorArr2.length) {
break;
}
editTextBoldCursorArr2[a3].setText("");
a3++;
}
}
ProgressView progressView = this.progressView;
if (progressView != null) {
progressView.setVisibility(this.nextType != 0 ? 0 : 8);
}
if (this.phone != null) {
String number = PhoneFormat.getInstance().format(this.phone);
CharSequence str = "";
int i7 = this.currentType;
if (i7 == 1) {
str = AndroidUtilities.replaceTags(LocaleController.getString("SentAppCode", R.string.SentAppCode));
} else if (i7 == 2) {
str = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(number)));
} else if (i7 == 3) {
str = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(number)));
} else if (i7 == 4) {
str = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(number)));
}
this.confirmTextView.setText(str);
if (this.currentType != 3) {
AndroidUtilities.showKeyboard(this.codeField[0]);
this.codeField[0].requestFocus();
} else {
AndroidUtilities.hideKeyboard(this.codeField[0]);
}
destroyTimer();
destroyCodeTimer();
this.lastCurrentTime = System.currentTimeMillis();
int i8 = this.currentType;
if (i8 == 1) {
this.problemText.setVisibility(0);
this.timeText.setVisibility(8);
return;
}
if (i8 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
this.problemText.setVisibility(8);
this.timeText.setVisibility(0);
int i9 = this.nextType;
if (i9 == 4) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
} else if (i9 == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0));
}
String callLogNumber = this.isRestored ? AndroidUtilities.obtainLoginPhoneCall(this.pattern) : null;
if (callLogNumber != null) {
this.ignoreOnTextChange = true;
this.codeField[0].setText(callLogNumber);
this.ignoreOnTextChange = false;
onNextPressed();
return;
}
String str2 = this.catchedPhone;
if (str2 != null) {
this.ignoreOnTextChange = true;
this.codeField[0].setText(str2);
this.ignoreOnTextChange = false;
onNextPressed();
return;
}
createTimer();
return;
}
if (i8 != 2 || ((i = this.nextType) != 4 && i != 3)) {
if (i8 == 4 && this.nextType == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
createTimer();
return;
}
this.timeText.setVisibility(8);
this.problemText.setVisibility(8);
createCodeTimer();
return;
}
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
String hash = preferences.getString("sms_hash", null);
String savedCode = null;
if (!TextUtils.isEmpty(hash)) {
String savedCode2 = preferences.getString("sms_hash_code", null);
if (savedCode2 != null && savedCode2.contains(hash + LogUtils.VERTICAL)) {
savedCode = savedCode2.substring(savedCode2.indexOf(124) + 1);
} else {
savedCode = null;
}
}
if (savedCode != null) {
this.codeField[0].setText(savedCode);
onNextPressed();
} else {
createTimer();
}
}
}
}
public boolean m1759xc2cc68fc(int num, View v, int keyCode, KeyEvent event) {
if (keyCode == 67 && this.codeField[num].length() == 0 && num > 0) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
editTextBoldCursorArr[num - 1].setSelection(editTextBoldCursorArr[num - 1].length());
this.codeField[num - 1].requestFocus();
this.codeField[num - 1].dispatchKeyEvent(event);
return true;
}
return false;
}
public boolean m1760x50071a7d(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public void createCodeTimer() {
if (this.codeTimer != null) {
return;
}
this.codeTime = 15000;
this.codeTimer = new Timer();
this.lastCodeTime = System.currentTimeMillis();
this.codeTimer.schedule(new AnonymousClass4(), 0L, 1000L);
}
public class AnonymousClass4 extends TimerTask {
AnonymousClass4() {
}
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.AnonymousClass4.this.m1761x8265ea0c();
}
});
}
public void m1761x8265ea0c() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - LoginActivitySmsView.this.lastCodeTime;
LoginActivitySmsView.this.lastCodeTime = currentTime;
LoginActivitySmsView.access$3626(LoginActivitySmsView.this, diff);
if (LoginActivitySmsView.this.codeTime <= 1000) {
LoginActivitySmsView.this.problemText.setVisibility(0);
LoginActivitySmsView.this.timeText.setVisibility(8);
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;
}
Timer timer = new Timer();
this.timeTimer = timer;
timer.schedule(new AnonymousClass5(), 0L, 1000L);
}
public class AnonymousClass5 extends TimerTask {
AnonymousClass5() {
}
@Override
public void run() {
if (LoginActivitySmsView.this.timeTimer == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.AnonymousClass5.this.m1764xd50e948f();
}
});
}
public void m1764xd50e948f() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - LoginActivitySmsView.this.lastCurrentTime;
LoginActivitySmsView.this.lastCurrentTime = currentTime;
LoginActivitySmsView.access$4226(LoginActivitySmsView.this, diff);
if (LoginActivitySmsView.this.time >= 1000) {
int minutes = (LoginActivitySmsView.this.time / 1000) / 60;
int seconds = (LoginActivitySmsView.this.time / 1000) - (minutes * 60);
if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 3) {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(minutes), Integer.valueOf(seconds)));
} else if (LoginActivitySmsView.this.nextType == 2) {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(minutes), Integer.valueOf(seconds)));
}
if (LoginActivitySmsView.this.progressView != null) {
LoginActivitySmsView.this.progressView.setProgress(1.0f - (LoginActivitySmsView.this.time / LoginActivitySmsView.this.timeout));
return;
}
return;
}
if (LoginActivitySmsView.this.progressView != null) {
LoginActivitySmsView.this.progressView.setProgress(1.0f);
}
LoginActivitySmsView.this.destroyTimer();
if (LoginActivitySmsView.this.currentType != 3) {
if (LoginActivitySmsView.this.currentType == 2 || LoginActivitySmsView.this.currentType == 4) {
if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 2) {
if (LoginActivitySmsView.this.nextType == 4) {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString("Calling", R.string.Calling));
} else {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString("SendingSms", R.string.SendingSms));
}
LoginActivitySmsView.this.createCodeTimer();
TLRPC.TL_auth_resendCode req = new TLRPC.TL_auth_resendCode();
req.phone_number = LoginActivitySmsView.this.requestPhone;
req.phone_code_hash = LoginActivitySmsView.this.phoneHash;
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivitySmsView.AnonymousClass5.this.m1763xabba3f4e(tLObject, tL_error);
}
}, 10);
return;
}
if (LoginActivitySmsView.this.nextType == 3) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
LoginActivitySmsView.this.waitingForEvent = false;
LoginActivitySmsView.this.destroyCodeTimer();
LoginActivitySmsView.this.resendCode();
return;
}
return;
}
return;
}
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
LoginActivitySmsView.this.waitingForEvent = false;
LoginActivitySmsView.this.destroyCodeTimer();
LoginActivitySmsView.this.resendCode();
}
public void m1763xabba3f4e(TLObject response, final TLRPC.TL_error error) {
if (error != null && error.text != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.AnonymousClass5.this.m1762x8265ea0d(error);
}
});
}
}
public void m1762x8265ea0d(TLRPC.TL_error error) {
LoginActivitySmsView.this.lastError = error.text;
}
}
public void destroyTimer() {
try {
synchronized (this.timerSync) {
Timer timer = this.timeTimer;
if (timer != null) {
timer.cancel();
this.timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public String getCode() {
if (this.codeField == null) {
return "";
}
StringBuilder codeBuilder = new StringBuilder();
int a = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (a < editTextBoldCursorArr.length) {
codeBuilder.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[a].getText().toString()));
a++;
} else {
return codeBuilder.toString();
}
}
}
@Override
public void onNextPressed() {
if (this.nextPressed || LoginActivity.this.currentViewNum < 1 || LoginActivity.this.currentViewNum > 4) {
return;
}
String code = getCode();
if (TextUtils.isEmpty(code)) {
AndroidUtilities.shakeView(this.codeFieldContainer, 2.0f, 0);
return;
}
this.nextPressed = true;
int i = this.currentType;
if (i == 2) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i == 3) {
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = false;
final TLRPC.TL_auth_signIn req = new TLRPC.TL_auth_signIn();
req.phone_number = this.requestPhone;
req.phone_code = code;
req.phone_code_hash = this.phoneHash;
destroyTimer();
int reqId = ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivitySmsView.this.m1755xca57bac9(req, tLObject, tL_error);
}
}, 10);
LoginActivity.this.needShowProgress(reqId);
}
public void m1755xca57bac9(final TLRPC.TL_auth_signIn req, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.m1754x3d1d0948(error, response, req);
}
});
}
public void m1754x3d1d0948(TLRPC.TL_error error, TLObject response, final TLRPC.TL_auth_signIn req) {
int i;
EditTextBoldCursor[] editTextBoldCursorArr;
int i2;
boolean ok = false;
if (error == null) {
this.nextPressed = false;
ok = true;
LoginActivity.this.needHideProgress(false);
destroyTimer();
destroyCodeTimer();
if (!(response instanceof TLRPC.TL_auth_authorizationSignUpRequired)) {
LoginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) response);
} else {
TLRPC.TL_auth_authorizationSignUpRequired authorization = (TLRPC.TL_auth_authorizationSignUpRequired) response;
if (authorization.terms_of_service != null) {
LoginActivity.this.currentTermsOfService = authorization.terms_of_service;
}
Bundle params = new Bundle();
params.putString("phoneFormated", this.requestPhone);
params.putString("phoneHash", this.phoneHash);
params.putString("code", req.phone_code);
LoginActivity.this.setPage(5, true, params, false);
}
} else {
this.lastError = error.text;
if (error.text.contains("SESSION_PASSWORD_NEEDED")) {
ok = true;
TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword();
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivitySmsView.this.m1753xafe257c7(req, tLObject, tL_error);
}
}, 10);
destroyTimer();
destroyCodeTimer();
} else {
LoginActivity.this.needHideProgress(false);
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 == 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;
this.nextPressed = false;
if (this.currentType != 3) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
int a = 0;
while (true) {
editTextBoldCursorArr = this.codeField;
if (a >= editTextBoldCursorArr.length) {
break;
}
editTextBoldCursorArr[a].setText("");
a++;
}
editTextBoldCursorArr[0].requestFocus();
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
this.nextPressed = true;
LoginActivity.this.setPage(0, true, null, true);
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("FloodWait", R.string.FloodWait));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text);
}
}
}
}
if (ok && this.currentType == 3) {
AndroidUtilities.endIncomingCall();
}
}
public void m1753xafe257c7(final TLRPC.TL_auth_signIn req, final TLObject response1, final TLRPC.TL_error error1) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.m1752x22a7a646(error1, response1, req);
}
});
}
public void m1752x22a7a646(TLRPC.TL_error tL_error, TLObject tLObject, TLRPC.TL_auth_signIn tL_auth_signIn) {
this.nextPressed = false;
LoginActivity.this.needHideProgress(false);
if (tL_error != null) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), tL_error.text);
return;
}
TLRPC.TL_account_password tL_account_password = (TLRPC.TL_account_password) tLObject;
if (!TwoStepVerificationActivity.canHandleCurrentPassword(tL_account_password, true)) {
AlertsCreator.showUpdateAppAlert(LoginActivity.this.getParentActivity(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
return;
}
Bundle bundle = new Bundle();
if (tL_account_password.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) tL_account_password.current_algo;
bundle.putString("current_salt1", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt1));
bundle.putString("current_salt2", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.salt2));
bundle.putString("current_p", Utilities.bytesToHex(tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.p));
bundle.putInt("current_g", tL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.g);
bundle.putString("current_srp_B", Utilities.bytesToHex(tL_account_password.srp_B));
bundle.putLong("current_srp_id", tL_account_password.srp_id);
bundle.putInt("passwordType", 1);
}
bundle.putString(TrackReferenceTypeBox.TYPE1, tL_account_password.hint != null ? tL_account_password.hint : "");
bundle.putString("email_unconfirmed_pattern", tL_account_password.email_unconfirmed_pattern != null ? tL_account_password.email_unconfirmed_pattern : "");
bundle.putString("phoneFormated", this.requestPhone);
bundle.putString("phoneHash", this.phoneHash);
bundle.putString("code", tL_auth_signIn.phone_code);
bundle.putInt("has_recovery", tL_account_password.has_recovery ? 1 : 0);
LoginActivity.this.setPage(6, true, bundle, false);
}
@Override
public boolean onBackPressed(boolean force) {
if (!force) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("StopVerification", R.string.StopVerification));
builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null);
builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivitySmsView.this.m1751x881cf6d6(dialogInterface, i);
}
});
LoginActivity.this.showDialog(builder.create());
return false;
}
this.nextPressed = false;
LoginActivity.this.needHideProgress(true);
TLRPC.TL_auth_cancelCode req = new TLRPC.TL_auth_cancelCode();
req.phone_number = this.requestPhone;
req.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivitySmsView.lambda$onBackPressed$10(tLObject, tL_error);
}
}, 10);
destroyTimer();
destroyCodeTimer();
this.currentParams = null;
int i = this.currentType;
if (i == 2) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i == 3) {
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = false;
return true;
}
public void m1751x881cf6d6(DialogInterface dialogInterface, int i) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
public static void lambda$onBackPressed$10(TLObject response, TLRPC.TL_error error) {
}
@Override
public void onDestroyActivity() {
super.onDestroyActivity();
int i = this.currentType;
if (i == 2) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i == 3) {
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = false;
destroyTimer();
destroyCodeTimer();
}
@Override
public void onShow() {
super.onShow();
if (this.currentType == 3) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivitySmsView.this.m1756xf0da726d();
}
}, 100L);
}
public void m1756xf0da726d() {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (editTextBoldCursorArr != null) {
for (int a = editTextBoldCursorArr.length - 1; a >= 0; a--) {
if (a == 0 || this.codeField[a].length() != 0) {
this.codeField[a].requestFocus();
EditTextBoldCursor editTextBoldCursor = this.codeField[a];
editTextBoldCursor.setSelection(editTextBoldCursor.length());
AndroidUtilities.showKeyboard(this.codeField[a]);
return;
}
}
}
}
@Override
public void didReceivedNotification(int id, int account, Object... args) {
if (!this.waitingForEvent || this.codeField == null) {
return;
}
if (id == NotificationCenter.didReceiveSmsCode) {
this.codeField[0].setText("" + args[0]);
onNextPressed();
return;
}
if (id == NotificationCenter.didReceiveCall) {
String num = "" + args[0];
if (!AndroidUtilities.checkPhonePattern(this.pattern, num)) {
return;
}
if (!this.pattern.equals("*")) {
this.catchedPhone = num;
AndroidUtilities.endIncomingCall();
}
this.ignoreOnTextChange = true;
this.codeField[0].setText(num);
this.ignoreOnTextChange = false;
onNextPressed();
}
}
@Override
public void saveStateParams(Bundle bundle) {
String code = getCode();
if (code.length() != 0) {
bundle.putString("smsview_code_" + this.currentType, code);
}
String str = this.catchedPhone;
if (str != null) {
bundle.putString("catchedPhone", str);
}
if (this.currentParams != null) {
bundle.putBundle("smsview_params_" + this.currentType, this.currentParams);
}
int i = this.time;
if (i != 0) {
bundle.putInt("time", i);
}
int i2 = this.openTime;
if (i2 != 0) {
bundle.putInt("open", i2);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
EditTextBoldCursor[] editTextBoldCursorArr;
Bundle bundle2 = bundle.getBundle("smsview_params_" + this.currentType);
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
String catched = bundle.getString("catchedPhone");
if (catched != null) {
this.catchedPhone = catched;
}
String code = bundle.getString("smsview_code_" + this.currentType);
if (code != null && (editTextBoldCursorArr = this.codeField) != null) {
editTextBoldCursorArr[0].setText(code);
}
int t = bundle.getInt("time");
if (t != 0) {
this.time = t;
}
int t2 = bundle.getInt("open");
if (t2 != 0) {
this.openTime = t2;
}
}
}
public class LoginActivityPasswordView extends SlideView {
private TextView cancelButton;
private EditTextBoldCursor codeField;
private TextView confirmTextView;
private Bundle currentParams;
private int current_g;
private byte[] current_p;
private byte[] current_salt1;
private byte[] current_salt2;
private byte[] current_srp_B;
private long current_srp_id;
private String email_unconfirmed_pattern;
private boolean has_recovery;
private String hint;
private boolean nextPressed;
private int passwordType;
private String phoneCode;
private String phoneHash;
private String requestPhone;
private TextView resetAccountButton;
private TextView resetAccountText;
public LoginActivityPasswordView(Context context) {
super(context);
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.confirmTextView.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString("LoginPasswordText", R.string.LoginPasswordText));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.codeField = editTextBoldCursor;
editTextBoldCursor.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
this.codeField.setImeOptions(268435461);
this.codeField.setTextSize(1, 18.0f);
this.codeField.setMaxLines(1);
this.codeField.setPadding(0, 0, 0, 0);
this.codeField.setInputType(TsExtractor.TS_STREAM_TYPE_AC3);
this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
this.codeField.setTypeface(Typeface.DEFAULT);
this.codeField.setGravity(LocaleController.isRTL ? 5 : 3);
addView(this.codeField, LayoutHelper.createLinear(-1, 36, 1, 0, 20, 0, 0));
this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
return LoginActivity.LoginActivityPasswordView.this.m1710x43fe618d(textView2, i, keyEvent);
}
});
TextView textView2 = new TextView(context);
this.cancelButton = textView2;
textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.cancelButton.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
this.cancelButton.setTextSize(1, 14.0f);
this.cancelButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.cancelButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
addView(this.cancelButton, LayoutHelper.createLinear(-1, -2, (LocaleController.isRTL ? 5 : 3) | 48));
this.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityPasswordView.this.m1714x77b2be09(view);
}
});
TextView textView3 = new TextView(context);
this.resetAccountButton = textView3;
textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText6));
this.resetAccountButton.setVisibility(8);
this.resetAccountButton.setText(LocaleController.getString("ResetMyAccount", R.string.ResetMyAccount));
this.resetAccountButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.resetAccountButton.setTextSize(1, 14.0f);
this.resetAccountButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.resetAccountButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
addView(this.resetAccountButton, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 34, 0, 0));
this.resetAccountButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityPasswordView.this.m1718xab671a85(view);
}
});
TextView textView4 = new TextView(context);
this.resetAccountText = textView4;
textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.resetAccountText.setVisibility(8);
this.resetAccountText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.resetAccountText.setText(LocaleController.getString("ResetMyAccountText", R.string.ResetMyAccountText));
this.resetAccountText.setTextSize(1, 14.0f);
this.resetAccountText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.resetAccountText, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 7, 0, 14));
}
public boolean m1710x43fe618d(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public void m1714x77b2be09(View view) {
if (LoginActivity.this.doneProgressView.getTag() != null) {
return;
}
if (this.has_recovery) {
LoginActivity.this.needShowProgress(0);
TLRPC.TL_auth_requestPasswordRecovery req = new TLRPC.TL_auth_requestPasswordRecovery();
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityPasswordView.this.m1713xeac5a6ea(tLObject, tL_error);
}
}, 10);
} else {
this.resetAccountText.setVisibility(0);
this.resetAccountButton.setVisibility(0);
AndroidUtilities.hideKeyboard(this.codeField);
LoginActivity.this.needShowAlert(LocaleController.getString("RestorePasswordNoEitle", R.string.RestorePasswordNoEmailTitle), LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
}
}
public void m1713xeac5a6ea(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.m1712x5dd88fcb(error, response);
}
});
}
public void m1712x5dd88fcb(TLRPC.TL_error error, TLObject response) {
String timeString;
LoginActivity.this.needHideProgress(false);
if (error == null) {
final TLRPC.TL_auth_passwordRecovery res = (TLRPC.TL_auth_passwordRecovery) response;
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setMessage(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, res.email_pattern));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityPasswordView.this.m1711xd0eb78ac(res, dialogInterface, i);
}
});
Dialog dialog = LoginActivity.this.showDialog(builder.create());
if (dialog != null) {
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
return;
}
return;
}
if (!error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
return;
}
int time = Utilities.parseInt(error.text).intValue();
if (time < 60) {
timeString = LocaleController.formatPluralString("Seconds", time);
} else {
timeString = LocaleController.formatPluralString("Minutes", time / 60);
}
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString));
}
public void m1711xd0eb78ac(TLRPC.TL_auth_passwordRecovery res, DialogInterface dialogInterface, int i) {
Bundle bundle = new Bundle();
bundle.putString("email_unconfirmed_pattern", res.email_pattern);
LoginActivity.this.setPage(7, true, bundle, false);
}
public void m1718xab671a85(View view) {
if (LoginActivity.this.doneProgressView.getTag() != null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setMessage(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
builder.setTitle(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
builder.setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityPasswordView.this.m1717x1e7a0366(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
LoginActivity.this.showDialog(builder.create());
}
public void m1717x1e7a0366(DialogInterface dialogInterface, int i) {
LoginActivity.this.needShowProgress(0);
TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount();
req.reason = "Forgot password";
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityPasswordView.this.m1716x918cec47(tLObject, tL_error);
}
}, 10);
}
public void m1716x918cec47(TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.m1715x49fd528(error);
}
});
}
public void m1715x49fd528(TLRPC.TL_error error) {
LoginActivity.this.needHideProgress(false);
if (error == null) {
Bundle params = new Bundle();
params.putString("phoneFormated", this.requestPhone);
params.putString("phoneHash", this.phoneHash);
params.putString("code", this.phoneCode);
LoginActivity.this.setPage(5, true, params, false);
return;
}
if (error.text.equals("2FA_RECENT_CONFIRM")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
return;
}
if (!error.text.startsWith("2FA_CONFIRM_WAIT_")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
return;
}
Bundle params2 = new Bundle();
params2.putString("phoneFormated", this.requestPhone);
params2.putString("phoneHash", this.phoneHash);
params2.putString("code", this.phoneCode);
params2.putInt("startTime", ConnectionsManager.getInstance(LoginActivity.this.currentAccount).getCurrentTime());
params2.putInt("waitTime", Utilities.parseInt(error.text.replace("2FA_CONFIRM_WAIT_", "")).intValue());
LoginActivity.this.setPage(8, true, params2, false);
}
@Override
public String getHeaderName() {
return LocaleController.getString("LoginPassword", R.string.LoginPassword);
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void setParams(Bundle params, boolean restore) {
if (params == null) {
return;
}
if (params.isEmpty()) {
this.resetAccountButton.setVisibility(0);
this.resetAccountText.setVisibility(0);
AndroidUtilities.hideKeyboard(this.codeField);
return;
}
this.resetAccountButton.setVisibility(8);
this.resetAccountText.setVisibility(8);
this.codeField.setText("");
this.currentParams = params;
this.current_salt1 = Utilities.hexToBytes(params.getString("current_salt1"));
this.current_salt2 = Utilities.hexToBytes(this.currentParams.getString("current_salt2"));
this.current_p = Utilities.hexToBytes(this.currentParams.getString("current_p"));
this.current_g = this.currentParams.getInt("current_g");
this.current_srp_B = Utilities.hexToBytes(this.currentParams.getString("current_srp_B"));
this.current_srp_id = this.currentParams.getLong("current_srp_id");
this.passwordType = this.currentParams.getInt("passwordType");
this.hint = this.currentParams.getString(TrackReferenceTypeBox.TYPE1);
this.has_recovery = this.currentParams.getInt("has_recovery") == 1;
this.email_unconfirmed_pattern = this.currentParams.getString("email_unconfirmed_pattern");
this.requestPhone = params.getString("phoneFormated");
this.phoneHash = params.getString("phoneHash");
this.phoneCode = params.getString("code");
String str = this.hint;
if (str != null && str.length() > 0) {
this.codeField.setHint(this.hint);
} else {
this.codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
}
}
private void onPasscodeError(boolean clear) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
Vibrator v = (Vibrator) LoginActivity.this.getParentActivity().getSystemService("vibrator");
if (v != null) {
v.vibrate(200L);
}
if (clear) {
this.codeField.setText("");
}
AndroidUtilities.shakeView(this.confirmTextView, 2.0f, 0);
}
@Override
public void onNextPressed() {
if (this.nextPressed) {
return;
}
final String oldPassword = this.codeField.getText().toString();
if (oldPassword.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.m1722x41d584e9(oldPassword);
}
});
}
public void m1722x41d584e9(String oldPassword) {
byte[] passwordBytes;
TLRPC.PasswordKdfAlgo current_algo = null;
if (this.passwordType == 1) {
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = new TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow();
algo.salt1 = this.current_salt1;
algo.salt2 = this.current_salt2;
algo.g = this.current_g;
algo.p = this.current_p;
current_algo = algo;
}
if (current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
byte[] passwordBytes2 = AndroidUtilities.getStringBytes(oldPassword);
passwordBytes = SRPHelper.getX(passwordBytes2, (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) current_algo);
} else {
passwordBytes = null;
}
TLRPC.TL_auth_checkPassword req = new TLRPC.TL_auth_checkPassword();
RequestDelegate requestDelegate = new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityPasswordView.this.m1721xb4e86dca(tLObject, tL_error);
}
};
if (current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) {
TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo2 = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) current_algo;
algo2.salt1 = this.current_salt1;
algo2.salt2 = this.current_salt2;
algo2.g = this.current_g;
algo2.p = this.current_p;
req.password = SRPHelper.startCheck(passwordBytes, this.current_srp_id, this.current_srp_B, algo2);
if (req.password != null) {
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, requestDelegate, 10);
return;
}
TLRPC.TL_error error = new TLRPC.TL_error();
error.text = "PASSWORD_HASH_INVALID";
requestDelegate.run(null, error);
}
}
public void m1721xb4e86dca(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.m1720x27fb56ab(error, response);
}
});
}
public void m1720x27fb56ab(TLRPC.TL_error error, TLObject response) {
String timeString;
this.nextPressed = false;
if (error == null || !"SRP_ID_INVALID".equals(error.text)) {
LoginActivity.this.needHideProgress(false);
if (response instanceof TLRPC.TL_auth_authorization) {
LoginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) response);
return;
}
if (error.text.equals("PASSWORD_HASH_INVALID")) {
onPasscodeError(true);
return;
}
if (!error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
return;
}
int time = Utilities.parseInt(error.text).intValue();
if (time < 60) {
timeString = LocaleController.formatPluralString("Seconds", time);
} else {
timeString = LocaleController.formatPluralString("Minutes", time / 60);
}
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString));
return;
}
TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword();
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(getPasswordReq, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityPasswordView.this.m1719x9b0e3f8c(tLObject, tL_error);
}
}, 8);
}
public void m1719x9b0e3f8c(final TLObject response2, final TLRPC.TL_error error2) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityPasswordView.this.m1723xd3bb5ab4(error2, response2);
}
});
}
public void m1723xd3bb5ab4(TLRPC.TL_error error2, TLObject response2) {
if (error2 == null) {
TLRPC.TL_account_password password = (TLRPC.TL_account_password) response2;
this.current_srp_B = password.srp_B;
this.current_srp_id = password.srp_id;
onNextPressed();
}
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public boolean onBackPressed(boolean force) {
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.m1724xe707f7ce();
}
}, 100L);
}
public void m1724xe707f7ce() {
EditTextBoldCursor editTextBoldCursor = this.codeField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.codeField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
AndroidUtilities.showKeyboard(this.codeField);
}
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeField.getText().toString();
if (code.length() != 0) {
bundle.putString("passview_code", code);
}
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 code = bundle.getString("passview_code");
if (code != null) {
this.codeField.setText(code);
}
}
}
public class LoginActivityResetWaitView extends SlideView {
private TextView confirmTextView;
private Bundle currentParams;
private String phoneCode;
private String phoneHash;
private String requestPhone;
private TextView resetAccountButton;
private TextView resetAccountText;
private TextView resetAccountTime;
private int startTime;
private Runnable timeRunnable;
private int waitTime;
public LoginActivityResetWaitView(Context context) {
super(context);
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.confirmTextView.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
TextView textView2 = new TextView(context);
this.resetAccountText = textView2;
textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.resetAccountText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.resetAccountText.setText(LocaleController.getString("ResetAccountStatus", R.string.ResetAccountStatus));
this.resetAccountText.setTextSize(1, 14.0f);
this.resetAccountText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.resetAccountText, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 24, 0, 0));
TextView textView3 = new TextView(context);
this.resetAccountTime = textView3;
textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.resetAccountTime.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.resetAccountTime.setTextSize(1, 14.0f);
this.resetAccountTime.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.resetAccountTime, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 2, 0, 0));
TextView textView4 = new TextView(context);
this.resetAccountButton = textView4;
textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
this.resetAccountButton.setText(LocaleController.getString("ResetAccountButton", R.string.ResetAccountButton));
this.resetAccountButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.resetAccountButton.setTextSize(1, 14.0f);
this.resetAccountButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.resetAccountButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
addView(this.resetAccountButton, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 7, 0, 0));
this.resetAccountButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityResetWaitView.this.m1749x1aaa9e5f(view);
}
});
}
public void m1749x1aaa9e5f(View view) {
if (LoginActivity.this.doneProgressView.getTag() != null || Math.abs(ConnectionsManager.getInstance(LoginActivity.this.currentAccount).getCurrentTime() - this.startTime) < this.waitTime) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setMessage(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
builder.setTitle(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
builder.setPositiveButton(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityResetWaitView.this.m1748x9f4d19e(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
LoginActivity.this.showDialog(builder.create());
}
public void m1748x9f4d19e(DialogInterface dialogInterface, int i) {
LoginActivity.this.needShowProgress(0);
TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount();
req.reason = "Forgot password";
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityResetWaitView.this.m1747xf93f04dd(tLObject, tL_error);
}
}, 10);
}
public void m1747xf93f04dd(TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityResetWaitView.this.m1746xe889381c(error);
}
});
}
public void m1746xe889381c(TLRPC.TL_error error) {
LoginActivity.this.needHideProgress(false);
if (error == null) {
Bundle params = new Bundle();
params.putString("phoneFormated", this.requestPhone);
params.putString("phoneHash", this.phoneHash);
params.putString("code", this.phoneCode);
LoginActivity.this.setPage(5, true, params, false);
return;
}
if (error.text.equals("2FA_RECENT_CONFIRM")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
}
}
@Override
public String getHeaderName() {
return LocaleController.getString("ResetAccount", R.string.ResetAccount);
}
public void updateTimeText() {
int timeLeft = Math.max(0, this.waitTime - (ConnectionsManager.getInstance(LoginActivity.this.currentAccount).getCurrentTime() - this.startTime));
int days = timeLeft / 86400;
int hours = (timeLeft - (days * 86400)) / 3600;
int minutes = ((timeLeft - (86400 * days)) - (hours * 3600)) / 60;
int seconds = timeLeft % 60;
if (days != 0) {
this.resetAccountTime.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("DaysBold", days) + " " + LocaleController.formatPluralString("HoursBold", hours) + " " + LocaleController.formatPluralString("MinutesBold", minutes)));
} else {
this.resetAccountTime.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("HoursBold", hours) + " " + LocaleController.formatPluralString("MinutesBold", minutes) + " " + LocaleController.formatPluralString("SecondsBold", seconds)));
}
if (timeLeft > 0) {
this.resetAccountButton.setTag(Theme.key_windowBackgroundWhiteGrayText6);
this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
} else {
this.resetAccountButton.setTag(Theme.key_windowBackgroundWhiteRedText6);
this.resetAccountButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText6));
}
}
@Override
public void setParams(Bundle params, boolean restore) {
if (params == null) {
return;
}
this.currentParams = params;
this.requestPhone = params.getString("phoneFormated");
this.phoneHash = params.getString("phoneHash");
this.phoneCode = params.getString("code");
this.startTime = params.getInt("startTime");
this.waitTime = params.getInt("waitTime");
this.confirmTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("ResetAccountInfo", R.string.ResetAccountInfo, LocaleController.addNbsp(PhoneFormat.getInstance().format(Marker.ANY_NON_NULL_MARKER + this.requestPhone)))));
updateTimeText();
Runnable runnable = new Runnable() {
@Override
public void run() {
if (LoginActivityResetWaitView.this.timeRunnable == this) {
LoginActivityResetWaitView.this.updateTimeText();
AndroidUtilities.runOnUIThread(LoginActivityResetWaitView.this.timeRunnable, 1000L);
}
}
};
this.timeRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 1000L);
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public boolean onBackPressed(boolean force) {
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 LoginActivityRecoverView extends SlideView {
private TextView cancelButton;
private EditTextBoldCursor codeField;
private TextView confirmTextView;
private Bundle currentParams;
private String email_unconfirmed_pattern;
private boolean nextPressed;
public LoginActivityRecoverView(Context context) {
super(context);
setOrientation(1);
TextView textView = new TextView(context);
this.confirmTextView = textView;
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.confirmTextView.setTextSize(1, 14.0f);
this.confirmTextView.setGravity(LocaleController.isRTL ? 5 : 3);
this.confirmTextView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.confirmTextView.setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo));
addView(this.confirmTextView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3));
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.codeField = editTextBoldCursor;
editTextBoldCursor.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.codeField.setHint(LocaleController.getString("PasswordCode", R.string.PasswordCode));
this.codeField.setImeOptions(268435461);
this.codeField.setTextSize(1, 18.0f);
this.codeField.setMaxLines(1);
this.codeField.setPadding(0, 0, 0, 0);
this.codeField.setInputType(3);
this.codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
this.codeField.setTypeface(Typeface.DEFAULT);
this.codeField.setGravity(LocaleController.isRTL ? 5 : 3);
addView(this.codeField, LayoutHelper.createLinear(-1, 36, 1, 0, 20, 0, 0));
this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
return LoginActivity.LoginActivityRecoverView.this.m1725x25ece2dc(textView2, i, keyEvent);
}
});
TextView textView2 = new TextView(context);
this.cancelButton = textView2;
textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 80);
this.cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.cancelButton.setTextSize(1, 14.0f);
this.cancelButton.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.cancelButton.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
addView(this.cancelButton, LayoutHelper.createLinear(-2, -2, (LocaleController.isRTL ? 5 : 3) | 80, 0, 0, 0, 14));
this.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LoginActivity.LoginActivityRecoverView.this.m1727x7114f4de(view);
}
});
}
public boolean m1725x25ece2dc(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public void m1727x7114f4de(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setMessage(LocaleController.getString("RestoreEmailTroubleText", R.string.RestoreEmailTroubleText));
builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRecoverView.this.m1726x4b80ebdd(dialogInterface, i);
}
});
Dialog dialog = LoginActivity.this.showDialog(builder.create());
if (dialog != null) {
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
}
}
public void m1726x4b80ebdd(DialogInterface dialogInterface, int i) {
LoginActivity.this.setPage(6, true, new Bundle(), true);
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public String getHeaderName() {
return LocaleController.getString("LoginPassword", R.string.LoginPassword);
}
@Override
public void setParams(Bundle params, boolean restore) {
if (params == null) {
return;
}
this.codeField.setText("");
this.currentParams = params;
String string = params.getString("email_unconfirmed_pattern");
this.email_unconfirmed_pattern = string;
this.cancelButton.setText(LocaleController.formatString("RestoreEmailTrouble", R.string.RestoreEmailTrouble, string));
AndroidUtilities.showKeyboard(this.codeField);
this.codeField.requestFocus();
}
private void onPasscodeError(boolean clear) {
if (LoginActivity.this.getParentActivity() == null) {
return;
}
Vibrator v = (Vibrator) LoginActivity.this.getParentActivity().getSystemService("vibrator");
if (v != null) {
v.vibrate(200L);
}
if (clear) {
this.codeField.setText("");
}
AndroidUtilities.shakeView(this.confirmTextView, 2.0f, 0);
}
@Override
public void onNextPressed() {
if (this.nextPressed) {
return;
}
String oldPassword = this.codeField.getText().toString();
if (oldPassword.length() == 0) {
onPasscodeError(false);
return;
}
this.nextPressed = true;
String code = this.codeField.getText().toString();
if (code.length() != 0) {
LoginActivity.this.needShowProgress(0);
TLRPC.TL_auth_recoverPassword req = new TLRPC.TL_auth_recoverPassword();
req.code = code;
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityRecoverView.this.m1730xf75884d1(tLObject, tL_error);
}
}, 10);
return;
}
onPasscodeError(false);
}
public void m1730xf75884d1(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRecoverView.this.m1729xd1c47bd0(response, error);
}
});
}
public void m1729xd1c47bd0(final TLObject response, TLRPC.TL_error error) {
String timeString;
LoginActivity.this.needHideProgress(false);
this.nextPressed = false;
if (response instanceof TLRPC.TL_auth_authorization) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRecoverView.this.m1728xac3072cf(response, dialogInterface, i);
}
});
builder.setMessage(LocaleController.getString("PasswordReset", R.string.PasswordReset));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
Dialog dialog = LoginActivity.this.showDialog(builder.create());
if (dialog != null) {
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
return;
}
return;
}
if (error.text.startsWith("CODE_INVALID")) {
onPasscodeError(true);
return;
}
if (!error.text.startsWith("FLOOD_WAIT")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
return;
}
int time = Utilities.parseInt(error.text).intValue();
if (time < 60) {
timeString = LocaleController.formatPluralString("Seconds", time);
} else {
timeString = LocaleController.formatPluralString("Minutes", time / 60);
}
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString));
}
public void m1728xac3072cf(TLObject response, DialogInterface dialogInterface, int i) {
LoginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) response);
}
@Override
public boolean onBackPressed(boolean force) {
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.m1731xb4422318();
}
}, 100L);
}
public void m1731xb4422318() {
EditTextBoldCursor editTextBoldCursor = this.codeField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.codeField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
}
}
@Override
public void saveStateParams(Bundle bundle) {
String code = this.codeField.getText().toString();
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 code = bundle.getString("recoveryview_code");
if (code != null) {
this.codeField.setText(code);
}
}
}
public class LoginActivityRegisterView extends SlideView implements ImageUpdater.ImageUpdaterDelegate {
private TLRPC.FileLocation avatar;
private AnimatorSet avatarAnimation;
private TLRPC.FileLocation avatarBig;
private AvatarDrawable avatarDrawable;
private AppCompatImageView avatarEditor;
private BackupImageView avatarImage;
private View avatarOverlay;
private RadialProgressView avatarProgressView;
private boolean createAfterUpload;
private Bundle currentParams;
private EditTextBoldCursor firstNameField;
private ImageUpdater imageUpdater;
private EditTextBoldCursor lastNameField;
private boolean nextPressed;
private String phoneCode;
private String phoneHash;
private TextView privacyView;
private String requestPhone;
private TextView textView;
private TLRPC.InputFile uploadedAvatar;
private TextView wrongNumber;
@Override
public void didSelectPhotos(ArrayList arrayList, boolean z, int i) {
ImageUpdater.ImageUpdaterDelegate.CC.$default$didSelectPhotos(this, arrayList, z, i);
}
@Override
public String getInitialSearchString() {
return ImageUpdater.ImageUpdaterDelegate.CC.$default$getInitialSearchString(this);
}
public class LinkSpan extends ClickableSpan {
public LinkSpan() {
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
@Override
public void onClick(View widget) {
LoginActivityRegisterView.this.showTermsOfService(false);
}
}
public void showTermsOfService(boolean needAccept) {
if (LoginActivity.this.currentTermsOfService == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService));
if (needAccept) {
builder.setPositiveButton(LocaleController.getString("Accept", R.string.Accept), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.m1742x9f91e4a7(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.m1745x46592a04(dialogInterface, i);
}
});
} else {
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
}
SpannableStringBuilder text = new SpannableStringBuilder(LoginActivity.this.currentTermsOfService.text);
MessageObject.addEntitiesToText(text, LoginActivity.this.currentTermsOfService.entities, false, 0, false, false, false);
builder.setMessage(text);
LoginActivity.this.showDialog(builder.create());
}
public void m1742x9f91e4a7(DialogInterface dialog, int which) {
LoginActivity.this.currentTermsOfService.popup = false;
onNextPressed();
}
public void m1745x46592a04(DialogInterface dialog, int which) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder1.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService));
builder1.setMessage(LocaleController.getString("TosDecline", R.string.TosDecline));
builder1.setPositiveButton(LocaleController.getString("SignUp", R.string.SignUp), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.m1743x2c7efbc6(dialogInterface, i);
}
});
builder1.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.m1744xb96c12e5(dialogInterface, i);
}
});
LoginActivity.this.showDialog(builder1.create());
}
public void m1743x2c7efbc6(DialogInterface dialog1, int which1) {
LoginActivity.this.currentTermsOfService.popup = false;
onNextPressed();
}
public void m1744xb96c12e5(DialogInterface dialog12, int which12) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
public LoginActivityRegisterView(Context context) {
super(context);
this.nextPressed = false;
setOrientation(1);
ImageUpdater imageUpdater = new ImageUpdater();
this.imageUpdater = imageUpdater;
imageUpdater.setSearchAvailable(false);
this.imageUpdater.setUploadAfterSelect(false);
this.imageUpdater.parentFragment = LoginActivity.this;
this.imageUpdater.delegate = this;
TextView textView = new TextView(context);
this.textView = textView;
textView.setText(LocaleController.getString("RegisterText2", R.string.RegisterText2));
this.textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.textView.setGravity(LocaleController.isRTL ? 5 : 3);
this.textView.setTextSize(1, 14.0f);
addView(this.textView, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 0, 0, 0));
FrameLayout editTextContainer = new FrameLayout(context);
addView(editTextContainer, LayoutHelper.createLinear(-1, -2, 0.0f, 21.0f, 0.0f, 0.0f));
this.avatarDrawable = new AvatarDrawable();
BackupImageView backupImageView = new BackupImageView(context) {
@Override
public void invalidate() {
if (LoginActivityRegisterView.this.avatarOverlay != null) {
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
super.invalidate();
}
@Override
public void invalidate(int l, int t, int r, int b) {
if (LoginActivityRegisterView.this.avatarOverlay != null) {
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
super.invalidate(l, t, r, b);
}
};
this.avatarImage = backupImageView;
backupImageView.setRoundRadius(AndroidUtilities.dp(32.0f));
this.avatarDrawable.setInfo(5, null, null);
this.avatarImage.setImageDrawable(this.avatarDrawable);
editTextContainer.addView(this.avatarImage, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
final Paint paint = new Paint(1);
paint.setColor(1426063360);
View view = new View(context) {
@Override
protected void onDraw(Canvas canvas) {
if (LoginActivityRegisterView.this.avatarImage != null && LoginActivityRegisterView.this.avatarProgressView.getVisibility() == 0) {
paint.setAlpha((int) (LoginActivityRegisterView.this.avatarImage.getImageReceiver().getCurrentAlpha() * 85.0f * LoginActivityRegisterView.this.avatarProgressView.getAlpha()));
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, AndroidUtilities.dp(32.0f), paint);
}
}
};
this.avatarOverlay = view;
editTextContainer.addView(view, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
this.avatarOverlay.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
LoginActivity.LoginActivityRegisterView.this.m1734x7d090530(view2);
}
});
AppCompatImageView appCompatImageView = new AppCompatImageView(context) {
@Override
public void invalidate(int l, int t, int r, int b) {
super.invalidate(l, t, r, b);
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
@Override
public void invalidate() {
super.invalidate();
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
};
this.avatarEditor = appCompatImageView;
appCompatImageView.setScaleType(ImageView.ScaleType.CENTER);
this.avatarEditor.setImageResource(R.drawable.actions_setphoto);
this.avatarEditor.setEnabled(false);
this.avatarEditor.setClickable(false);
this.avatarEditor.setPadding(AndroidUtilities.dp(2.0f), 0, 0, 0);
editTextContainer.addView(this.avatarEditor, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
RadialProgressView radialProgressView = new RadialProgressView(context) {
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
LoginActivityRegisterView.this.avatarOverlay.invalidate();
}
};
this.avatarProgressView = radialProgressView;
radialProgressView.setSize(AndroidUtilities.dp(30.0f));
this.avatarProgressView.setProgressColor(-1);
editTextContainer.addView(this.avatarProgressView, LayoutHelper.createFrame(64.0f, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
showAvatarProgress(false, false);
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.firstNameField = editTextBoldCursor;
editTextBoldCursor.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.firstNameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.firstNameField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.firstNameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.firstNameField.setCursorSize(AndroidUtilities.dp(20.0f));
this.firstNameField.setCursorWidth(1.5f);
this.firstNameField.setHint(LocaleController.getString("Name2", R.string.Name2));
this.firstNameField.setImeOptions(268435461);
this.firstNameField.setTextSize(1, 17.0f);
this.firstNameField.setMaxLines(1);
this.firstNameField.setInputType(8192);
this.firstNameField.setFilters(new InputFilter[]{new InputFilter.LengthFilter(64)});
editTextContainer.addView(this.firstNameField, LayoutHelper.createFrame(-1.0f, 36.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 0.0f : 85.0f, 0.0f, LocaleController.isRTL ? 85.0f : 0.0f, 0.0f));
this.firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
return LoginActivity.LoginActivityRegisterView.this.m1735x9f61c4f(textView2, i, keyEvent);
}
});
EditTextBoldCursor editTextBoldCursor2 = new EditTextBoldCursor(context);
this.lastNameField = editTextBoldCursor2;
editTextBoldCursor2.setHint(LocaleController.getString("Nickname", R.string.Nickname));
this.lastNameField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.lastNameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.lastNameField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
this.lastNameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.lastNameField.setCursorSize(AndroidUtilities.dp(20.0f));
this.lastNameField.setCursorWidth(1.5f);
this.lastNameField.setImeOptions(268435462);
this.lastNameField.setTextSize(1, 17.0f);
this.lastNameField.setMaxLines(1);
this.lastNameField.setInputType(8192);
this.lastNameField.setFilters(new InputFilter[]{new InputFilter.LengthFilter(64)});
editTextContainer.addView(this.lastNameField, LayoutHelper.createFrame(-1.0f, 36.0f, (LocaleController.isRTL ? 5 : 3) | 48, LocaleController.isRTL ? 0.0f : 85.0f, 51.0f, LocaleController.isRTL ? 85.0f : 0.0f, 0.0f));
this.lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
return LoginActivity.LoginActivityRegisterView.this.m1736x96e3336e(textView2, i, keyEvent);
}
});
TextView textView2 = new TextView(context);
this.wrongNumber = textView2;
textView2.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
this.wrongNumber.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
this.wrongNumber.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
this.wrongNumber.setTextSize(1, 14.0f);
this.wrongNumber.setLineSpacing(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.m1737x23d04a8d(view2);
}
});
TextView textView3 = new TextView(context);
this.privacyView = textView3;
textView3.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
this.privacyView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
this.privacyView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkText));
this.privacyView.setTextSize(1, 14.0f);
this.privacyView.setGravity(81);
this.privacyView.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
addView(this.privacyView, LayoutHelper.createLinear(-2, -1, 81, 0, 28, 0, 16));
String str = LocaleController.getString("TermsOfServiceLogin", R.string.TermsOfServiceLogin);
SpannableStringBuilder text = new SpannableStringBuilder(str);
int index1 = str.indexOf(42);
int index2 = str.lastIndexOf(42);
if (index1 != -1 && index2 != -1 && index1 != index2) {
text.replace(index2, index2 + 1, (CharSequence) "");
text.replace(index1, index1 + 1, (CharSequence) "");
text.setSpan(new LinkSpan(), index1, index2 - 1, 33);
}
this.privacyView.setText(text);
}
public void m1734x7d090530(View view) {
this.imageUpdater.openMenu(this.avatar != null, new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.m1733xf01bee11();
}
});
}
public void m1733xf01bee11() {
this.avatar = null;
this.avatarBig = null;
this.uploadedAvatar = null;
showAvatarProgress(false, true);
this.avatarImage.setImage((ImageLocation) null, (String) null, this.avatarDrawable, (Object) null);
this.avatarEditor.setImageResource(R.drawable.actions_setphoto);
}
public boolean m1735x9f61c4f(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
this.lastNameField.requestFocus();
return true;
}
return false;
}
public boolean m1736x96e3336e(TextView textView, int i, KeyEvent keyEvent) {
if (i == 6 || i == 5) {
onNextPressed();
return true;
}
return false;
}
public void m1737x23d04a8d(View view) {
if (LoginActivity.this.doneProgressView.getTag() != null) {
return;
}
onBackPressed(false);
}
@Override
public void didUploadPhoto(TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.m1732x5757a040(smallSize, bigSize);
}
});
}
public void m1732x5757a040(TLRPC.PhotoSize smallSize, TLRPC.PhotoSize bigSize) {
this.avatar = smallSize.location;
this.avatarBig = bigSize.location;
this.avatarImage.setImage(ImageLocation.getForLocal(this.avatar), "50_50", this.avatarDrawable, (Object) null);
}
private void showAvatarProgress(final boolean show, boolean animated) {
if (this.avatarEditor == null) {
return;
}
AnimatorSet animatorSet = this.avatarAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.avatarAnimation = null;
}
if (animated) {
this.avatarAnimation = new AnimatorSet();
if (show) {
this.avatarProgressView.setVisibility(0);
this.avatarAnimation.playTogether(ObjectAnimator.ofFloat(this.avatarEditor, (Property<AppCompatImageView, 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<AppCompatImageView, 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 animation) {
if (LoginActivityRegisterView.this.avatarAnimation == null || LoginActivityRegisterView.this.avatarEditor == null) {
return;
}
if (show) {
LoginActivityRegisterView.this.avatarEditor.setVisibility(4);
} else {
LoginActivityRegisterView.this.avatarProgressView.setVisibility(4);
}
LoginActivityRegisterView.this.avatarAnimation = null;
}
@Override
public void onAnimationCancel(Animator animation) {
LoginActivityRegisterView.this.avatarAnimation = null;
}
});
this.avatarAnimation.start();
return;
}
if (show) {
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 force) {
if (!force) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("AreYouSureRegistration", R.string.AreYouSureRegistration));
builder.setNegativeButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.LoginActivityRegisterView.this.m1738x3e5ae120(dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("Continue", R.string.Continue), null);
LoginActivity.this.showDialog(builder.create());
return false;
}
LoginActivity.this.needHideProgress(true);
this.nextPressed = false;
this.currentParams = null;
return true;
}
public void m1738x3e5ae120(DialogInterface dialogInterface, int i) {
onBackPressed(true);
LoginActivity.this.setPage(0, true, null, true);
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourName", R.string.YourName);
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public void onShow() {
super.onShow();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.m1741xb8a9e279();
}
}, 100L);
}
public void m1741xb8a9e279() {
EditTextBoldCursor editTextBoldCursor = this.firstNameField;
if (editTextBoldCursor != null) {
editTextBoldCursor.requestFocus();
EditTextBoldCursor editTextBoldCursor2 = this.firstNameField;
editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
}
}
@Override
public void setParams(Bundle params, boolean restore) {
if (params == null) {
return;
}
this.firstNameField.setText("");
this.lastNameField.setText("");
this.requestPhone = params.getString("phoneFormated");
this.phoneHash = params.getString("phoneHash");
this.phoneCode = params.getString("code");
this.currentParams = params;
}
@Override
public void onNextPressed() {
if (!this.nextPressed) {
if (LoginActivity.this.currentTermsOfService != null && LoginActivity.this.currentTermsOfService.popup) {
showTermsOfService(true);
return;
}
this.nextPressed = true;
TLRPC.TL_auth_signUp req = new TLRPC.TL_auth_signUp();
req.phone_code_hash = this.phoneHash;
req.phone_number = this.requestPhone;
req.first_name = this.firstNameField.getText().toString();
req.last_name = this.lastNameField.getText().toString();
LoginActivity.this.needShowProgress(0);
ConnectionsManager.getInstance(LoginActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LoginActivity.LoginActivityRegisterView.this.m1740xba3eb4f1(tLObject, tL_error);
}
}, 10);
}
}
public void m1740xba3eb4f1(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LoginActivity.LoginActivityRegisterView.this.m1739x2d519dd2(response, error);
}
});
}
public void m1739x2d519dd2(TLObject response, TLRPC.TL_error error) {
this.nextPressed = false;
LoginActivity.this.needHideProgress(false);
if (response instanceof TLRPC.TL_auth_authorization) {
LoginActivity.this.onAuthSuccess((TLRPC.TL_auth_authorization) response);
if (this.avatarBig != null) {
MessagesController.getInstance(LoginActivity.this.currentAccount).uploadAndApplyUserAvatar(this.avatarBig);
return;
}
return;
}
if (TextUtils.isEmpty(this.firstNameField.getText().toString().trim())) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("EmptyNameTips", R.string.EmptyNameTips));
return;
}
if (error.text.contains("PHONE_NUMBER_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
return;
}
if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
return;
}
if (error.text.contains("PHONE_CODE_EXPIRED")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("CodeExpired", R.string.CodeExpired));
return;
}
if (error.text.contains("FIRSTNAME_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidName", R.string.InvalidName));
return;
}
if (error.text.contains("LASTNAME_INVALID")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidNickname", R.string.InvalidNickname));
} else if (error.text.contains("FIRSTNAME_LASTNAME_EMPTY")) {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("EmptyNameTips", R.string.EmptyNameTips));
} else {
LoginActivity.this.needShowAlert(LocaleController.getString("AppName", R.string.AppName), error.text);
}
}
@Override
public void saveStateParams(Bundle bundle) {
String first = this.firstNameField.getText().toString();
if (first.length() != 0) {
bundle.putString("registerview_first", first);
}
String last = this.lastNameField.getText().toString();
if (last.length() != 0) {
bundle.putString("registerview_last", last);
}
if (LoginActivity.this.currentTermsOfService != null) {
SerializedData data = new SerializedData(LoginActivity.this.currentTermsOfService.getObjectSize());
LoginActivity.this.currentTermsOfService.serializeToStream(data);
String str = Base64.encodeToString(data.toByteArray(), 0);
bundle.putString("terms", str);
data.cleanup();
}
Bundle bundle2 = this.currentParams;
if (bundle2 != null) {
bundle.putBundle("registerview_params", bundle2);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
byte[] arr;
Bundle bundle2 = bundle.getBundle("registerview_params");
this.currentParams = bundle2;
if (bundle2 != null) {
setParams(bundle2, true);
}
try {
String terms = bundle.getString("terms");
if (terms != null && (arr = Base64.decode(terms, 0)) != null) {
SerializedData data = new SerializedData(arr);
LoginActivity.this.currentTermsOfService = TLRPC.TL_help_termsOfService.TLdeserialize(data, data.readInt32(false), false);
data.cleanup();
}
} catch (Exception e) {
FileLog.e(e);
}
String first = bundle.getString("registerview_first");
if (first != null) {
this.firstNameField.setText(first);
}
String last = bundle.getString("registerview_last");
if (last != null) {
this.lastNameField.setText(last);
}
}
}
@Override
public ThemeDescription[] getThemeDescriptions() {
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a < slideViewArr.length) {
if (slideViewArr[a] != null) {
a++;
} else {
return new ThemeDescription[0];
}
} else {
PhoneView phoneView = (PhoneView) slideViewArr[0];
LoginActivitySmsView smsView1 = (LoginActivitySmsView) slideViewArr[1];
LoginActivitySmsView smsView2 = (LoginActivitySmsView) slideViewArr[2];
LoginActivitySmsView smsView3 = (LoginActivitySmsView) slideViewArr[3];
LoginActivitySmsView smsView4 = (LoginActivitySmsView) slideViewArr[4];
LoginActivityRegisterView registerView = (LoginActivityRegisterView) slideViewArr[5];
LoginActivityPasswordView passwordView = (LoginActivityPasswordView) slideViewArr[6];
LoginActivityRecoverView recoverView = (LoginActivityRecoverView) slideViewArr[7];
LoginActivityResetWaitView waitView = (LoginActivityResetWaitView) slideViewArr[8];
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(phoneView.countryButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(phoneView.view, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhiteGrayLine));
arrayList.add(new ThemeDescription(phoneView.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(phoneView.textView2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(passwordView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(passwordView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(passwordView.codeField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(passwordView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(passwordView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(passwordView.cancelButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(passwordView.resetAccountButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteRedText6));
arrayList.add(new ThemeDescription(passwordView.resetAccountText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(registerView.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(registerView.firstNameField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(registerView.firstNameField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(registerView.firstNameField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(registerView.firstNameField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(registerView.lastNameField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(registerView.lastNameField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(registerView.lastNameField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(registerView.lastNameField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(registerView.wrongNumber, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(registerView.privacyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(registerView.privacyView, ThemeDescription.FLAG_LINKCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteLinkText));
arrayList.add(new ThemeDescription(recoverView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(recoverView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(recoverView.codeField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(recoverView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(recoverView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(recoverView.cancelButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(waitView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(waitView.resetAccountText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(waitView.resetAccountTime, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(waitView.resetAccountButton, ThemeDescription.FLAG_CHECKTAG | ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(waitView.resetAccountButton, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteRedText6));
arrayList.add(new ThemeDescription(smsView1.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView1.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
if (smsView1.codeField != null) {
for (int a2 = 0; a2 < smsView1.codeField.length; a2++) {
arrayList.add(new ThemeDescription(smsView1.codeField[a2], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView1.codeField[a2], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
}
}
arrayList.add(new ThemeDescription(smsView1.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView1.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(smsView1.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
arrayList.add(new ThemeDescription(smsView1.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
arrayList.add(new ThemeDescription(smsView1.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView1.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
arrayList.add(new ThemeDescription(smsView2.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView2.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
if (smsView2.codeField != null) {
for (int a3 = 0; a3 < smsView2.codeField.length; a3++) {
arrayList.add(new ThemeDescription(smsView2.codeField[a3], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView2.codeField[a3], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
}
}
arrayList.add(new ThemeDescription(smsView2.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView2.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(smsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
arrayList.add(new ThemeDescription(smsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
arrayList.add(new ThemeDescription(smsView2.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView2.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
arrayList.add(new ThemeDescription(smsView3.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView3.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
if (smsView3.codeField != null) {
for (int a4 = 0; a4 < smsView3.codeField.length; a4++) {
arrayList.add(new ThemeDescription(smsView3.codeField[a4], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView3.codeField[a4], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
}
}
arrayList.add(new ThemeDescription(smsView3.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView3.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(smsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
arrayList.add(new ThemeDescription(smsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
arrayList.add(new ThemeDescription(smsView3.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView3.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
arrayList.add(new ThemeDescription(smsView4.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView4.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
if (smsView4.codeField != null) {
for (int a5 = 0; a5 < smsView4.codeField.length; a5++) {
arrayList.add(new ThemeDescription(smsView4.codeField[a5], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView4.codeField[a5], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
}
}
arrayList.add(new ThemeDescription(smsView4.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6));
arrayList.add(new ThemeDescription(smsView4.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(smsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner));
arrayList.add(new ThemeDescription(smsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter));
arrayList.add(new ThemeDescription(smsView4.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView4.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground));
return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]);
}
}
}
}