package im.guobwnxjuc.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.guobwnxjuc.messenger.AndroidUtilities; import im.guobwnxjuc.messenger.ApplicationLoader; import im.guobwnxjuc.messenger.BuildVars; import im.guobwnxjuc.messenger.FileLog; import im.guobwnxjuc.messenger.LocaleController; import im.guobwnxjuc.messenger.MessagesController; import im.guobwnxjuc.messenger.MessagesStorage; import im.guobwnxjuc.messenger.NotificationCenter; import im.guobwnxjuc.messenger.R; import im.guobwnxjuc.messenger.UserConfig; import im.guobwnxjuc.phoneformat.PhoneFormat; import im.guobwnxjuc.tgnet.ConnectionsManager; import im.guobwnxjuc.tgnet.RequestDelegate; import im.guobwnxjuc.tgnet.TLObject; import im.guobwnxjuc.tgnet.TLRPC; import im.guobwnxjuc.ui.ChangePhoneActivity; import im.guobwnxjuc.ui.CountrySelectActivity; import im.guobwnxjuc.ui.actionbar.ActionBar; import im.guobwnxjuc.ui.actionbar.AlertDialog; import im.guobwnxjuc.ui.actionbar.BaseFragment; import im.guobwnxjuc.ui.actionbar.Theme; import im.guobwnxjuc.ui.actionbar.ThemeDescription; import im.guobwnxjuc.ui.components.AlertsCreator; import im.guobwnxjuc.ui.components.EditTextBoldCursor; import im.guobwnxjuc.ui.components.HintEditText; import im.guobwnxjuc.ui.components.LayoutHelper; import im.guobwnxjuc.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 boolean checkPermissions = true; private int currentViewNum = 0; private View doneButton; private Dialog permissionsDialog; private ArrayList<String> permissionsItems = new ArrayList<>(); private AlertDialog progressDialog; private int scrollHeight; private SlideView[] views = new SlideView[5]; /* access modifiers changed from: private */ public class ProgressView extends View { private Paint paint = new Paint(); private Paint paint2 = new Paint(); private float progress; public ProgressView(Context context) { super(context); this.paint.setColor(Theme.getColor(Theme.key_login_progressInner)); this.paint2.setColor(Theme.getColor(Theme.key_login_progressOuter)); } public void setProgress(float f) { this.progress = f; invalidate(); } /* access modifiers changed from: protected */ public void onDraw(Canvas canvas) { float measuredWidth = (float) ((int) (((float) getMeasuredWidth()) * this.progress)); canvas.drawRect(0.0f, 0.0f, measuredWidth, (float) getMeasuredHeight(), this.paint2); canvas.drawRect(measuredWidth, 0.0f, (float) getMeasuredWidth(), (float) getMeasuredHeight(), this.paint); } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onFragmentDestroy() { super.onFragmentDestroy(); int i = 0; while (true) { SlideView[] slideViewArr = this.views; if (i >= slideViewArr.length) { break; } if (slideViewArr[i] != null) { slideViewArr[i].onDestroyActivity(); } i++; } AlertDialog alertDialog = this.progressDialog; if (alertDialog != null) { try { alertDialog.dismiss(); } catch (Exception e) { FileLog.e(e); } this.progressDialog = null; } AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid); } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment 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() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.AnonymousClass1 */ @Override // im.guobwnxjuc.ui.actionbar.ActionBar.ActionBarMenuOnItemClick public void onItemClick(int i) { if (i == 1) { ChangePhoneActivity.this.views[ChangePhoneActivity.this.currentViewNum].onNextPressed(); } else if (i == -1) { ChangePhoneActivity.this.finishFragment(); } } }); this.doneButton = this.actionBar.createMenu().addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56.0f)); AnonymousClass2 r0 = new ScrollView(context) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.AnonymousClass2 */ public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) { if (ChangePhoneActivity.this.currentViewNum == 1 || ChangePhoneActivity.this.currentViewNum == 2 || ChangePhoneActivity.this.currentViewNum == 4) { rect.bottom += AndroidUtilities.dp(40.0f); } return super.requestChildRectangleOnScreen(view, rect, z); } /* access modifiers changed from: protected */ public void onMeasure(int i, int i2) { ChangePhoneActivity.this.scrollHeight = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f); super.onMeasure(i, i2); } }; r0.setFillViewport(true); this.fragmentView = r0; FrameLayout frameLayout = new FrameLayout(context); r0.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 i = 0; while (true) { SlideView[] slideViewArr = this.views; if (i < slideViewArr.length) { slideViewArr[i].setVisibility(i == 0 ? 0 : 8); frameLayout.addView(this.views[i], LayoutHelper.createFrame(-1.0f, i == 0 ? -2.0f : -1.0f, 51, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 30.0f, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 0.0f)); i++; } else { this.actionBar.setTitle(this.views[0].getHeaderName()); return this.fragmentView; } } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onResume() { super.onResume(); AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid); } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) { if (i == 6) { this.checkPermissions = false; int i2 = this.currentViewNum; if (i2 == 0) { this.views[i2].onNextPressed(); } } } /* access modifiers changed from: protected */ @Override // im.guobwnxjuc.ui.actionbar.BaseFragment 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 // im.guobwnxjuc.ui.actionbar.BaseFragment public boolean onBackPressed() { if (progressDialogIsShown()) { needHideProgress(); } int i = this.currentViewNum; int i2 = 0; if (i == 0) { while (true) { SlideView[] slideViewArr = this.views; if (i2 >= slideViewArr.length) { return true; } if (slideViewArr[i2] != null) { slideViewArr[i2].onDestroyActivity(); } i2++; } } else { if (this.views[i].onBackPressed(false)) { setPage(0, true, null, true); } return false; } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onTransitionAnimationEnd(boolean z, boolean z2) { if (z) { this.views[this.currentViewNum].onShow(); } } public void needShowProgress() { if (getParentActivity() != null && !getParentActivity().isFinishing() && this.progressDialog == null) { AnonymousClass3 r0 = new AlertDialog(getParentActivity(), 3) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.AnonymousClass3 */ @Override // im.guobwnxjuc.ui.actionbar.AlertDialog public void onBackPressed() { ChangePhoneActivity.this.progressDialog.cancel(); } }; this.progressDialog = r0; r0.setOnCancelListener(new DialogInterface.OnCancelListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$DMpR6UsW7JFlaabZpjyliYEX_w */ 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 /* synthetic */ void lambda$needShowProgress$0$ChangePhoneActivity(DialogInterface dialogInterface) { int i; SlideView[] slideViewArr = this.views; if (slideViewArr != null && (i = this.currentViewNum) >= 0 && i < slideViewArr.length && (slideViewArr[i] instanceof PhoneView)) { ((PhoneView) slideViewArr[i]).cancelNetRequest(); } } public void needHideProgress() { AlertDialog alertDialog = this.progressDialog; if (alertDialog != null) { 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 i, boolean z, Bundle bundle, boolean z2) { if (i == 3) { this.doneButton.setVisibility(8); } else { if (i == 0) { this.checkPermissions = true; } this.doneButton.setVisibility(0); } SlideView[] slideViewArr = this.views; final SlideView slideView = slideViewArr[this.currentViewNum]; final SlideView slideView2 = slideViewArr[i]; this.currentViewNum = i; slideView2.setParams(bundle, false); this.actionBar.setTitle(slideView2.getHeaderName()); slideView2.onShow(); int i2 = AndroidUtilities.displaySize.x; if (z2) { i2 = -i2; } slideView2.setX((float) i2); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setInterpolator(new AccelerateDecelerateInterpolator()); animatorSet.setDuration(300L); Animator[] animatorArr = new Animator[2]; float[] fArr = new float[1]; fArr[0] = (float) (z2 ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x); animatorArr[0] = ObjectAnimator.ofFloat(slideView, "translationX", fArr); animatorArr[1] = ObjectAnimator.ofFloat(slideView2, "translationX", 0.0f); animatorSet.playTogether(animatorArr); animatorSet.addListener(new AnimatorListenerAdapter() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.AnonymousClass4 */ public void onAnimationStart(Animator animator) { slideView2.setVisibility(0); } public void onAnimationEnd(Animator animator) { slideView.setVisibility(8); slideView.setX(0.0f); } }); animatorSet.start(); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void fillNextCodeParams(Bundle bundle, TLRPC.TL_auth_sentCode tL_auth_sentCode) { bundle.putString("phoneHash", tL_auth_sentCode.phone_code_hash); if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeCall) { bundle.putInt("nextType", 4); } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeFlashCall) { bundle.putInt("nextType", 3); } else if (tL_auth_sentCode.next_type instanceof TLRPC.TL_auth_codeTypeSms) { bundle.putInt("nextType", 2); } if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeApp) { bundle.putInt("type", 1); bundle.putInt("length", tL_auth_sentCode.type.length); setPage(1, true, bundle, false); return; } if (tL_auth_sentCode.timeout == 0) { tL_auth_sentCode.timeout = 60; } bundle.putInt("timeout", tL_auth_sentCode.timeout * 1000); if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeCall) { bundle.putInt("type", 4); bundle.putInt("length", tL_auth_sentCode.type.length); setPage(4, true, bundle, false); } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeFlashCall) { bundle.putInt("type", 3); bundle.putString("pattern", tL_auth_sentCode.type.pattern); setPage(3, true, bundle, false); } else if (tL_auth_sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeSms) { bundle.putInt("type", 2); bundle.putInt("length", tL_auth_sentCode.type.length); setPage(2, true, bundle, false); } } public class PhoneView extends SlideView implements AdapterView.OnItemSelectedListener { private EditTextBoldCursor codeField; private HashMap<String, String> codesMap = new HashMap<>(); private ArrayList<String> countriesArray = new ArrayList<>(); private HashMap<String, String> countriesMap = new HashMap<>(); private TextView countryButton; private int countryState = 0; private boolean ignoreOnPhoneChange = false; private boolean ignoreOnTextChange = false; private boolean ignoreSelection = false; private int netRequestToken = -1; private boolean nextPressed = false; private HintEditText phoneField; private HashMap<String, String> phoneFormatMap = new HashMap<>(); private TextView textView; private TextView textView2; private View view; @Override // android.widget.AdapterView.OnItemSelectedListener public void onNothingSelected(AdapterView<?> adapterView) { } /* JADX WARNING: Removed duplicated region for block: B:40:0x032d */ /* JADX WARNING: Removed duplicated region for block: B:43:0x034a */ /* JADX WARNING: Removed duplicated region for block: B:44:0x035e */ public PhoneView(Context context) { super(context); String str; String str2; setOrientation(1); TextView textView3 = new TextView(context); this.countryButton = textView3; textView3.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() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$5xthNgxbzUy2blrWt5aViJBvwsI */ public final void onClick(View view) { ChangePhoneActivity.PhoneView.this.lambda$new$2$ChangePhoneActivity$PhoneView(view); } }); View view2 = new View(context); this.view = view2; view2.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 textView4 = new TextView(context); this.textView = textView4; textView4.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); this.codeField.setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)}); linearLayout.addView(this.codeField, LayoutHelper.createLinear(55, 36, -9.0f, 0.0f, 16.0f, 0.0f)); this.codeField.addTextChangedListener(new TextWatcher(ChangePhoneActivity.this) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.PhoneView.AnonymousClass1 */ public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void afterTextChanged(Editable editable) { boolean z; String str; if (!PhoneView.this.ignoreOnTextChange) { PhoneView.this.ignoreOnTextChange = true; String stripExceptNumbers = PhoneFormat.stripExceptNumbers(PhoneView.this.codeField.getText().toString()); PhoneView.this.codeField.setText(stripExceptNumbers); String str2 = null; if (stripExceptNumbers.length() == 0) { PhoneView.this.countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry)); PhoneView.this.phoneField.setHintText((String) null); PhoneView.this.countryState = 1; } else { int i = 4; if (stripExceptNumbers.length() > 4) { PhoneView.this.ignoreOnTextChange = true; while (true) { if (i < 1) { str = null; z = false; break; } String substring = stripExceptNumbers.substring(0, i); if (((String) PhoneView.this.codesMap.get(substring)) != null) { String str3 = stripExceptNumbers.substring(i) + PhoneView.this.phoneField.getText().toString(); PhoneView.this.codeField.setText(substring); z = true; str = str3; stripExceptNumbers = substring; break; } i--; } if (!z) { PhoneView.this.ignoreOnTextChange = true; str = stripExceptNumbers.substring(1) + PhoneView.this.phoneField.getText().toString(); EditTextBoldCursor editTextBoldCursor = PhoneView.this.codeField; stripExceptNumbers = stripExceptNumbers.substring(0, 1); editTextBoldCursor.setText(stripExceptNumbers); } } else { str = null; z = false; } String str4 = (String) PhoneView.this.codesMap.get(stripExceptNumbers); if (str4 != null) { int indexOf = PhoneView.this.countriesArray.indexOf(str4); if (indexOf != -1) { PhoneView.this.ignoreSelection = true; PhoneView.this.countryButton.setText((CharSequence) PhoneView.this.countriesArray.get(indexOf)); String str5 = (String) PhoneView.this.phoneFormatMap.get(stripExceptNumbers); HintEditText hintEditText = PhoneView.this.phoneField; if (str5 != null) { str2 = str5.replace('X', Typography.ndash); } hintEditText.setHintText(str2); PhoneView.this.countryState = 0; } else { PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry)); PhoneView.this.phoneField.setHintText((String) null); PhoneView.this.countryState = 2; } } else { PhoneView.this.countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry)); PhoneView.this.phoneField.setHintText((String) null); PhoneView.this.countryState = 2; } if (!z) { PhoneView.this.codeField.setSelection(PhoneView.this.codeField.getText().length()); } if (str != null) { PhoneView.this.phoneField.requestFocus(); PhoneView.this.phoneField.setText(str); PhoneView.this.phoneField.setSelection(PhoneView.this.phoneField.length()); } } PhoneView.this.ignoreOnTextChange = false; } } }); this.codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$d9df9K5TeVom1z4vHM_E4Z8TMzU */ public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return ChangePhoneActivity.PhoneView.this.lambda$new$3$ChangePhoneActivity$PhoneView(textView, 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(ChangePhoneActivity.this) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.PhoneView.AnonymousClass2 */ private int actionPosition; private int characterAction = -1; public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (i2 == 0 && i3 == 1) { this.characterAction = 1; } else if (i2 != 1 || i3 != 0) { this.characterAction = -1; } else if (charSequence.charAt(i) != ' ' || i <= 0) { this.characterAction = 2; } else { this.characterAction = 3; this.actionPosition = i - 1; } } public void afterTextChanged(Editable editable) { int i; int i2; if (!PhoneView.this.ignoreOnPhoneChange) { int selectionStart = PhoneView.this.phoneField.getSelectionStart(); String obj = PhoneView.this.phoneField.getText().toString(); if (this.characterAction == 3) { obj = obj.substring(0, this.actionPosition) + obj.substring(this.actionPosition + 1); selectionStart--; } StringBuilder sb = new StringBuilder(obj.length()); int i3 = 0; while (i3 < obj.length()) { int i4 = i3 + 1; String substring = obj.substring(i3, i4); if ("0123456789".contains(substring)) { sb.append(substring); } i3 = i4; } PhoneView.this.ignoreOnPhoneChange = true; String hintText = PhoneView.this.phoneField.getHintText(); if (hintText != null) { int i5 = 0; while (true) { if (i5 >= sb.length()) { break; } else if (i5 < hintText.length()) { if (hintText.charAt(i5) == ' ') { sb.insert(i5, ' '); i5++; if (!(selectionStart != i5 || (i2 = this.characterAction) == 2 || i2 == 3)) { selectionStart++; } } i5++; } else { sb.insert(i5, ' '); if (selectionStart == i5 + 1 && (i = this.characterAction) != 2 && i != 3) { selectionStart++; } } } } PhoneView.this.phoneField.setText(sb); if (selectionStart >= 0) { HintEditText hintEditText = PhoneView.this.phoneField; if (selectionStart > PhoneView.this.phoneField.length()) { selectionStart = PhoneView.this.phoneField.length(); } hintEditText.setSelection(selectionStart); } PhoneView.this.phoneField.onTextChange(); PhoneView.this.ignoreOnPhoneChange = false; } } }); this.phoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$Z0_aRrSUSqYpX5uzTLAOUQkbbo */ public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return ChangePhoneActivity.PhoneView.this.lambda$new$4$ChangePhoneActivity$PhoneView(textView, i, keyEvent); } }); this.phoneField.setOnKeyListener(new View.OnKeyListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$_XDO_RMLwlGgrhLWu_RYJwOE5cU */ public final boolean onKey(View view, int i, KeyEvent keyEvent) { return ChangePhoneActivity.PhoneView.this.lambda$new$5$ChangePhoneActivity$PhoneView(view, i, keyEvent); } }); TextView textView5 = new TextView(context); this.textView2 = textView5; textView5.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((float) AndroidUtilities.dp(2.0f), 1.0f); addView(this.textView2, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 28, 0, 10)); HashMap hashMap = new HashMap(); try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt"))); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } String[] split = readLine.split(";"); this.countriesArray.add(0, split[2]); this.countriesMap.put(split[2], split[0]); this.codesMap.put(split[0], split[2]); if (split.length > 3) { this.phoneFormatMap.put(split[0], split[3]); } hashMap.put(split[1], split[2]); } bufferedReader.close(); } catch (Exception e) { FileLog.e(e); } Collections.sort(this.countriesArray, $$Lambda$TEfSBt3hRUlBSSARfPEHsJesTtE.INSTANCE); try { TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone"); if (telephonyManager != null) { str = telephonyManager.getSimCountryIso().toUpperCase(); if (!(str == null || (str2 = (String) hashMap.get(str)) == null || this.countriesArray.indexOf(str2) == -1)) { this.codeField.setText(this.countriesMap.get(str2)); 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(); return; } } catch (Exception e2) { FileLog.e(e2); } str = null; this.codeField.setText(this.countriesMap.get(str2)); this.countryState = 0; if (this.codeField.length() == 0) { } if (this.codeField.length() == 0) { } } public /* synthetic */ void lambda$new$2$ChangePhoneActivity$PhoneView(View view2) { CountrySelectActivity countrySelectActivity = new CountrySelectActivity(true); countrySelectActivity.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$hEQBW0iMhixpN_RdNOQY5Hi0XU */ @Override // im.guobwnxjuc.ui.CountrySelectActivity.CountrySelectActivityDelegate public final void didSelectCountry(CountrySelectActivity.Country country) { ChangePhoneActivity.PhoneView.this.lambda$null$1$ChangePhoneActivity$PhoneView(country); } }); ChangePhoneActivity.this.presentFragment(countrySelectActivity); } public /* synthetic */ void lambda$null$1$ChangePhoneActivity$PhoneView(CountrySelectActivity.Country country) { selectCountry(null, country); AndroidUtilities.runOnUIThread(new Runnable() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$Fe5xnzr1PwkMohWCHCIoyEPVkiw */ public final void run() { ChangePhoneActivity.PhoneView.this.lambda$null$0$ChangePhoneActivity$PhoneView(); } }, 300); this.phoneField.requestFocus(); HintEditText hintEditText = this.phoneField; hintEditText.setSelection(hintEditText.length()); } public /* synthetic */ void lambda$null$0$ChangePhoneActivity$PhoneView() { AndroidUtilities.showKeyboard(this.phoneField); } public /* synthetic */ boolean lambda$new$3$ChangePhoneActivity$PhoneView(TextView textView3, int i, KeyEvent keyEvent) { if (i != 5) { return false; } this.phoneField.requestFocus(); HintEditText hintEditText = this.phoneField; hintEditText.setSelection(hintEditText.length()); return true; } public /* synthetic */ boolean lambda$new$4$ChangePhoneActivity$PhoneView(TextView textView3, int i, KeyEvent keyEvent) { if (i != 5) { return false; } onNextPressed(); return true; } public /* synthetic */ boolean lambda$new$5$ChangePhoneActivity$PhoneView(View view2, int i, KeyEvent keyEvent) { if (i != 67 || this.phoneField.length() != 0) { return false; } this.codeField.requestFocus(); EditTextBoldCursor editTextBoldCursor = this.codeField; editTextBoldCursor.setSelection(editTextBoldCursor.length()); this.codeField.dispatchKeyEvent(keyEvent); return true; } public void selectCountry(String str, CountrySelectActivity.Country country) { String str2 = null; if (str != null) { if (this.countriesArray.indexOf(str) != -1) { this.ignoreOnTextChange = true; String str3 = this.countriesMap.get(str); this.codeField.setText(str3); this.countryButton.setText(str); String str4 = this.phoneFormatMap.get(str3); HintEditText hintEditText = this.phoneField; if (str4 != null) { str2 = str4.replace('X', Typography.ndash); } hintEditText.setHintText(str2); this.countryState = 0; this.ignoreOnTextChange = false; } } else if (country != null) { this.ignoreOnTextChange = true; EditTextBoldCursor editTextBoldCursor = this.codeField; editTextBoldCursor.setText(country.code + ""); if (country.phoneFormat != null) { HintEditText hintEditText2 = this.phoneField; if (country.phoneFormat != null) { str2 = country.phoneFormat.replace('X', Typography.ndash); } hintEditText2.setHintText(str2); } this.countryState = 0; this.ignoreOnTextChange = false; } } @Override // android.widget.AdapterView.OnItemSelectedListener public void onItemSelected(AdapterView<?> adapterView, View view2, int i, long j) { if (this.ignoreSelection) { this.ignoreSelection = false; return; } this.ignoreOnTextChange = true; this.codeField.setText(this.countriesMap.get(this.countriesArray.get(i))); this.ignoreOnTextChange = false; } @Override // im.guobwnxjuc.ui.components.SlideView public void onCancelPressed() { this.nextPressed = false; } @Override // im.guobwnxjuc.ui.components.SlideView public void onNextPressed() { if (ChangePhoneActivity.this.getParentActivity() != null && !this.nextPressed) { 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 stripExceptNumbers = 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(stripExceptNumbers)) { TLRPC.TL_account_sendChangePhoneCode tL_account_sendChangePhoneCode = new TLRPC.TL_account_sendChangePhoneCode(); tL_account_sendChangePhoneCode.phone_number = stripExceptNumbers; tL_account_sendChangePhoneCode.settings = new TLRPC.TL_codeSettings(); tL_account_sendChangePhoneCode.settings.allow_flashcall = false; tL_account_sendChangePhoneCode.settings.allow_app_hash = ApplicationLoader.hasPlayServices; SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0); if (tL_account_sendChangePhoneCode.settings.allow_app_hash) { sharedPreferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit(); } else { sharedPreferences.edit().remove("sms_hash").commit(); } Bundle bundle = new Bundle(); bundle.putString("phone", Marker.ANY_NON_NULL_MARKER + ((Object) this.codeField.getText()) + " " + ((Object) this.phoneField.getText())); try { bundle.putString("ephone", Marker.ANY_NON_NULL_MARKER + PhoneFormat.stripExceptNumbers(this.codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(this.phoneField.getText().toString())); } catch (Exception e) { FileLog.e(e); bundle.putString("ephone", Marker.ANY_NON_NULL_MARKER + stripExceptNumbers); } bundle.putString("phoneFormated", stripExceptNumbers); StringBuilder sb = new StringBuilder(); sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.codeField.getText()))); sb.append(" "); sb.append(PhoneFormat.stripExceptNumbers("" + ((Object) this.phoneField.getText()))); bundle.putString("phoneFormatedHasBlank", sb.toString()); this.nextPressed = true; ChangePhoneActivity.this.needShowProgress(); this.netRequestToken = ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(tL_account_sendChangePhoneCode, new RequestDelegate(bundle, tL_account_sendChangePhoneCode) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$6Iqy1DkfX2eXlHHM3Nd4wCm1zo */ private final /* synthetic */ Bundle f$1; private final /* synthetic */ TLRPC.TL_account_sendChangePhoneCode f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // im.guobwnxjuc.tgnet.RequestDelegate public final void run(TLObject tLObject, TLRPC.TL_error tL_error) { ChangePhoneActivity.PhoneView.this.lambda$onNextPressed$7$ChangePhoneActivity$PhoneView(this.f$1, this.f$2, tLObject, tL_error); } }, 2); return; } AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString("CannotMatchTheCurrentPhoneNumber", R.string.CannotMatchTheCurrentPhoneNumber)); } } } public /* synthetic */ void lambda$onNextPressed$7$ChangePhoneActivity$PhoneView(Bundle bundle, TLRPC.TL_account_sendChangePhoneCode tL_account_sendChangePhoneCode, TLObject tLObject, TLRPC.TL_error tL_error) { AndroidUtilities.runOnUIThread(new Runnable(tL_error, bundle, tLObject, tL_account_sendChangePhoneCode) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$PhoneView$sifowZua3X6clM7o_c7LVpzjM */ private final /* synthetic */ TLRPC.TL_error f$1; private final /* synthetic */ Bundle f$2; private final /* synthetic */ TLObject f$3; private final /* synthetic */ TLRPC.TL_account_sendChangePhoneCode f$4; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; this.f$4 = r5; } public final void run() { ChangePhoneActivity.PhoneView.this.lambda$null$6$ChangePhoneActivity$PhoneView(this.f$1, this.f$2, this.f$3, this.f$4); } }); } public /* synthetic */ void lambda$null$6$ChangePhoneActivity$PhoneView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_account_sendChangePhoneCode tL_account_sendChangePhoneCode) { this.nextPressed = false; if (tL_error == null) { ChangePhoneActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject); } else { AlertsCreator.processError(ChangePhoneActivity.this.currentAccount, tL_error, ChangePhoneActivity.this, tL_account_sendChangePhoneCode, bundle.getString("phone")); } ChangePhoneActivity.this.needHideProgress(); } @Override // im.guobwnxjuc.ui.components.SlideView public void onShow() { super.onShow(); if (this.phoneField == null) { return; } 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 // im.guobwnxjuc.ui.components.SlideView public String getHeaderName() { return LocaleController.getString("ChangePhoneNewNumber", R.string.ChangePhoneNewNumber); } @Override // im.guobwnxjuc.ui.components.SlideView public boolean onBackPressed(boolean z) { if (!z || !cancelNetRequest()) { return super.onBackPressed(z); } return true; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private boolean cancelNetRequest() { if (this.netRequestToken == -1 || ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount) == null) { return false; } ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).cancelRequest(this.netRequestToken, true); return true; } } public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate { private ImageView blackImageView; private ImageView blueImageView; private EditTextBoldCursor[] codeField; private LinearLayout codeFieldContainer; private int codeTime = 15000; private Timer codeTimer; private TextView confirmTextView; private Bundle currentParams; private int currentType; private String emailPhone; private boolean ignoreOnTextChange; private 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 = TimeConstants.MIN; private TextView timeText; private Timer timeTimer; private int timeout; private final Object timerSync = new Object(); private TextView titleTextView; private boolean waitingForEvent; static /* synthetic */ void lambda$onBackPressed$9(TLObject tLObject, TLRPC.TL_error tL_error) { } @Override // im.guobwnxjuc.ui.components.SlideView public boolean needBackButton() { return true; } public LoginActivitySmsView(Context context, int i) { super(context); this.currentType = i; setOrientation(1); TextView textView = new TextView(context); this.confirmTextView = textView; textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6)); this.confirmTextView.setTextSize(1, 14.0f); this.confirmTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f); TextView textView2 = new TextView(context); this.titleTextView = textView2; textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); this.titleTextView.setTextSize(1, 18.0f); this.titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.titleTextView.setGravity(LocaleController.isRTL ? 5 : 3); this.titleTextView.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f); this.titleTextView.setGravity(49); if (this.currentType == 3) { this.confirmTextView.setGravity((LocaleController.isRTL ? 5 : 3) | 48); FrameLayout frameLayout = new FrameLayout(context); addView(frameLayout, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3)); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.phone_activate); if (LocaleController.isRTL) { frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f)); frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f)); } else { frameLayout.addView(this.confirmTextView, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f)); frameLayout.addView(imageView, LayoutHelper.createFrame(64.0f, 76.0f, 21, 0.0f, 2.0f, 0.0f, 2.0f)); } } else { this.confirmTextView.setGravity(49); FrameLayout frameLayout2 = new FrameLayout(context); addView(frameLayout2, LayoutHelper.createLinear(-2, -2, 49)); if (this.currentType == 1) { ImageView imageView2 = new ImageView(context); this.blackImageView = imageView2; imageView2.setImageResource(R.drawable.sms_devices); this.blackImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY)); frameLayout2.addView(this.blackImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f)); ImageView imageView3 = new ImageView(context); this.blueImageView = imageView3; imageView3.setImageResource(R.drawable.sms_bubble); this.blueImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionBackground), PorterDuff.Mode.MULTIPLY)); frameLayout2.addView(this.blueImageView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f)); this.titleTextView.setText(LocaleController.getString("SentAppCodeTitle", R.string.SentAppCodeTitle)); } else { 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); } AnonymousClass1 r4 = new TextView(context, ChangePhoneActivity.this) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass1 */ /* access modifiers changed from: protected */ public void onMeasure(int i, int i2) { super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE)); } }; this.timeText = r4; r4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6)); this.timeText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f); if (this.currentType == 3) { this.timeText.setTextSize(1, 14.0f); addView(this.timeText, LayoutHelper.createLinear(-2, -2, LocaleController.isRTL ? 5 : 3)); this.progressView = new ProgressView(context); this.timeText.setGravity(LocaleController.isRTL ? 5 : 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)); } AnonymousClass2 r42 = new TextView(context, ChangePhoneActivity.this) { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass2 */ /* access modifiers changed from: protected */ public void onMeasure(int i, int i2) { super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE)); } }; this.problemText = r42; r42.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); this.problemText.setLineSpacing((float) AndroidUtilities.dp(2.0f), 1.0f); this.problemText.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f)); this.problemText.setTextSize(1, 15.0f); this.problemText.setGravity(49); if (this.currentType == 1) { this.problemText.setText(LocaleController.getString("DidNotGetTheCodeSms", R.string.DidNotGetTheCodeSms)); } else { this.problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode)); } addView(this.problemText, LayoutHelper.createLinear(-2, -2, 49)); this.problemText.setOnClickListener(new View.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$RtPvm_evWnINrLroe5slr9B6Uss */ public final void onClick(View view) { ChangePhoneActivity.LoginActivitySmsView.this.lambda$new$0$ChangePhoneActivity$LoginActivitySmsView(view); } }); } public /* synthetic */ void lambda$new$0$ChangePhoneActivity$LoginActivitySmsView(View view) { if (!this.nextPressed) { if (!((this.nextType == 4 && this.currentType == 2) || this.nextType == 0)) { resendCode(); return; } try { PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode)); Intent intent = new Intent("android.intent.action.SEND"); intent.setType("message/rfc822"); intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@stel.com"}); intent.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + format + " " + this.emailPhone); intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.requestPhone + "\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.lastError); getContext().startActivity(Intent.createChooser(intent, "Send email...")); } catch (Exception unused) { AlertsCreator.showSimpleAlert(ChangePhoneActivity.this, LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled)); } } } /* access modifiers changed from: protected */ public void onMeasure(int i, int i2) { ImageView imageView; super.onMeasure(i, i2); if (this.currentType != 3 && (imageView = this.blueImageView) != null) { int measuredHeight = imageView.getMeasuredHeight() + this.titleTextView.getMeasuredHeight() + this.confirmTextView.getMeasuredHeight() + AndroidUtilities.dp(35.0f); int dp = AndroidUtilities.dp(80.0f); int dp2 = AndroidUtilities.dp(291.0f); if (ChangePhoneActivity.this.scrollHeight - measuredHeight < dp) { setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp); } else if (ChangePhoneActivity.this.scrollHeight > dp2) { setMeasuredDimension(getMeasuredWidth(), dp2); } else { setMeasuredDimension(getMeasuredWidth(), ChangePhoneActivity.this.scrollHeight); } } } /* access modifiers changed from: protected */ public void onLayout(boolean z, int i, int i2, int i3, int i4) { int i5; super.onLayout(z, i, i2, i3, i4); if (this.currentType != 3 && this.blueImageView != null) { int bottom = this.confirmTextView.getBottom(); int measuredHeight = getMeasuredHeight() - bottom; if (this.problemText.getVisibility() == 0) { int measuredHeight2 = this.problemText.getMeasuredHeight(); i5 = (measuredHeight + bottom) - measuredHeight2; TextView textView = this.problemText; textView.layout(textView.getLeft(), i5, this.problemText.getRight(), measuredHeight2 + i5); } else if (this.timeText.getVisibility() == 0) { int measuredHeight3 = this.timeText.getMeasuredHeight(); i5 = (measuredHeight + bottom) - measuredHeight3; TextView textView2 = this.timeText; textView2.layout(textView2.getLeft(), i5, this.timeText.getRight(), measuredHeight3 + i5); } else { i5 = measuredHeight + bottom; } int measuredHeight4 = this.codeFieldContainer.getMeasuredHeight(); int i6 = (((i5 - bottom) - measuredHeight4) / 2) + bottom; LinearLayout linearLayout = this.codeFieldContainer; linearLayout.layout(linearLayout.getLeft(), i6, this.codeFieldContainer.getRight(), measuredHeight4 + i6); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void resendCode() { Bundle bundle = new Bundle(); bundle.putString("phone", this.phone); bundle.putString("ephone", this.emailPhone); bundle.putString("phoneFormated", this.requestPhone); bundle.putString("phoneFormatedHasBlank", this.requestHasBlankPhone); this.nextPressed = true; ChangePhoneActivity.this.needShowProgress(); TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode(); tL_auth_resendCode.phone_number = this.requestPhone; tL_auth_resendCode.phone_code_hash = this.phoneHash; ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate(bundle, tL_auth_resendCode) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$s08qeXPn2SP68OC1535m_Z0xKD4 */ private final /* synthetic */ Bundle f$1; private final /* synthetic */ TLRPC.TL_auth_resendCode f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // im.guobwnxjuc.tgnet.RequestDelegate public final void run(TLObject tLObject, TLRPC.TL_error tL_error) { ChangePhoneActivity.LoginActivitySmsView.this.lambda$resendCode$3$ChangePhoneActivity$LoginActivitySmsView(this.f$1, this.f$2, tLObject, tL_error); } }, 2); } public /* synthetic */ void lambda$resendCode$3$ChangePhoneActivity$LoginActivitySmsView(Bundle bundle, TLRPC.TL_auth_resendCode tL_auth_resendCode, TLObject tLObject, TLRPC.TL_error tL_error) { AndroidUtilities.runOnUIThread(new Runnable(tL_error, bundle, tLObject, tL_auth_resendCode) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$qvXa9Xt19vpaemTQ6K1rr3CL7fk */ private final /* synthetic */ TLRPC.TL_error f$1; private final /* synthetic */ Bundle f$2; private final /* synthetic */ TLObject f$3; private final /* synthetic */ TLRPC.TL_auth_resendCode f$4; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; this.f$4 = r5; } public final void run() { ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$2$ChangePhoneActivity$LoginActivitySmsView(this.f$1, this.f$2, this.f$3, this.f$4); } }); } public /* synthetic */ void lambda$null$2$ChangePhoneActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_auth_resendCode tL_auth_resendCode) { this.nextPressed = false; if (tL_error == null) { ChangePhoneActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject); } else { AlertDialog alertDialog = (AlertDialog) AlertsCreator.processError(ChangePhoneActivity.this.currentAccount, tL_error, ChangePhoneActivity.this, tL_auth_resendCode, new Object[0]); if (alertDialog != null && tL_error.text.contains("PHONE_CODE_EXPIRED")) { alertDialog.setPositiveButtonListener(new DialogInterface.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$6youat5U3k44dTcJwhCBfNIi538 */ public final void onClick(DialogInterface dialogInterface, int i) { ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$1$ChangePhoneActivity$LoginActivitySmsView(dialogInterface, i); } }); } } ChangePhoneActivity.this.needHideProgress(); } public /* synthetic */ void lambda$null$1$ChangePhoneActivity$LoginActivitySmsView(DialogInterface dialogInterface, int i) { onBackPressed(true); ChangePhoneActivity.this.finishFragment(); } @Override // im.guobwnxjuc.ui.components.SlideView public String getHeaderName() { if (this.currentType == 1) { return this.phone; } return LocaleController.getString("YourCode", R.string.YourCode); } @Override // im.guobwnxjuc.ui.components.SlideView public void onCancelPressed() { this.nextPressed = false; } @Override // im.guobwnxjuc.ui.components.SlideView public void setParams(Bundle bundle, boolean z) { int i; int i2; if (bundle != 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 = bundle; this.phone = bundle.getString("phone"); this.emailPhone = bundle.getString("ephone"); this.requestPhone = bundle.getString("phoneFormated"); this.requestHasBlankPhone = bundle.getString("phoneFormatedHasBlank"); this.phoneHash = bundle.getString("phoneHash"); int i4 = bundle.getInt("timeout"); this.time = i4; this.timeout = i4; this.openTime = (int) (System.currentTimeMillis() / 1000); this.nextType = bundle.getInt("nextType"); this.pattern = bundle.getString("pattern"); int i5 = bundle.getInt("length"); this.length = i5; if (i5 == 0) { this.length = 5; } EditTextBoldCursor[] editTextBoldCursorArr = this.codeField; CharSequence charSequence = ""; int i6 = 8; if (editTextBoldCursorArr != null && editTextBoldCursorArr.length == this.length) { int i7 = 0; while (true) { EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField; if (i7 >= editTextBoldCursorArr2.length) { break; } editTextBoldCursorArr2[i7].setText(charSequence); i7++; } } else { this.codeField = new EditTextBoldCursor[this.length]; final int i8 = 0; while (i8 < this.length) { this.codeField[i8] = new EditTextBoldCursor(getContext()); this.codeField[i8].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); this.codeField[i8].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); this.codeField[i8].setCursorSize(AndroidUtilities.dp(20.0f)); this.codeField[i8].setCursorWidth(1.5f); Drawable mutate = getResources().getDrawable(R.drawable.search_dark_activated).mutate(); mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), PorterDuff.Mode.MULTIPLY)); this.codeField[i8].setBackgroundDrawable(mutate); this.codeField[i8].setImeOptions(268435461); this.codeField[i8].setTextSize(1, 20.0f); this.codeField[i8].setMaxLines(1); this.codeField[i8].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.codeField[i8].setPadding(0, 0, 0, 0); this.codeField[i8].setGravity(49); if (this.currentType == 3) { this.codeField[i8].setEnabled(false); this.codeField[i8].setInputType(0); this.codeField[i8].setVisibility(8); } else { this.codeField[i8].setInputType(3); } this.codeFieldContainer.addView(this.codeField[i8], LayoutHelper.createLinear(34, 36, 1, 0, 0, i8 != this.length - 1 ? 7 : 0, 0)); this.codeField[i8].addTextChangedListener(new TextWatcher() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass3 */ public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void afterTextChanged(Editable editable) { int length; if (!LoginActivitySmsView.this.ignoreOnTextChange && (length = editable.length()) >= 1) { if (length > 1) { String obj = editable.toString(); LoginActivitySmsView.this.ignoreOnTextChange = true; for (int i = 0; i < Math.min(LoginActivitySmsView.this.length - i8, length); i++) { if (i == 0) { editable.replace(0, length, obj.substring(i, i + 1)); } else { LoginActivitySmsView.this.codeField[i8 + i].setText(obj.substring(i, i + 1)); } } LoginActivitySmsView.this.ignoreOnTextChange = false; } if (i8 != LoginActivitySmsView.this.length - 1) { LoginActivitySmsView.this.codeField[i8 + 1].setSelection(LoginActivitySmsView.this.codeField[i8 + 1].length()); LoginActivitySmsView.this.codeField[i8 + 1].requestFocus(); } if ((i8 == LoginActivitySmsView.this.length - 1 || (i8 == LoginActivitySmsView.this.length - 2 && length >= 2)) && LoginActivitySmsView.this.getCode().length() == LoginActivitySmsView.this.length) { LoginActivitySmsView.this.onNextPressed(); } } } }); this.codeField[i8].setOnKeyListener(new View.OnKeyListener(i8) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$AC6vcXkI5C5EYZpMnoIYQiQYY5I */ private final /* synthetic */ int f$1; { this.f$1 = r2; } public final boolean onKey(View view, int i, KeyEvent keyEvent) { return ChangePhoneActivity.LoginActivitySmsView.this.lambda$setParams$4$ChangePhoneActivity$LoginActivitySmsView(this.f$1, view, i, keyEvent); } }); this.codeField[i8].setOnEditorActionListener(new TextView.OnEditorActionListener() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$Y3v1DNUgDW0BUPQB3TlU_mmHxE8 */ public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return ChangePhoneActivity.LoginActivitySmsView.this.lambda$setParams$5$ChangePhoneActivity$LoginActivitySmsView(textView, i, keyEvent); } }); i8++; } } ProgressView progressView2 = this.progressView; if (progressView2 != null) { progressView2.setVisibility(this.nextType != 0 ? 0 : 8); } if (this.phone != null) { String format = PhoneFormat.getInstance().format(this.phone); int i9 = this.currentType; if (i9 == 1) { charSequence = AndroidUtilities.replaceTags(LocaleController.getString("SentAppCode", R.string.SentAppCode)); } else if (i9 == 2) { charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(format))); } else if (i9 == 3) { charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(format))); } else if (i9 == 4) { charSequence = AndroidUtilities.replaceTags(LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(format))); } this.confirmTextView.setText(charSequence); if (this.currentType != 3) { AndroidUtilities.showKeyboard(this.codeField[0]); this.codeField[0].requestFocus(); } else { AndroidUtilities.hideKeyboard(this.codeField[0]); } destroyTimer(); destroyCodeTimer(); this.lastCurrentTime = (double) System.currentTimeMillis(); int i10 = this.currentType; if (i10 == 1) { this.problemText.setVisibility(0); this.timeText.setVisibility(8); } else if (i10 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) { this.problemText.setVisibility(8); this.timeText.setVisibility(0); int i11 = this.nextType; if (i11 == 4) { this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0)); } else if (i11 == 2) { this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0)); } createTimer(); } else if (this.currentType == 2 && ((i = this.nextType) == 4 || i == 3)) { this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0)); this.problemText.setVisibility(this.time < 1000 ? 0 : 8); TextView textView = this.timeText; if (this.time >= 1000) { i6 = 0; } textView.setVisibility(i6); 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); TextView textView2 = this.timeText; if (this.time >= 1000) { i6 = 0; } textView2.setVisibility(i6); createTimer(); } else { this.timeText.setVisibility(8); this.problemText.setVisibility(8); createCodeTimer(); } } } } public /* synthetic */ boolean lambda$setParams$4$ChangePhoneActivity$LoginActivitySmsView(int i, View view, int i2, KeyEvent keyEvent) { if (i2 != 67 || this.codeField[i].length() != 0 || i <= 0) { return false; } EditTextBoldCursor[] editTextBoldCursorArr = this.codeField; int i3 = i - 1; editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length()); this.codeField[i3].requestFocus(); this.codeField[i3].dispatchKeyEvent(keyEvent); return true; } public /* synthetic */ boolean lambda$setParams$5$ChangePhoneActivity$LoginActivitySmsView(TextView textView, int i, KeyEvent keyEvent) { if (i != 5) { return false; } onNextPressed(); return true; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void createCodeTimer() { if (this.codeTimer == null) { this.codeTime = 15000; this.codeTimer = new Timer(); this.lastCodeTime = (double) System.currentTimeMillis(); this.codeTimer.schedule(new TimerTask() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass4 */ public void run() { AndroidUtilities.runOnUIThread(new Runnable() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$4$PxjSqaQaLJBV0QaWdi6ROL1vtPg */ public final void run() { ChangePhoneActivity.LoginActivitySmsView.AnonymousClass4.this.lambda$run$0$ChangePhoneActivity$LoginActivitySmsView$4(); } }); } public /* synthetic */ void lambda$run$0$ChangePhoneActivity$LoginActivitySmsView$4() { double currentTimeMillis = (double) System.currentTimeMillis(); double d = LoginActivitySmsView.this.lastCodeTime; Double.isNaN(currentTimeMillis); double d2 = currentTimeMillis - d; LoginActivitySmsView.this.lastCodeTime = currentTimeMillis; LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this; double d3 = (double) loginActivitySmsView.codeTime; Double.isNaN(d3); loginActivitySmsView.codeTime = (int) (d3 - d2); if (LoginActivitySmsView.this.codeTime <= 1000) { LoginActivitySmsView.this.problemText.setVisibility(0); LoginActivitySmsView.this.timeText.setVisibility(8); LoginActivitySmsView.this.destroyCodeTimer(); } } }, 0, 1000); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void destroyCodeTimer() { try { synchronized (this.timerSync) { if (this.codeTimer != null) { this.codeTimer.cancel(); this.codeTimer = null; } } } catch (Exception e) { FileLog.e(e); } } private void createTimer() { if (this.timeTimer == null) { Timer timer = new Timer(); this.timeTimer = timer; timer.schedule(new TimerTask() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass5 */ public void run() { if (LoginActivitySmsView.this.timeTimer != null) { AndroidUtilities.runOnUIThread(new Runnable() { /* class im.guobwnxjuc.ui.ChangePhoneActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1 */ public void run() { double currentTimeMillis = (double) System.currentTimeMillis(); double d = LoginActivitySmsView.this.lastCurrentTime; Double.isNaN(currentTimeMillis); LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this; double d2 = (double) LoginActivitySmsView.this.time; Double.isNaN(d2); loginActivitySmsView.time = (int) (d2 - (currentTimeMillis - d)); LoginActivitySmsView.this.lastCurrentTime = currentTimeMillis; if (LoginActivitySmsView.this.time >= 1000) { int i = (LoginActivitySmsView.this.time / 1000) / 60; int i2 = (LoginActivitySmsView.this.time / 1000) - (i * 60); if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 3) { LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(i), Integer.valueOf(i2))); } else if (LoginActivitySmsView.this.nextType == 2) { LoginActivitySmsView.this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(i), Integer.valueOf(i2))); } if (LoginActivitySmsView.this.progressView != null) { LoginActivitySmsView.this.progressView.setProgress(1.0f - (((float) LoginActivitySmsView.this.time) / ((float) LoginActivitySmsView.this.timeout))); return; } return; } if (LoginActivitySmsView.this.progressView != null) { LoginActivitySmsView.this.progressView.setProgress(1.0f); } LoginActivitySmsView.this.destroyTimer(); if (LoginActivitySmsView.this.currentType == 3) { AndroidUtilities.setWaitingForCall(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall); LoginActivitySmsView.this.waitingForEvent = false; LoginActivitySmsView.this.destroyCodeTimer(); LoginActivitySmsView.this.resendCode(); } else if (LoginActivitySmsView.this.currentType != 2 && LoginActivitySmsView.this.currentType != 4) { } else { if (LoginActivitySmsView.this.nextType == 4 || LoginActivitySmsView.this.nextType == 2) { if (LoginActivitySmsView.this.nextType == 4) { LoginActivitySmsView.this.timeText.setText(LocaleController.getString("Calling", R.string.Calling)); } else { LoginActivitySmsView.this.timeText.setText(LocaleController.getString("SendingSms", R.string.SendingSms)); } LoginActivitySmsView.this.createCodeTimer(); TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode(); tL_auth_resendCode.phone_number = LoginActivitySmsView.this.requestPhone; tL_auth_resendCode.phone_code_hash = LoginActivitySmsView.this.phoneHash; ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$5$1$j6mLrSJXOHb2upPTWIQ2BjO971o */ @Override // im.guobwnxjuc.tgnet.RequestDelegate 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); } else if (LoginActivitySmsView.this.nextType == 3) { AndroidUtilities.setWaitingForSms(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode); LoginActivitySmsView.this.waitingForEvent = false; LoginActivitySmsView.this.destroyCodeTimer(); LoginActivitySmsView.this.resendCode(); } } } public /* synthetic */ void lambda$run$1$ChangePhoneActivity$LoginActivitySmsView$5$1(TLObject tLObject, TLRPC.TL_error tL_error) { if (tL_error != null && tL_error.text != null) { AndroidUtilities.runOnUIThread(new Runnable(tL_error) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$5$1$xuzVpl3ak2pJVIVijnjhGRzyY */ private final /* synthetic */ TLRPC.TL_error f$1; { this.f$1 = r2; } public final void run() { ChangePhoneActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1.this.lambda$null$0$ChangePhoneActivity$LoginActivitySmsView$5$1(this.f$1); } }); } } public /* synthetic */ void lambda$null$0$ChangePhoneActivity$LoginActivitySmsView$5$1(TLRPC.TL_error tL_error) { LoginActivitySmsView.this.lastError = tL_error.text; } }); } } }, 0, 1000); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void destroyTimer() { try { synchronized (this.timerSync) { if (this.timeTimer != null) { this.timeTimer.cancel(); this.timeTimer = null; } } } catch (Exception e) { FileLog.e(e); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private String getCode() { if (this.codeField == null) { return ""; } StringBuilder sb = new StringBuilder(); int i = 0; while (true) { EditTextBoldCursor[] editTextBoldCursorArr = this.codeField; if (i >= editTextBoldCursorArr.length) { return sb.toString(); } sb.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[i].getText().toString())); i++; } } @Override // im.guobwnxjuc.ui.components.SlideView public void onNextPressed() { if (!this.nextPressed) { String code = getCode(); if (TextUtils.isEmpty(code)) { AndroidUtilities.shakeView(this.codeFieldContainer, 2.0f, 0); return; } this.nextPressed = true; int i = this.currentType; if (i == 2) { AndroidUtilities.setWaitingForSms(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode); } else if (i == 3) { AndroidUtilities.setWaitingForCall(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall); } this.waitingForEvent = false; TLRPC.TL_account_changePhone tL_account_changePhone = new TLRPC.TL_account_changePhone(); tL_account_changePhone.phone_number = this.requestHasBlankPhone; tL_account_changePhone.phone_code = code; tL_account_changePhone.phone_code_hash = this.phoneHash; destroyTimer(); ChangePhoneActivity.this.needShowProgress(); ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(tL_account_changePhone, new RequestDelegate(tL_account_changePhone) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$moJ0HDHhbb9A8dWXSA0XNztzBlU */ private final /* synthetic */ TLRPC.TL_account_changePhone f$1; { this.f$1 = r2; } @Override // im.guobwnxjuc.tgnet.RequestDelegate public final void run(TLObject tLObject, TLRPC.TL_error tL_error) { ChangePhoneActivity.LoginActivitySmsView.this.lambda$onNextPressed$7$ChangePhoneActivity$LoginActivitySmsView(this.f$1, tLObject, tL_error); } }, 2); } } public /* synthetic */ void lambda$onNextPressed$7$ChangePhoneActivity$LoginActivitySmsView(TLRPC.TL_account_changePhone tL_account_changePhone, TLObject tLObject, TLRPC.TL_error tL_error) { AndroidUtilities.runOnUIThread(new Runnable(tL_error, tLObject, tL_account_changePhone) { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$DZQLMloMDd8khTEfkH59gEa63w */ private final /* synthetic */ TLRPC.TL_error f$1; private final /* synthetic */ TLObject f$2; private final /* synthetic */ TLRPC.TL_account_changePhone f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void run() { ChangePhoneActivity.LoginActivitySmsView.this.lambda$null$6$ChangePhoneActivity$LoginActivitySmsView(this.f$1, this.f$2, this.f$3); } }); } public /* synthetic */ void lambda$null$6$ChangePhoneActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, TLObject tLObject, TLRPC.TL_account_changePhone tL_account_changePhone) { int i; int i2; ChangePhoneActivity.this.needHideProgress(); this.nextPressed = false; if (tL_error == null) { TLRPC.User user = (TLRPC.User) tLObject; destroyTimer(); destroyCodeTimer(); UserConfig.getInstance(ChangePhoneActivity.this.currentAccount).setCurrentUser(user); UserConfig.getInstance(ChangePhoneActivity.this.currentAccount).saveConfig(true); ArrayList<TLRPC.User> arrayList = new ArrayList<>(); arrayList.add(user); MessagesStorage.getInstance(ChangePhoneActivity.this.currentAccount).putUsersAndChats(arrayList, 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 = tL_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, tL_error, ChangePhoneActivity.this, tL_account_changePhone, new Object[0]); } if (tL_error.text.contains("PHONE_CODE_EMPTY") || tL_error.text.contains("PHONE_CODE_INVALID")) { int i4 = 0; while (true) { EditTextBoldCursor[] editTextBoldCursorArr = this.codeField; if (i4 < editTextBoldCursorArr.length) { editTextBoldCursorArr[i4].setText(""); i4++; } else { editTextBoldCursorArr[0].requestFocus(); return; } } } else if (tL_error.text.contains("PHONE_CODE_EXPIRED")) { onBackPressed(true); ChangePhoneActivity.this.setPage(0, true, null, true); } } @Override // im.guobwnxjuc.ui.components.SlideView public boolean onBackPressed(boolean z) { if (!z) { 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() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$jGokucVsdyRiAYctBxpIfcYwXq4 */ 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 tL_auth_cancelCode = new TLRPC.TL_auth_cancelCode(); tL_auth_cancelCode.phone_number = this.requestPhone; tL_auth_cancelCode.phone_code_hash = this.phoneHash; ConnectionsManager.getInstance(ChangePhoneActivity.this.currentAccount).sendRequest(tL_auth_cancelCode, $$Lambda$ChangePhoneActivity$LoginActivitySmsView$xHTwJ6TTrEFCiXKwUlgVCJQUiP0.INSTANCE, 10); destroyTimer(); destroyCodeTimer(); this.currentParams = null; int i = this.currentType; if (i == 2) { AndroidUtilities.setWaitingForSms(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode); } else if (i == 3) { AndroidUtilities.setWaitingForCall(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall); } this.waitingForEvent = false; return true; } public /* synthetic */ void lambda$onBackPressed$8$ChangePhoneActivity$LoginActivitySmsView(DialogInterface dialogInterface, int i) { onBackPressed(true); ChangePhoneActivity.this.setPage(0, true, null, true); } @Override // im.guobwnxjuc.ui.components.SlideView public void onDestroyActivity() { super.onDestroyActivity(); int i = this.currentType; if (i == 2) { AndroidUtilities.setWaitingForSms(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode); } else if (i == 3) { AndroidUtilities.setWaitingForCall(false); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall); } this.waitingForEvent = false; destroyTimer(); destroyCodeTimer(); } @Override // im.guobwnxjuc.ui.components.SlideView public void onShow() { super.onShow(); if (this.currentType != 3) { AndroidUtilities.runOnUIThread(new Runnable() { /* class im.guobwnxjuc.ui.$$Lambda$ChangePhoneActivity$LoginActivitySmsView$hZDyyKhoWdLgdYu_haMg2u8_5F8 */ public final void run() { ChangePhoneActivity.LoginActivitySmsView.this.lambda$onShow$10$ChangePhoneActivity$LoginActivitySmsView(); } }, 100); } } public /* synthetic */ void lambda$onShow$10$ChangePhoneActivity$LoginActivitySmsView() { EditTextBoldCursor[] editTextBoldCursorArr = this.codeField; if (editTextBoldCursorArr != null) { for (int length2 = editTextBoldCursorArr.length - 1; length2 >= 0; length2--) { if (length2 == 0 || this.codeField[length2].length() != 0) { this.codeField[length2].requestFocus(); EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField; editTextBoldCursorArr2[length2].setSelection(editTextBoldCursorArr2[length2].length()); AndroidUtilities.showKeyboard(this.codeField[length2]); return; } } } } @Override // im.guobwnxjuc.messenger.NotificationCenter.NotificationCenterDelegate public void didReceivedNotification(int i, int i2, Object... objArr) { if (this.waitingForEvent && this.codeField != null) { if (i == NotificationCenter.didReceiveSmsCode) { this.codeField[0].setText("" + objArr[0]); onNextPressed(); } else if (i == NotificationCenter.didReceiveCall) { String str = "" + objArr[0]; if (AndroidUtilities.checkPhonePattern(this.pattern, str)) { this.ignoreOnTextChange = true; this.codeField[0].setText(str); this.ignoreOnTextChange = false; onNextPressed(); } } } } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public ThemeDescription[] getThemeDescriptions() { SlideView[] slideViewArr = this.views; PhoneView phoneView = (PhoneView) slideViewArr[0]; LoginActivitySmsView loginActivitySmsView = (LoginActivitySmsView) slideViewArr[1]; LoginActivitySmsView loginActivitySmsView2 = (LoginActivitySmsView) slideViewArr[2]; LoginActivitySmsView loginActivitySmsView3 = (LoginActivitySmsView) slideViewArr[3]; LoginActivitySmsView loginActivitySmsView4 = (LoginActivitySmsView) slideViewArr[4]; ArrayList arrayList = new ArrayList(); arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite)); arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault)); arrayList.add(new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault)); arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon)); arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle)); arrayList.add(new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector)); arrayList.add(new ThemeDescription(phoneView.countryButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(phoneView.view, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhiteGrayLine)); arrayList.add(new ThemeDescription(phoneView.textView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField)); arrayList.add(new ThemeDescription(phoneView.codeField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText)); arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField)); arrayList.add(new ThemeDescription(phoneView.phoneField, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); arrayList.add(new ThemeDescription(phoneView.textView2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); if (loginActivitySmsView.codeField != null) { for (int i = 0; i < loginActivitySmsView.codeField.length; i++) { arrayList.add(new ThemeDescription(loginActivitySmsView.codeField[i], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView.codeField[i], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(loginActivitySmsView.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4)); arrayList.add(new ThemeDescription(loginActivitySmsView.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner)); arrayList.add(new ThemeDescription(loginActivitySmsView.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter)); arrayList.add(new ThemeDescription(loginActivitySmsView.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground)); arrayList.add(new ThemeDescription(loginActivitySmsView2.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView2.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); if (loginActivitySmsView2.codeField != null) { for (int i2 = 0; i2 < loginActivitySmsView2.codeField.length; i2++) { arrayList.add(new ThemeDescription(loginActivitySmsView2.codeField[i2], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView2.codeField[i2], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(loginActivitySmsView2.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView2.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4)); arrayList.add(new ThemeDescription(loginActivitySmsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner)); arrayList.add(new ThemeDescription(loginActivitySmsView2.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter)); arrayList.add(new ThemeDescription(loginActivitySmsView2.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView2.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground)); arrayList.add(new ThemeDescription(loginActivitySmsView3.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView3.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); if (loginActivitySmsView3.codeField != null) { for (int i3 = 0; i3 < loginActivitySmsView3.codeField.length; i3++) { arrayList.add(new ThemeDescription(loginActivitySmsView3.codeField[i3], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView3.codeField[i3], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(loginActivitySmsView3.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView3.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4)); arrayList.add(new ThemeDescription(loginActivitySmsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner)); arrayList.add(new ThemeDescription(loginActivitySmsView3.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter)); arrayList.add(new ThemeDescription(loginActivitySmsView3.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView3.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground)); arrayList.add(new ThemeDescription(loginActivitySmsView4.confirmTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView4.titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); if (loginActivitySmsView4.codeField != null) { for (int i4 = 0; i4 < loginActivitySmsView4.codeField.length; i4++) { arrayList.add(new ThemeDescription(loginActivitySmsView4.codeField[i4], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView4.codeField[i4], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated)); } } arrayList.add(new ThemeDescription(loginActivitySmsView4.timeText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6)); arrayList.add(new ThemeDescription(loginActivitySmsView4.problemText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueText4)); arrayList.add(new ThemeDescription(loginActivitySmsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressInner)); arrayList.add(new ThemeDescription(loginActivitySmsView4.progressView, 0, new Class[]{ProgressView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_login_progressOuter)); arrayList.add(new ThemeDescription(loginActivitySmsView4.blackImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText)); arrayList.add(new ThemeDescription(loginActivitySmsView4.blueImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionBackground)); return (ThemeDescription[]) arrayList.toArray(new ThemeDescription[0]); } }