♬♬ v1.0.0版本的 MD5 值为:04cc17073568ba22bfb83ea139fbe521
以下内容为反编译后的 ChangePhoneActivity.java 源代码,内容仅作参考
package im.wgogsutsuz.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.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.blankj.utilcode.constant.TimeConstants;
import im.wgogsutsuz.messenger.AndroidUtilities;
import im.wgogsutsuz.messenger.ApplicationLoader;
import im.wgogsutsuz.messenger.BuildVars;
import im.wgogsutsuz.messenger.FileLog;
import im.wgogsutsuz.messenger.LocaleController;
import im.wgogsutsuz.messenger.MessagesController;
import im.wgogsutsuz.messenger.MessagesStorage;
import im.wgogsutsuz.messenger.NotificationCenter;
import im.wgogsutsuz.messenger.R;
import im.wgogsutsuz.messenger.UserConfig;
import im.wgogsutsuz.phoneformat.PhoneFormat;
import im.wgogsutsuz.tgnet.ConnectionsManager;
import im.wgogsutsuz.tgnet.RequestDelegate;
import im.wgogsutsuz.tgnet.TLObject;
import im.wgogsutsuz.tgnet.TLRPC;
import im.wgogsutsuz.ui.ChangePhoneActivity;
import im.wgogsutsuz.ui.CountrySelectActivity;
import im.wgogsutsuz.ui.actionbar.ActionBar;
import im.wgogsutsuz.ui.actionbar.ActionBarMenu;
import im.wgogsutsuz.ui.actionbar.AlertDialog;
import im.wgogsutsuz.ui.actionbar.BaseFragment;
import im.wgogsutsuz.ui.actionbar.Theme;
import im.wgogsutsuz.ui.actionbar.ThemeDescription;
import im.wgogsutsuz.ui.components.AlertsCreator;
import im.wgogsutsuz.ui.components.EditTextBoldCursor;
import im.wgogsutsuz.ui.components.HintEditText;
import im.wgogsutsuz.ui.components.LayoutHelper;
import im.wgogsutsuz.ui.components.SlideView;
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.Timer;
import java.util.TimerTask;
import kotlin.text.Typography;
import obfuse.NPStringFog;
@Deprecated
public class ChangePhoneActivity extends BaseFragment {
private static final int done_button = 1;
private View doneButton;
private Dialog permissionsDialog;
private AlertDialog progressDialog;
private int scrollHeight;
private int currentViewNum = 0;
private SlideView[] views = new SlideView[5];
private ArrayList<String> permissionsItems = new ArrayList<>();
private boolean checkPermissions = true;
private 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(NPStringFog.decode("5D5E56585F6E41435E5643544242785F5F5443")));
this.paint2.setColor(Theme.getColor(NPStringFog.decode("5D5E56585F6E41435E56435442427E44455443")));
}
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);
}
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a >= slideViewArr.length) {
break;
}
if (slideViewArr[a] != null) {
slideViewArr[a].onDestroyActivity();
}
a++;
}
AlertDialog alertDialog = this.progressDialog;
if (alertDialog != null) {
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
this.progressDialog = null;
}
AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid);
}
@Override
public View createView(Context context) {
this.actionBar.setTitle(LocaleController.getString(NPStringFog.decode("7041417F505C54"), R.string.AppName));
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == 1) {
ChangePhoneActivity.this.views[ChangePhoneActivity.this.currentViewNum].onNextPressed();
} else if (id == -1) {
ChangePhoneActivity.this.finishFragment();
}
}
});
ActionBarMenu menu = this.actionBar.createMenu();
this.doneButton = menu.addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56.0f));
ScrollView scrollView = new ScrollView(context) {
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
if (ChangePhoneActivity.this.currentViewNum == 1 || ChangePhoneActivity.this.currentViewNum == 2 || ChangePhoneActivity.this.currentViewNum == 4) {
rectangle.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ChangePhoneActivity.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);
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a >= slideViewArr.length) {
this.actionBar.setTitle(this.views[0].getHeaderName());
return this.fragmentView;
}
slideViewArr[a].setVisibility(a == 0 ? 0 : 8);
frameLayout.addView(this.views[a], LayoutHelper.createFrame(-1.0f, a == 0 ? -2.0f : -1.0f, 51, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 30.0f, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 0.0f));
a++;
}
}
@Override
public void onResume() {
super.onResume();
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
}
@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();
}
}
}
@Override
public void onDialogDismiss(Dialog dialog) {
if (Build.VERSION.SDK_INT >= 23 && dialog == this.permissionsDialog && !this.permissionsItems.isEmpty()) {
getParentActivity().requestPermissions((String[]) this.permissionsItems.toArray(new String[0]), 6);
}
}
@Override
public boolean onBackPressed() {
if (progressDialogIsShown()) {
needHideProgress();
}
int i = this.currentViewNum;
if (i == 0) {
int a = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (a >= slideViewArr.length) {
return true;
}
if (slideViewArr[a] != null) {
slideViewArr[a].onDestroyActivity();
}
a++;
}
} else {
if (this.views[i].onBackPressed(false)) {
setPage(0, true, null, true);
}
return false;
}
}
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
if (isOpen) {
this.views[this.currentViewNum].onShow();
}
}
public void needShowProgress() {
if (getParentActivity() == null || getParentActivity().isFinishing() || this.progressDialog != null) {
return;
}
AlertDialog alertDialog = new AlertDialog(getParentActivity(), 3) {
@Override
public void onBackPressed() {
ChangePhoneActivity.this.progressDialog.cancel();
}
};
this.progressDialog = alertDialog;
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChangePhoneActivity.this.lambda$needShowProgress$0$ChangePhoneActivity(dialogInterface);
}
});
this.progressDialog.setCancelable(true);
this.progressDialog.setCanceledOnTouchOutside(false);
this.progressDialog.show();
}
public void lambda$needShowProgress$0$ChangePhoneActivity(DialogInterface dialog) {
int i;
SlideView[] slideViewArr = this.views;
if (slideViewArr == null || (i = this.currentViewNum) < 0 || i >= slideViewArr.length || !(slideViewArr[i] instanceof PhoneView)) {
return;
}
((PhoneView) slideViewArr[i]).cancelNetRequest();
}
public void needHideProgress() {
AlertDialog alertDialog = this.progressDialog;
if (alertDialog == null) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
this.progressDialog = null;
}
private boolean progressDialogIsShown() {
AlertDialog alertDialog = this.progressDialog;
return alertDialog != null && alertDialog.isShowing();
}
public void setPage(int page, boolean animated, Bundle params, boolean back) {
if (page == 3) {
this.doneButton.setVisibility(8);
} else {
if (page == 0) {
this.checkPermissions = true;
}
this.doneButton.setVisibility(0);
}
SlideView[] slideViewArr = this.views;
final SlideView outView = slideViewArr[this.currentViewNum];
final SlideView newView = slideViewArr[page];
this.currentViewNum = page;
newView.setParams(params, false);
this.actionBar.setTitle(newView.getHeaderName());
newView.onShow();
int i = AndroidUtilities.displaySize.x;
if (back) {
i = -i;
}
newView.setX(i);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.setDuration(300L);
Animator[] animatorArr = new Animator[2];
float[] fArr = new float[1];
int i2 = AndroidUtilities.displaySize.x;
if (!back) {
i2 = -i2;
}
fArr[0] = i2;
animatorArr[0] = ObjectAnimator.ofFloat(outView, "translationX", fArr);
animatorArr[1] = ObjectAnimator.ofFloat(newView, "translationX", 0.0f);
animatorSet.playTogether(animatorArr);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
newView.setVisibility(0);
}
@Override
public void onAnimationEnd(Animator animation) {
outView.setVisibility(8);
outView.setX(0.0f);
}
});
animatorSet.start();
}
public void fillNextCodeParams(Bundle params, TLRPC.TL_auth_sentCode res) {
params.putString(NPStringFog.decode("41595E5F5479504259"), res.phone_code_hash);
boolean z = res.next_type instanceof TLRPC.TL_auth_codeTypeCall;
String decode = NPStringFog.decode("5F54494565484154");
if (z) {
params.putInt(decode, 4);
} else if (res.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) {
params.putInt(decode, 3);
} else if (res.next_type instanceof TLRPC.TL_auth_codeTypeSms) {
params.putInt(decode, 2);
}
boolean z2 = res.type instanceof TLRPC.TL_auth_sentCodeTypeApp;
String decode2 = NPStringFog.decode("5D545F564559");
if (z2) {
params.putInt("type", 1);
params.putInt(decode2, 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(decode2, res.type.length);
setPage(4, true, params, false);
} else {
if (res.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) {
params.putInt("type", 3);
params.putString(NPStringFog.decode("4150454554435F"), res.type.pattern);
setPage(3, true, params, false);
return;
}
if (res.type instanceof TLRPC.TL_auth_sentCodeTypeSms) {
params.putInt("type", 2);
params.putInt(decode2, res.type.length);
setPage(2, true, params, false);
}
}
}
public class PhoneView extends SlideView implements AdapterView.OnItemSelectedListener {
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 int netRequestToken;
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);
String countryName;
this.countryState = 0;
this.netRequestToken = -1;
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) {
ChangePhoneActivity.PhoneView.this.lambda$new$2$ChangePhoneActivity$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(NPStringFog.decode("1A"));
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.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField.setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField.setCursorWidth(1.5f);
this.codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
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(NPStringFog.decode("72595E5E4254725E445F454348"), R.string.ChooseCountry));
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 1;
} else {
boolean ok = false;
String textToSet = null;
if (text.length() > 4) {
PhoneView.this.ignoreOnTextChange = true;
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) {
PhoneView.this.ignoreOnTextChange = true;
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);
String decode = NPStringFog.decode("66435E5F56725E445F454348");
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(decode, R.string.WrongCountry));
PhoneView.this.phoneField.setHintText((String) null);
PhoneView.this.countryState = 2;
}
} else {
PhoneView.this.countryButton.setText(LocaleController.getString(decode, 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 ChangePhoneActivity.PhoneView.this.lambda$new$3$ChangePhoneActivity$PhoneView(textView3, i, keyEvent);
}
});
HintEditText hintEditText = new HintEditText(context);
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 phoneChars = NPStringFog.decode("01000302050407060908");
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 (phoneChars.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++;
}
}
}
}
PhoneView.this.phoneField.setText(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 ChangePhoneActivity.PhoneView.this.lambda$new$4$ChangePhoneActivity$PhoneView(textView3, i, keyEvent);
}
});
this.phoneField.setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view2, int i, KeyEvent keyEvent) {
return ChangePhoneActivity.PhoneView.this.lambda$new$5$ChangePhoneActivity$PhoneView(view2, i, keyEvent);
}
});
TextView textView3 = new TextView(context);
this.textView2 = textView3;
textView3.setText(LocaleController.getString(NPStringFog.decode("7259505F565461595E5F5479545D41"), R.string.ChangePhoneHelp));
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));
HashMap<String, String> languageMap = new HashMap<>();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().getAssets().open(NPStringFog.decode("525E445F45435854421F454945"))));
while (true) {
String line = reader.readLine();
if (line == null) {
break;
}
String[] args = line.split(NPStringFog.decode("0A"));
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, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE);
String country = null;
try {
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService(NPStringFog.decode("41595E5F54"));
if (telephonyManager != null) {
country = telephonyManager.getSimCountryIso().toUpperCase();
}
} catch (Exception e2) {
FileLog.e(e2);
}
if (country != null && (countryName = languageMap.get(country)) != null) {
int index = this.countriesArray.indexOf(countryName);
if (index != -1) {
this.codeField.setText(this.countriesMap.get(countryName));
this.countryState = 0;
}
}
if (this.codeField.length() == 0) {
this.countryButton.setText(LocaleController.getString(NPStringFog.decode("72595E5E4254725E445F454348"), R.string.ChooseCountry));
this.phoneField.setHintText((String) null);
this.countryState = 1;
}
if (this.codeField.length() != 0) {
AndroidUtilities.showKeyboard(this.phoneField);
this.phoneField.requestFocus();
HintEditText hintEditText2 = this.phoneField;
hintEditText2.setSelection(hintEditText2.length());
return;
}
AndroidUtilities.showKeyboard(this.codeField);
this.codeField.requestFocus();
}
public void lambda$new$2$ChangePhoneActivity$PhoneView(View view) {
CountrySelectActivity fragment = new CountrySelectActivity(true);
fragment.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public final void didSelectCountry(CountrySelectActivity.Country country) {
ChangePhoneActivity.PhoneView.this.lambda$null$1$ChangePhoneActivity$PhoneView(country);
}
});
ChangePhoneActivity.this.presentFragment(fragment);
}
public void lambda$null$1$ChangePhoneActivity$PhoneView(CountrySelectActivity.Country country) {
selectCountry(null, country);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChangePhoneActivity.PhoneView.this.lambda$null$0$ChangePhoneActivity$PhoneView();
}
}, 300L);
this.phoneField.requestFocus();
HintEditText hintEditText = this.phoneField;
hintEditText.setSelection(hintEditText.length());
}
public void lambda$null$0$ChangePhoneActivity$PhoneView() {
AndroidUtilities.showKeyboard(this.phoneField);
}
public boolean lambda$new$3$ChangePhoneActivity$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 lambda$new$4$ChangePhoneActivity$PhoneView(TextView textView, int i, KeyEvent keyEvent) {
if (i == 5) {
onNextPressed();
return true;
}
return false;
}
public boolean lambda$new$5$ChangePhoneActivity$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 + NPStringFog.decode(""));
if (country.phoneFormat != null) {
this.phoneField.setHintText(country.phoneFormat != null ? country.phoneFormat.replace('X', Typography.ndash) : null);
}
this.countryState = 0;
this.ignoreOnTextChange = 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 onCancelPressed() {
this.nextPressed = false;
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
@Override
public void onNextPressed() {
String decode = NPStringFog.decode("5441595E5F54");
if (ChangePhoneActivity.this.getParentActivity() == null || this.nextPressed) {
return;
}
if (this.countryState == 1) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString(NPStringFog.decode("72595E5E4254725E445F454348"), R.string.ChooseCountry));
return;
}
int length = this.codeField.length();
String decode2 = NPStringFog.decode("785F47505D585561595E5F547F445C535443");
if (length == 0) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString(decode2, R.string.InvalidPhoneNumber));
return;
}
StringBuilder sb = new StringBuilder();
sb.append((Object) this.phoneField.getText());
String decode3 = NPStringFog.decode("");
sb.append(decode3);
if (TextUtils.isEmpty(sb.toString())) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString(decode2, R.string.InvalidPhoneNumber));
return;
}
String phone = PhoneFormat.stripExceptNumbers(decode3 + ((Object) this.codeField.getText()) + ((Object) this.phoneField.getText()));
if (ChangePhoneActivity.this.getUserConfig() != null && ChangePhoneActivity.this.getUserConfig().getClientPhone() != null && ChangePhoneActivity.this.getUserConfig().getClientPhone().equals(phone)) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString(NPStringFog.decode("72505F5F5E457C5045525965595472444343545F4561595E5F547F445C535443"), R.string.CannotMatchTheCurrentPhoneNumber));
return;
}
final TLRPC.TL_account_sendChangePhoneCode req = new TLRPC.TL_account_sendChangePhoneCode();
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(NPStringFog.decode("5C50585F525E5F575856"), 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();
StringBuilder sb2 = new StringBuilder();
String decode4 = NPStringFog.decode("1A");
sb2.append(decode4);
sb2.append((Object) this.codeField.getText());
String decode5 = NPStringFog.decode("11");
sb2.append(decode5);
sb2.append((Object) this.phoneField.getText());
params.putString(NPStringFog.decode("41595E5F54"), sb2.toString());
try {
params.putString(decode, decode4 + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + decode5 + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString()));
} catch (Exception e) {
FileLog.e(e);
params.putString(decode, decode4 + phone);
}
params.putString(NPStringFog.decode("41595E5F54775E435C50455455"), phone);
StringBuilder sb3 = new StringBuilder();
sb3.append(PhoneFormat.stripExceptNumbers(decode3 + ((Object) this.codeField.getText())));
sb3.append(decode5);
sb3.append(PhoneFormat.stripExceptNumbers(decode3 + ((Object) this.phoneField.getText())));
params.putString(NPStringFog.decode("41595E5F54775E435C50455455795042735D505F5A"), sb3.toString());
this.nextPressed = true;
ChangePhoneActivity.this.needShowProgress();
this.netRequestToken = ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChangePhoneActivity.PhoneView.this.lambda$onNextPressed$7$ChangePhoneActivity$PhoneView(params, req, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$7$ChangePhoneActivity$PhoneView(final Bundle params, final TLRPC.TL_account_sendChangePhoneCode req, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChangePhoneActivity.PhoneView.this.lambda$null$6$ChangePhoneActivity$PhoneView(error, params, response, req);
}
});
}
public void lambda$null$6$ChangePhoneActivity$PhoneView(TLRPC.TL_error error, Bundle params, TLObject response, TLRPC.TL_account_sendChangePhoneCode req) {
this.nextPressed = false;
if (error == null) {
ChangePhoneActivity.this.fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response);
} else {
AlertsCreator.processError(ChangePhoneActivity.this.currentAccount, error, ChangePhoneActivity.this, req, params.getString(NPStringFog.decode("41595E5F54")));
}
ChangePhoneActivity.this.needHideProgress();
}
@Override
public void onShow() {
super.onShow();
if (this.phoneField != null) {
if (this.codeField.length() != 0) {
AndroidUtilities.showKeyboard(this.phoneField);
this.phoneField.requestFocus();
HintEditText hintEditText = this.phoneField;
hintEditText.setSelection(hintEditText.length());
return;
}
AndroidUtilities.showKeyboard(this.codeField);
this.codeField.requestFocus();
}
}
@Override
public String getHeaderName() {
return LocaleController.getString(NPStringFog.decode("7259505F565461595E5F547F54467F445C535443"), R.string.ChangePhoneNewNumber);
}
@Override
public boolean onBackPressed(boolean force) {
if (force && cancelNetRequest()) {
return true;
}
return super.onBackPressed(force);
}
public boolean cancelNetRequest() {
if (this.netRequestToken != -1 && ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount) != null) {
ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).cancelRequest(this.netRequestToken, true);
return true;
}
return false;
}
}
public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
private ImageView blackImageView;
private ImageView blueImageView;
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 double lastCodeTime;
private double lastCurrentTime;
private String lastError;
private int length;
private boolean nextPressed;
private int nextType;
private int openTime;
private String pattern;
private String phone;
private String phoneHash;
private TextView problemText;
private ProgressView progressView;
private String requestHasBlankPhone;
private String requestPhone;
private int time;
private TextView timeText;
private Timer timeTimer;
private int timeout;
private final Object timerSync;
private TextView titleTextView;
private boolean waitingForEvent;
public LoginActivitySmsView(Context context, int type) {
super(context);
this.timerSync = new Object();
this.time = TimeConstants.MIN;
this.codeTime = 15000;
this.lastError = NPStringFog.decode("");
this.pattern = NPStringFog.decode("1B");
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(NPStringFog.decode("575E5F45421E435C545558445C1F454557")));
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));
int i = this.currentType;
String decode = NPStringFog.decode("52595045426E505245585E5F7350525A56435E445F55");
if (i == 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(decode), 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(NPStringFog.decode("62545F45704141725E55546558455D54"), 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(decode), 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(NPStringFog.decode("62545F45625C42725E55546558455D54"), 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);
}
TextView textView3 = new TextView(context) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.timeText = textView3;
textView3.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));
}
TextView textView4 = new TextView(context) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
};
this.problemText = textView4;
textView4.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(NPStringFog.decode("7558557F5E45765445655954725E5554625C42"), R.string.DidNotGetTheCodeSms));
} else {
this.problemText.setText(LocaleController.getString(NPStringFog.decode("7558557F5E45765445655954725E5554"), R.string.DidNotGetTheCode));
}
addView(this.problemText, LayoutHelper.createLinear(-2, -2, 49));
this.problemText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$new$0$ChangePhoneActivity$LoginActivitySmsView(view);
}
});
}
public void lambda$new$0$ChangePhoneActivity$LoginActivitySmsView(View v) {
if (this.nextPressed) {
return;
}
boolean email = (this.nextType == 4 && this.currentType == 2) || this.nextType == 0;
if (!email) {
resendCode();
return;
}
try {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, NPStringFog.decode("14421119145518"), pInfo.versionName, Integer.valueOf(pInfo.versionCode));
Intent mailer = new Intent(NPStringFog.decode("505F55435E58551F585F45545F451F505245585E5F1F62747F75"));
mailer.setType(NPStringFog.decode("5C5442425056541E435752090303"));
mailer.putExtra(NPStringFog.decode("505F55435E58551F585F45545F451F54494543501F747C70787D"), new String[]{"sms@stel.com"});
mailer.putExtra(NPStringFog.decode("505F55435E58551F585F45545F451F54494543501F6264737B747265"), NPStringFog.decode("705F55435E585511435456584245435045585E5F1E5D5E56585F11584242445411") + version + NPStringFog.decode("11") + this.emailPhone);
mailer.putExtra(NPStringFog.decode("505F55435E58551F585F45545F451F54494543501F65746965"), NPStringFog.decode("61595E5F540B11") + this.requestPhone + NPStringFog.decode("3B7041411147544342585E5F0B11") + version + NPStringFog.decode("3B7E621147544342585E5F0B1162757A11") + Build.VERSION.SDK_INT + NPStringFog.decode("3B755447585254117F505C540B11") + Build.MANUFACTURER + Build.MODEL + NPStringFog.decode("3B7D5E52505D540B11") + Locale.getDefault() + NPStringFog.decode("3B7443435E430B11") + this.lastError);
getContext().startActivity(Intent.createChooser(mailer, NPStringFog.decode("62545F5511545C50585D1F1F1F")));
} catch (Exception e) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString(NPStringFog.decode("7F5E7C50585D785F4245505D5D5455"), 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 (ChangePhoneActivity.this.scrollHeight - innerHeight >= requiredHeight) {
if (ChangePhoneActivity.this.scrollHeight <= maxHeight) {
setMeasuredDimension(getMeasuredWidth(), ChangePhoneActivity.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;
TextView textView = this.problemText;
textView.layout(textView.getLeft(), t2, this.problemText.getRight(), t2 + h);
} else if (this.timeText.getVisibility() == 0) {
int h2 = this.timeText.getMeasuredHeight();
t2 = (bottom + height) - h2;
TextView textView2 = this.timeText;
textView2.layout(textView2.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);
}
}
public void resendCode() {
final Bundle params = new Bundle();
params.putString(NPStringFog.decode("41595E5F54"), this.phone);
params.putString(NPStringFog.decode("5441595E5F54"), this.emailPhone);
params.putString(NPStringFog.decode("41595E5F54775E435C50455455"), this.requestPhone);
params.putString(NPStringFog.decode("41595E5F54775E435C50455455795042735D505F5A"), this.requestHasBlankPhone);
this.nextPressed = true;
ChangePhoneActivity.this.needShowProgress();
final TLRPC.TL_auth_resendCode req = new TLRPC.TL_auth_resendCode();
req.phone_number = this.requestPhone;
req.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$resendCode$3$ChangePhoneActivity$LoginActivitySmsView(params, req, tLObject, tL_error);
}
}, 2);
}
public void lambda$resendCode$3$ChangePhoneActivity$LoginActivitySmsView(final Bundle params, final TLRPC.TL_auth_resendCode req, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$2$ChangePhoneActivity$LoginActivitySmsView(error, params, response, req);
}
});
}
public void lambda$null$2$ChangePhoneActivity$LoginActivitySmsView(TLRPC.TL_error error, Bundle params, TLObject response, TLRPC.TL_auth_resendCode req) {
this.nextPressed = false;
if (error == null) {
ChangePhoneActivity.this.fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response);
} else {
AlertDialog dialog = (AlertDialog) AlertsCreator.processError(ChangePhoneActivity.this.currentAccount, error, ChangePhoneActivity.this, req, new Object[0]);
if (dialog != null && error.text.contains(NPStringFog.decode("61797E7F746E727E75746E74696178637475"))) {
dialog.setPositiveButtonListener(new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$1$ChangePhoneActivity$LoginActivitySmsView(dialogInterface, i);
}
});
}
}
ChangePhoneActivity.this.needHideProgress();
}
public void lambda$null$1$ChangePhoneActivity$LoginActivitySmsView(DialogInterface dialog1, int which) {
onBackPressed(true);
ChangePhoneActivity.this.finishFragment();
}
@Override
public String getHeaderName() {
if (this.currentType == 1) {
return this.phone;
}
return LocaleController.getString(NPStringFog.decode("685E4443725E5554"), R.string.YourCode);
}
@Override
public boolean needBackButton() {
return true;
}
@Override
public void onCancelPressed() {
this.nextPressed = false;
}
@Override
public void setParams(Bundle params, boolean restore) {
int i;
int i2;
if (params != null) {
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(NPStringFog.decode("41595E5F54"));
this.emailPhone = params.getString(NPStringFog.decode("5441595E5F54"));
this.requestPhone = params.getString(NPStringFog.decode("41595E5F54775E435C50455455"));
this.requestHasBlankPhone = params.getString(NPStringFog.decode("41595E5F54775E435C50455455795042735D505F5A"));
this.phoneHash = params.getString(NPStringFog.decode("41595E5F5479504259"));
int i4 = params.getInt("timeout");
this.time = i4;
this.timeout = i4;
this.openTime = (int) (System.currentTimeMillis() / 1000);
this.nextType = params.getInt(NPStringFog.decode("5F54494565484154"));
this.pattern = params.getString(NPStringFog.decode("4150454554435F"));
int i5 = params.getInt(NPStringFog.decode("5D545F564559"));
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(NPStringFog.decode("575E5F45421E435C545558445C1F454557")));
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 ChangePhoneActivity.LoginActivitySmsView.this.lambda$setParams$4$ChangePhoneActivity$LoginActivitySmsView(num, view, i7, keyEvent);
}
});
this.codeField[a2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i7, KeyEvent keyEvent) {
return ChangePhoneActivity.LoginActivitySmsView.this.lambda$setParams$5$ChangePhoneActivity$LoginActivitySmsView(textView, i7, keyEvent);
}
});
a2++;
i6 = 8;
}
} else {
int a3 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
if (a3 >= editTextBoldCursorArr2.length) {
break;
}
editTextBoldCursorArr2[a3].setText(NPStringFog.decode(""));
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 = NPStringFog.decode("");
int i7 = this.currentType;
if (i7 == 1) {
str = AndroidUtilities.replaceTags(LocaleController.getString(NPStringFog.decode("62545F45704141725E5554"), R.string.SentAppCode));
} else if (i7 == 2) {
str = AndroidUtilities.replaceTags(LocaleController.formatString(NPStringFog.decode("62545F45625C42725E5554"), R.string.SentSmsCode, LocaleController.addNbsp(number)));
} else if (i7 == 3) {
str = AndroidUtilities.replaceTags(LocaleController.formatString(NPStringFog.decode("62545F4572505D5D725E5554"), R.string.SentCallCode, LocaleController.addNbsp(number)));
} else if (i7 == 4) {
str = AndroidUtilities.replaceTags(LocaleController.formatString(NPStringFog.decode("62545F4572505D5D7E5F5D48"), 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;
}
String decode = NPStringFog.decode("625C4265544945");
String decode2 = NPStringFog.decode("72505D5D65544945");
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(decode2, R.string.CallText, 1, 0));
} else if (i9 == 2) {
this.timeText.setText(LocaleController.formatString(decode, R.string.SmsText, 1, 0));
}
createTimer();
return;
}
if (this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) {
this.timeText.setText(LocaleController.formatString(decode2, R.string.CallText, 2, 0));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
createTimer();
return;
}
if (this.currentType == 4 && this.nextType == 2) {
this.timeText.setText(LocaleController.formatString(decode, 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();
}
}
}
public boolean lambda$setParams$4$ChangePhoneActivity$LoginActivitySmsView(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 lambda$setParams$5$ChangePhoneActivity$LoginActivitySmsView(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() {
ChangePhoneActivity.LoginActivitySmsView.AnonymousClass4.this.lambda$run$0$ChangePhoneActivity$LoginActivitySmsView$4();
}
});
}
public void lambda$run$0$ChangePhoneActivity$LoginActivitySmsView$4() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - LoginActivitySmsView.this.lastCodeTime;
LoginActivitySmsView.this.lastCodeTime = currentTime;
LoginActivitySmsView.this.codeTime = (int) (r4.codeTime - 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) {
if (this.codeTimer != null) {
this.codeTimer.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 TimerTask() {
@Override
public void run() {
if (LoginActivitySmsView.this.timeTimer == null) {
return;
}
AndroidUtilities.runOnUIThread(new AnonymousClass1());
}
public class AnonymousClass1 implements Runnable {
AnonymousClass1() {
}
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - LoginActivitySmsView.this.lastCurrentTime;
LoginActivitySmsView.this.time = (int) (LoginActivitySmsView.this.time - diff);
LoginActivitySmsView.this.lastCurrentTime = currentTime;
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(NPStringFog.decode("72505D5D65544945"), R.string.CallText, Integer.valueOf(minutes), Integer.valueOf(seconds)));
} else if (LoginActivitySmsView.this.nextType == 2) {
LoginActivitySmsView.this.timeText.setText(LocaleController.formatString(NPStringFog.decode("625C4265544945"), 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(NPStringFog.decode("72505D5D585F56"), R.string.Calling));
} else {
LoginActivitySmsView.this.timeText.setText(LocaleController.getString(NPStringFog.decode("62545F55585F56625C42"), 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(ChangePhoneActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChangePhoneActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1.this.lambda$run$1$ChangePhoneActivity$LoginActivitySmsView$5$1(tLObject, tL_error);
}
}, 2);
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 lambda$run$1$ChangePhoneActivity$LoginActivitySmsView$5$1(TLObject response, final TLRPC.TL_error error) {
if (error != null && error.text != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChangePhoneActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1.this.lambda$null$0$ChangePhoneActivity$LoginActivitySmsView$5$1(error);
}
});
}
}
public void lambda$null$0$ChangePhoneActivity$LoginActivitySmsView$5$1(TLRPC.TL_error error) {
LoginActivitySmsView.this.lastError = error.text;
}
}
}, 0L, 1000L);
}
public void destroyTimer() {
try {
synchronized (this.timerSync) {
if (this.timeTimer != null) {
this.timeTimer.cancel();
this.timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public String getCode() {
if (this.codeField == null) {
return NPStringFog.decode("");
}
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) {
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_account_changePhone req = new TLRPC.TL_account_changePhone();
req.phone_number = this.requestHasBlankPhone;
req.phone_code = code;
req.phone_code_hash = this.phoneHash;
destroyTimer();
ChangePhoneActivity.this.needShowProgress();
ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$onNextPressed$7$ChangePhoneActivity$LoginActivitySmsView(req, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$7$ChangePhoneActivity$LoginActivitySmsView(final TLRPC.TL_account_changePhone req, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$6$ChangePhoneActivity$LoginActivitySmsView(error, response, req);
}
});
}
public void lambda$null$6$ChangePhoneActivity$LoginActivitySmsView(TLRPC.TL_error error, TLObject response, TLRPC.TL_account_changePhone req) {
int i;
int i2;
ChangePhoneActivity.this.needHideProgress();
this.nextPressed = false;
if (error == null) {
TLRPC.User user = (TLRPC.User) response;
destroyTimer();
destroyCodeTimer();
UserConfig.getInstance(ChangePhoneActivity.this.currentAccount).setCurrentUser(user);
UserConfig.getInstance(ChangePhoneActivity.this.currentAccount).saveConfig(true);
ArrayList<TLRPC.User> users = new ArrayList<>();
users.add(user);
MessagesStorage.getInstance(ChangePhoneActivity.this.currentAccount).putUsersAndChats(users, null, true, true);
MessagesController.getInstance(ChangePhoneActivity.this.currentAccount).putUser(user, false);
ChangePhoneActivity.this.finishFragment();
NotificationCenter.getInstance(ChangePhoneActivity.this.currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
return;
}
this.lastError = error.text;
if ((this.currentType == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) || ((this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) || (this.currentType == 4 && this.nextType == 2))) {
createTimer();
}
int i3 = this.currentType;
if (i3 == 2) {
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
} else if (i3 == 3) {
AndroidUtilities.setWaitingForCall(true);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
}
this.waitingForEvent = true;
if (this.currentType != 3) {
AlertsCreator.processError(ChangePhoneActivity.this.currentAccount, error, ChangePhoneActivity.this, req, new Object[0]);
}
if (error.text.contains(NPStringFog.decode("61797E7F746E727E75746E747C616568")) || error.text.contains(NPStringFog.decode("61797E7F746E727E75746E787F67707D7875"))) {
int a = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (a < editTextBoldCursorArr.length) {
editTextBoldCursorArr[a].setText(NPStringFog.decode(""));
a++;
} else {
editTextBoldCursorArr[0].requestFocus();
return;
}
}
} else if (error.text.contains(NPStringFog.decode("61797E7F746E727E75746E74696178637475"))) {
onBackPressed(true);
ChangePhoneActivity.this.setPage(0, true, null, true);
}
}
@Override
public boolean onBackPressed(boolean force) {
if (!force) {
AlertDialog.Builder builder = new AlertDialog.Builder(ChangePhoneActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString(NPStringFog.decode("7041417F505C54"), R.string.AppName));
builder.setMessage(LocaleController.getString(NPStringFog.decode("62455E41675443585758525045585E5F"), R.string.StopVerification));
builder.setPositiveButton(LocaleController.getString(NPStringFog.decode("725E5F45585F4454"), R.string.Continue), null);
builder.setNegativeButton(LocaleController.getString(NPStringFog.decode("62455E41"), R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$onBackPressed$8$ChangePhoneActivity$LoginActivitySmsView(dialogInterface, i);
}
});
ChangePhoneActivity.this.showDialog(builder.create());
return false;
}
TLRPC.TL_auth_cancelCode req = new TLRPC.TL_auth_cancelCode();
req.phone_number = this.requestPhone;
req.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChangePhoneActivity.LoginActivitySmsView.lambda$onBackPressed$9(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 lambda$onBackPressed$8$ChangePhoneActivity$LoginActivitySmsView(DialogInterface dialogInterface, int i) {
onBackPressed(true);
ChangePhoneActivity.this.setPage(0, true, null, true);
}
public static void lambda$onBackPressed$9(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() {
ChangePhoneActivity.LoginActivitySmsView.this.lambda$onShow$10$ChangePhoneActivity$LoginActivitySmsView();
}
}, 100L);
}
public void lambda$onShow$10$ChangePhoneActivity$LoginActivitySmsView() {
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[] editTextBoldCursorArr2 = this.codeField;
editTextBoldCursorArr2[a].setSelection(editTextBoldCursorArr2[a].length());
AndroidUtilities.showKeyboard(this.codeField[a]);
return;
}
}
}
}
@Override
public void didReceivedNotification(int id, int account, Object... args) {
if (!this.waitingForEvent || this.codeField == null) {
return;
}
int i = NotificationCenter.didReceiveSmsCode;
String decode = NPStringFog.decode("");
if (id == i) {
this.codeField[0].setText(decode + args[0]);
onNextPressed();
return;
}
if (id == NotificationCenter.didReceiveCall) {
String num = decode + args[0];
if (!AndroidUtilities.checkPhonePattern(this.pattern, num)) {
return;
}
this.ignoreOnTextChange = true;
this.codeField[0].setText(num);
this.ignoreOnTextChange = false;
onNextPressed();
}
}
}
@Override
public ThemeDescription[] getThemeDescriptions() {
SlideView[] slideViewArr = this.views;
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];
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, NPStringFog.decode("505245585E5F73504375545750445D45")));
arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, NPStringFog.decode("505245585E5F73504375545750445D45")));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, NPStringFog.decode("505245585E5F73504375545750445D4578525E5F")));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, NPStringFog.decode("505245585E5F73504375545750445D456558455D54")));
arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, NPStringFog.decode("505245585E5F73504375545750445D4562545D5452455E43")));
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(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 a = 0; a < smsView1.codeField.length; a++) {
arrayList.add(new ThemeDescription(smsView1.codeField[a], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView1.codeField[a], 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));
String decode = NPStringFog.decode("4150585F45");
arrayList.add(new ThemeDescription(smsView1.progressView, 0, new Class[]{ProgressView.class}, new String[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E5643544242785F5F5443")));
arrayList.add(new ThemeDescription(smsView1.progressView, 0, new Class[]{ProgressView.class}, new String[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E56435442427E44455443")));
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, NPStringFog.decode("52595045426E505245585E5F7350525A56435E445F55")));
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 a2 = 0; a2 < smsView2.codeField.length; a2++) {
arrayList.add(new ThemeDescription(smsView2.codeField[a2], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView2.codeField[a2], 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[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E5643544242785F5F5443")));
arrayList.add(new ThemeDescription(smsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E56435442427E44455443")));
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, NPStringFog.decode("52595045426E505245585E5F7350525A56435E445F55")));
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 a3 = 0; a3 < smsView3.codeField.length; a3++) {
arrayList.add(new ThemeDescription(smsView3.codeField[a3], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView3.codeField[a3], 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[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E5643544242785F5F5443")));
arrayList.add(new ThemeDescription(smsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E56435442427E44455443")));
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, NPStringFog.decode("52595045426E505245585E5F7350525A56435E445F55")));
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 a4 = 0; a4 < smsView4.codeField.length; a4++) {
arrayList.add(new ThemeDescription(smsView4.codeField[a4], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(smsView4.codeField[a4], 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[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E5643544242785F5F5443")));
arrayList.add(new ThemeDescription(smsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{decode}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, NPStringFog.decode("5D5E56585F6E41435E56435442427E44455443")));
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, NPStringFog.decode("52595045426E505245585E5F7350525A56435E445F55")));
return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]);
}
}