❥ v1.0.0版本的 MD5 值为:6ae606845f10a6b2b654b679d6008d62
以下内容为反编译后的 ChangePhoneActivity.java 源代码,内容仅作参考
package im.pnpgvkcffv.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.pnpgvkcffv.messenger.AndroidUtilities;
import im.pnpgvkcffv.messenger.ApplicationLoader;
import im.pnpgvkcffv.messenger.BuildVars;
import im.pnpgvkcffv.messenger.FileLog;
import im.pnpgvkcffv.messenger.LocaleController;
import im.pnpgvkcffv.messenger.MessagesController;
import im.pnpgvkcffv.messenger.MessagesStorage;
import im.pnpgvkcffv.messenger.NotificationCenter;
import im.pnpgvkcffv.messenger.R;
import im.pnpgvkcffv.messenger.UserConfig;
import im.pnpgvkcffv.phoneformat.PhoneFormat;
import im.pnpgvkcffv.tgnet.ConnectionsManager;
import im.pnpgvkcffv.tgnet.RequestDelegate;
import im.pnpgvkcffv.tgnet.TLObject;
import im.pnpgvkcffv.tgnet.TLRPC;
import im.pnpgvkcffv.ui.ChangePhoneActivity;
import im.pnpgvkcffv.ui.CountrySelectActivity;
import im.pnpgvkcffv.ui.actionbar.ActionBar;
import im.pnpgvkcffv.ui.actionbar.ActionBarMenu;
import im.pnpgvkcffv.ui.actionbar.AlertDialog;
import im.pnpgvkcffv.ui.actionbar.BaseFragment;
import im.pnpgvkcffv.ui.actionbar.Theme;
import im.pnpgvkcffv.ui.actionbar.ThemeDescription;
import im.pnpgvkcffv.ui.components.AlertsCreator;
import im.pnpgvkcffv.ui.components.EditTextBoldCursor;
import im.pnpgvkcffv.ui.components.HintEditText;
import im.pnpgvkcffv.ui.components.LayoutHelper;
import im.pnpgvkcffv.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 org.slf4j.Marker;
@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(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);
}
}
@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("AppName", 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("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 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(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.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("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) {
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);
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 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;
} else if (count == 1 && after == 0) {
if (s.charAt(start) == ' ' && start > 0) {
this.characterAction = 3;
this.actionPosition = start - 1;
return;
}
this.characterAction = 2;
} else {
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;
} else 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("ChangePhoneHelp", 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("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, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE);
String country = null;
try {
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
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("ChooseCountry", 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;
}
} else if (country != null) {
this.ignoreOnTextChange = true;
EditTextBoldCursor editTextBoldCursor = this.codeField;
editTextBoldCursor.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;
}
}
@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() {
if (ChangePhoneActivity.this.getParentActivity() == null || this.nextPressed) {
return;
}
if (this.countryState == 1) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
} else if (this.codeField.length() == 0) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else {
if (TextUtils.isEmpty(((Object) this.phoneField.getText()) + "")) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
return;
}
String phone = PhoneFormat.stripExceptNumbers("" + ((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("CannotMatchTheCurrentPhoneNumber", 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("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);
StringBuilder sb = new StringBuilder();
sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.codeField.getText())));
sb.append(" ");
sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.phoneField.getText())));
params.putString("phoneFormatedHasBlank", sb.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("phone"));
}
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("ChangePhoneNewNumber", 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 = "";
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);
}
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("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) {
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, "%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) {
AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, 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 (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("phone", this.phone);
params.putString("ephone", this.emailPhone);
params.putString("phoneFormated", this.requestPhone);
params.putString("phoneFormatedHasBlank", 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("PHONE_CODE_EXPIRED")) {
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("YourCode", 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("phone");
this.emailPhone = params.getString("ephone");
this.requestPhone = params.getString("phoneFormated");
this.requestHasBlankPhone = params.getString("phoneFormatedHasBlank");
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 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("");
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);
} else 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));
}
createTimer();
} else if (this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
createTimer();
} else if (this.currentType == 4 && this.nextType == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
this.problemText.setVisibility(this.time < 1000 ? 0 : 8);
this.timeText.setVisibility(this.time < 1000 ? 8 : 0);
createTimer();
} else {
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() {
LoginActivitySmsView loginActivitySmsView;
double currentTime = System.currentTimeMillis();
double diff = currentTime - LoginActivitySmsView.this.lastCodeTime;
LoginActivitySmsView.this.lastCodeTime = currentTime;
LoginActivitySmsView.this.codeTime = (int) (loginActivitySmsView.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("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(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;
} else if (LoginActivitySmsView.this.nextType == 3) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
LoginActivitySmsView.this.waitingForEvent = false;
LoginActivitySmsView.this.destroyCodeTimer();
LoginActivitySmsView.this.resendCode();
return;
} else {
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 "";
}
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("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
int a = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (a < editTextBoldCursorArr.length) {
editTextBoldCursorArr[a].setText("");
a++;
} else {
editTextBoldCursorArr[0].requestFocus();
return;
}
}
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
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("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) {
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;
}
if (id == NotificationCenter.didReceiveSmsCode) {
this.codeField[0].setText("" + args[0]);
onNextPressed();
} else if (id == NotificationCenter.didReceiveCall) {
String num = "" + 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, 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(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));
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 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[]{"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 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[]{"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 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[]{"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]);
}
}