ZஜZ v2.7.0版本的 MD5 值为:1bef67e030daecb0566ac755017d6792
以下内容为反编译后的 CancelAccountDeletionActivity.java 源代码,内容仅作参考
package im.jpgxbngtig.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.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.blankj.utilcode.constant.TimeConstants;
import im.jpgxbngtig.messenger.AndroidUtilities;
import im.jpgxbngtig.messenger.ApplicationLoader;
import im.jpgxbngtig.messenger.BuildVars;
import im.jpgxbngtig.messenger.FileLog;
import im.jpgxbngtig.messenger.LocaleController;
import im.jpgxbngtig.messenger.NotificationCenter;
import im.jpgxbngtig.messenger.R;
import im.jpgxbngtig.phoneformat.PhoneFormat;
import im.jpgxbngtig.tgnet.ConnectionsManager;
import im.jpgxbngtig.tgnet.RequestDelegate;
import im.jpgxbngtig.tgnet.TLObject;
import im.jpgxbngtig.tgnet.TLRPC;
import im.jpgxbngtig.ui.CancelAccountDeletionActivity;
import im.jpgxbngtig.ui.actionbar.ActionBar;
import im.jpgxbngtig.ui.actionbar.ActionBarMenuItem;
import im.jpgxbngtig.ui.actionbar.AlertDialog;
import im.jpgxbngtig.ui.actionbar.BaseFragment;
import im.jpgxbngtig.ui.actionbar.Theme;
import im.jpgxbngtig.ui.actionbar.ThemeDescription;
import im.jpgxbngtig.ui.components.AlertsCreator;
import im.jpgxbngtig.ui.components.EditTextBoldCursor;
import im.jpgxbngtig.ui.components.LayoutHelper;
import im.jpgxbngtig.ui.components.RadialProgressView;
import im.jpgxbngtig.ui.components.SlideView;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import org.slf4j.Marker;
public class CancelAccountDeletionActivity extends BaseFragment {
private static final int done_button = 1;
private boolean checkPermissions;
private int currentViewNum;
private View doneButton;
private Dialog errorDialog;
private String hash;
private Dialog permissionsDialog;
private ArrayList<String> permissionsItems;
private String phone;
private AlertDialog progressDialog;
private int scrollHeight;
private SlideView[] views;
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 f) {
this.progress = f;
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
float measuredWidth = (int) (getMeasuredWidth() * this.progress);
canvas.drawRect(0.0f, 0.0f, measuredWidth, getMeasuredHeight(), this.paint2);
canvas.drawRect(measuredWidth, 0.0f, getMeasuredWidth(), getMeasuredHeight(), this.paint);
}
}
public CancelAccountDeletionActivity(Bundle bundle) {
super(bundle);
this.currentViewNum = 0;
this.views = new SlideView[5];
this.permissionsItems = new ArrayList<>();
this.checkPermissions = false;
this.hash = bundle.getString("hash");
this.phone = bundle.getString("phone");
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
int i = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (i >= slideViewArr.length) {
break;
}
if (slideViewArr[i] != null) {
slideViewArr[i].onDestroyActivity();
}
i++;
}
AlertDialog alertDialog = this.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 i) {
if (i == 1) {
CancelAccountDeletionActivity.this.views[CancelAccountDeletionActivity.this.currentViewNum].onNextPressed();
} else if (i == -1) {
CancelAccountDeletionActivity.this.finishFragment();
}
}
});
ActionBarMenuItem addItemWithWidth = this.actionBar.createMenu().addItemWithWidth(1, R.drawable.ic_done, AndroidUtilities.dp(56.0f));
this.doneButton = addItemWithWidth;
addItemWithWidth.setVisibility(8);
ScrollView scrollView = new ScrollView(context) {
@Override
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
if (CancelAccountDeletionActivity.this.currentViewNum == 1 || CancelAccountDeletionActivity.this.currentViewNum == 2 || CancelAccountDeletionActivity.this.currentViewNum == 4) {
rect.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(view, rect, z);
}
@Override
protected void onMeasure(int i, int i2) {
CancelAccountDeletionActivity.this.scrollHeight = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
super.onMeasure(i, i2);
}
};
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 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
public void onResume() {
super.onResume();
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
}
@Override
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();
}
}
}
@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);
}
if (dialog == this.errorDialog) {
finishFragment();
}
}
@Override
public boolean onBackPressed() {
int i = 0;
while (true) {
SlideView[] slideViewArr = this.views;
if (i >= slideViewArr.length) {
return true;
}
if (slideViewArr[i] != null) {
slideViewArr[i].onDestroyActivity();
}
i++;
}
}
@Override
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) {
return;
}
AlertDialog alertDialog = new AlertDialog(getParentActivity(), 3);
this.progressDialog = alertDialog;
alertDialog.setCanCancel(false);
this.progressDialog.show();
}
public void needHideProgress() {
AlertDialog alertDialog = this.progressDialog;
if (alertDialog == null) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
this.progressDialog = null;
}
public void setPage(int i, boolean z, Bundle bundle, boolean z2) {
if (i == 3 || i == 0) {
this.doneButton.setVisibility(8);
} else {
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(i2);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.setDuration(300L);
Animator[] animatorArr = new Animator[2];
float[] fArr = new float[1];
fArr[0] = 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() {
@Override
public void onAnimationStart(Animator animator) {
slideView2.setVisibility(0);
}
@Override
public void onAnimationEnd(Animator animator) {
slideView.setVisibility(8);
slideView.setX(0.0f);
}
});
animatorSet.start();
}
public 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 {
private boolean nextPressed;
private RadialProgressView progressBar;
public PhoneView(Context context) {
super(context);
this.nextPressed = false;
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, LayoutHelper.createLinear(-1, ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION));
RadialProgressView radialProgressView = new RadialProgressView(context);
this.progressBar = radialProgressView;
frameLayout.addView(radialProgressView, LayoutHelper.createFrame(-2, -2, 17));
}
@Override
public void onNextPressed() {
if (CancelAccountDeletionActivity.this.getParentActivity() == null || this.nextPressed) {
return;
}
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
if (telephonyManager.getSimState() != 1) {
telephonyManager.getPhoneType();
}
int i = Build.VERSION.SDK_INT;
final TLRPC.TL_account_sendConfirmPhoneCode tL_account_sendConfirmPhoneCode = new TLRPC.TL_account_sendConfirmPhoneCode();
tL_account_sendConfirmPhoneCode.hash = CancelAccountDeletionActivity.this.hash;
tL_account_sendConfirmPhoneCode.settings = new TLRPC.TL_codeSettings();
tL_account_sendConfirmPhoneCode.settings.allow_flashcall = false;
tL_account_sendConfirmPhoneCode.settings.allow_app_hash = ApplicationLoader.hasPlayServices;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
if (tL_account_sendConfirmPhoneCode.settings.allow_app_hash) {
sharedPreferences.edit().putString("sms_hash", BuildVars.SMS_HASH).commit();
} else {
sharedPreferences.edit().remove("sms_hash").commit();
}
if (tL_account_sendConfirmPhoneCode.settings.allow_flashcall) {
try {
String line1Number = telephonyManager.getLine1Number();
if (!TextUtils.isEmpty(line1Number)) {
tL_account_sendConfirmPhoneCode.settings.current_number = PhoneNumberUtils.compare(CancelAccountDeletionActivity.this.phone, line1Number);
if (!tL_account_sendConfirmPhoneCode.settings.current_number) {
tL_account_sendConfirmPhoneCode.settings.allow_flashcall = false;
}
} else {
tL_account_sendConfirmPhoneCode.settings.current_number = false;
}
} catch (Exception e) {
tL_account_sendConfirmPhoneCode.settings.allow_flashcall = false;
FileLog.e(e);
}
}
final Bundle bundle = new Bundle();
bundle.putString("phone", CancelAccountDeletionActivity.this.phone);
this.nextPressed = true;
ConnectionsManager.getInstance(CancelAccountDeletionActivity.this.currentAccount).sendRequest(tL_account_sendConfirmPhoneCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
CancelAccountDeletionActivity.PhoneView.this.lambda$onNextPressed$1$CancelAccountDeletionActivity$PhoneView(bundle, tL_account_sendConfirmPhoneCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$1$CancelAccountDeletionActivity$PhoneView(final Bundle bundle, final TLRPC.TL_account_sendConfirmPhoneCode tL_account_sendConfirmPhoneCode, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CancelAccountDeletionActivity.PhoneView.this.lambda$null$0$CancelAccountDeletionActivity$PhoneView(tL_error, bundle, tLObject, tL_account_sendConfirmPhoneCode);
}
});
}
public void lambda$null$0$CancelAccountDeletionActivity$PhoneView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_account_sendConfirmPhoneCode tL_account_sendConfirmPhoneCode) {
this.nextPressed = false;
if (tL_error == null) {
CancelAccountDeletionActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject);
} else {
CancelAccountDeletionActivity cancelAccountDeletionActivity = CancelAccountDeletionActivity.this;
cancelAccountDeletionActivity.errorDialog = AlertsCreator.processError(cancelAccountDeletionActivity.currentAccount, tL_error, CancelAccountDeletionActivity.this, tL_account_sendConfirmPhoneCode, new Object[0]);
}
}
@Override
public String getHeaderName() {
return LocaleController.getString("CancelAccountReset", R.string.CancelAccountReset);
}
@Override
public void onShow() {
super.onShow();
onNextPressed();
}
}
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 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 int time;
private TextView timeText;
private Timer timeTimer;
private int timeout;
private final Object timerSync;
private TextView titleTextView;
private boolean waitingForEvent;
@Override
public boolean needBackButton() {
return true;
}
public LoginActivitySmsView(Context context, int i) {
super(context);
this.timerSync = new Object();
this.time = TimeConstants.MIN;
this.codeTime = 15000;
this.lastError = "";
this.pattern = "*";
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(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 i2, int i3) {
super.onMeasure(i2, 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 i2, int i3) {
super.onMeasure(i2, 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) {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$new$0$CancelAccountDeletionActivity$LoginActivitySmsView(view);
}
});
}
public void lambda$new$0$CancelAccountDeletionActivity$LoginActivitySmsView(View view) {
if (this.nextPressed) {
return;
}
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 cancel account deletion issue " + format + " " + this.phone);
intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.phone + "\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(CancelAccountDeletionActivity.this, LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
}
}
@Override
protected void onMeasure(int i, int i2) {
ImageView imageView;
super.onMeasure(i, i2);
if (this.currentType == 3 || (imageView = this.blueImageView) == null) {
return;
}
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 (CancelAccountDeletionActivity.this.scrollHeight - measuredHeight >= dp) {
if (CancelAccountDeletionActivity.this.scrollHeight <= dp2) {
setMeasuredDimension(getMeasuredWidth(), CancelAccountDeletionActivity.this.scrollHeight);
return;
} else {
setMeasuredDimension(getMeasuredWidth(), dp2);
return;
}
}
setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
}
@Override
protected 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) {
return;
}
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);
}
public void resendCode() {
final Bundle bundle = new Bundle();
bundle.putString("phone", this.phone);
this.nextPressed = true;
CancelAccountDeletionActivity.this.needShowProgress();
final TLRPC.TL_auth_resendCode tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
tL_auth_resendCode.phone_number = this.phone;
tL_auth_resendCode.phone_code_hash = this.phoneHash;
ConnectionsManager.getInstance(CancelAccountDeletionActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$resendCode$3$CancelAccountDeletionActivity$LoginActivitySmsView(bundle, tL_auth_resendCode, tLObject, tL_error);
}
}, 2);
}
public void lambda$resendCode$3$CancelAccountDeletionActivity$LoginActivitySmsView(final Bundle bundle, final TLRPC.TL_auth_resendCode tL_auth_resendCode, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$null$2$CancelAccountDeletionActivity$LoginActivitySmsView(tL_error, bundle, tLObject, tL_auth_resendCode);
}
});
}
public void lambda$null$2$CancelAccountDeletionActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, Bundle bundle, TLObject tLObject, TLRPC.TL_auth_resendCode tL_auth_resendCode) {
AlertDialog alertDialog;
this.nextPressed = false;
if (tL_error == null) {
CancelAccountDeletionActivity.this.fillNextCodeParams(bundle, (TLRPC.TL_auth_sentCode) tLObject);
} else if (tL_error.text != null && (alertDialog = (AlertDialog) AlertsCreator.processError(CancelAccountDeletionActivity.this.currentAccount, tL_error, CancelAccountDeletionActivity.this, tL_auth_resendCode, new Object[0])) != null && tL_error.text.contains("PHONE_CODE_EXPIRED")) {
alertDialog.setPositiveButtonListener(new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$null$1$CancelAccountDeletionActivity$LoginActivitySmsView(dialogInterface, i);
}
});
}
CancelAccountDeletionActivity.this.needHideProgress();
}
public void lambda$null$1$CancelAccountDeletionActivity$LoginActivitySmsView(DialogInterface dialogInterface, int i) {
onBackPressed(true);
CancelAccountDeletionActivity.this.finishFragment();
}
@Override
public String getHeaderName() {
if (this.currentType == 1) {
return this.phone;
}
return LocaleController.getString("CancelAccountReset", R.string.CancelAccountReset);
}
@Override
public void setParams(Bundle bundle, boolean z) {
int i;
int i2;
if (bundle == null) {
return;
}
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.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;
if (editTextBoldCursorArr != null && editTextBoldCursorArr.length == this.length) {
int i6 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
if (i6 >= editTextBoldCursorArr2.length) {
break;
}
editTextBoldCursorArr2[i6].setText("");
i6++;
}
} else {
this.codeField = new EditTextBoldCursor[this.length];
final int i7 = 0;
while (i7 < this.length) {
this.codeField[i7] = new EditTextBoldCursor(getContext());
this.codeField[i7].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[i7].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.codeField[i7].setCursorSize(AndroidUtilities.dp(20.0f));
this.codeField[i7].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[i7].setBackgroundDrawable(mutate);
this.codeField[i7].setImeOptions(268435461);
this.codeField[i7].setTextSize(1, 20.0f);
this.codeField[i7].setMaxLines(1);
this.codeField[i7].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.codeField[i7].setPadding(0, 0, 0, 0);
this.codeField[i7].setGravity(49);
if (this.currentType == 3) {
this.codeField[i7].setEnabled(false);
this.codeField[i7].setInputType(0);
this.codeField[i7].setVisibility(8);
} else {
this.codeField[i7].setInputType(3);
}
this.codeFieldContainer.addView(this.codeField[i7], LayoutHelper.createLinear(34, 36, 1, 0, 0, i7 != this.length - 1 ? 7 : 0, 0));
this.codeField[i7].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
}
@Override
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 i8 = 0; i8 < Math.min(LoginActivitySmsView.this.length - i7, length); i8++) {
if (i8 != 0) {
LoginActivitySmsView.this.codeField[i7 + i8].setText(obj.substring(i8, i8 + 1));
} else {
editable.replace(0, length, obj.substring(i8, i8 + 1));
}
}
LoginActivitySmsView.this.ignoreOnTextChange = false;
}
if (i7 != LoginActivitySmsView.this.length - 1) {
LoginActivitySmsView.this.codeField[i7 + 1].setSelection(LoginActivitySmsView.this.codeField[i7 + 1].length());
LoginActivitySmsView.this.codeField[i7 + 1].requestFocus();
}
if ((i7 == LoginActivitySmsView.this.length - 1 || (i7 == LoginActivitySmsView.this.length - 2 && length >= 2)) && LoginActivitySmsView.this.getCode().length() == LoginActivitySmsView.this.length) {
LoginActivitySmsView.this.onNextPressed();
}
}
}
});
this.codeField[i7].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i8, KeyEvent keyEvent) {
return CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$setParams$4$CancelAccountDeletionActivity$LoginActivitySmsView(i7, view, i8, keyEvent);
}
});
this.codeField[i7].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i8, KeyEvent keyEvent) {
return CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$setParams$5$CancelAccountDeletionActivity$LoginActivitySmsView(textView, i8, keyEvent);
}
});
i7++;
}
}
ProgressView progressView = this.progressView;
if (progressView != null) {
progressView.setVisibility(this.nextType != 0 ? 0 : 8);
}
if (this.phone == null) {
return;
}
String format = PhoneFormat.getInstance().format(this.phone);
this.confirmTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("CancelAccountResetInfo", R.string.CancelAccountResetInfo, PhoneFormat.getInstance().format(Marker.ANY_NON_NULL_MARKER + format))));
if (this.currentType != 3) {
AndroidUtilities.showKeyboard(this.codeField[0]);
this.codeField[0].requestFocus();
} else {
AndroidUtilities.hideKeyboard(this.codeField[0]);
}
destroyTimer();
destroyCodeTimer();
this.lastCurrentTime = System.currentTimeMillis();
int i8 = this.currentType;
if (i8 == 1) {
this.problemText.setVisibility(0);
this.timeText.setVisibility(8);
return;
}
if (i8 == 3 && ((i2 = this.nextType) == 4 || i2 == 2)) {
this.problemText.setVisibility(8);
this.timeText.setVisibility(0);
int i9 = this.nextType;
if (i9 == 4) {
this.timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
} else if (i9 == 2) {
this.timeText.setText(LocaleController.formatString("SmsText", R.string.SmsText, 1, 0));
}
createTimer();
return;
}
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 ? 0 : 8);
createTimer();
return;
}
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 ? 0 : 8);
createTimer();
return;
}
this.timeText.setVisibility(8);
this.problemText.setVisibility(8);
createCodeTimer();
}
public boolean lambda$setParams$4$CancelAccountDeletionActivity$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 boolean lambda$setParams$5$CancelAccountDeletionActivity$LoginActivitySmsView(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
onNextPressed();
return true;
}
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() {
CancelAccountDeletionActivity.LoginActivitySmsView.AnonymousClass4.this.lambda$run$0$CancelAccountDeletionActivity$LoginActivitySmsView$4();
}
});
}
public void lambda$run$0$CancelAccountDeletionActivity$LoginActivitySmsView$4() {
double currentTimeMillis = System.currentTimeMillis();
double d = LoginActivitySmsView.this.lastCodeTime;
Double.isNaN(currentTimeMillis);
double d2 = currentTimeMillis - d;
LoginActivitySmsView.this.lastCodeTime = currentTimeMillis;
LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this;
double d3 = 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();
}
}
}
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 currentTimeMillis = System.currentTimeMillis();
double d = LoginActivitySmsView.this.lastCurrentTime;
Double.isNaN(currentTimeMillis);
LoginActivitySmsView loginActivitySmsView = LoginActivitySmsView.this;
double d2 = 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 - (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 tL_auth_resendCode = new TLRPC.TL_auth_resendCode();
tL_auth_resendCode.phone_number = LoginActivitySmsView.this.phone;
tL_auth_resendCode.phone_code_hash = LoginActivitySmsView.this.phoneHash;
ConnectionsManager.getInstance(CancelAccountDeletionActivity.this.currentAccount).sendRequest(tL_auth_resendCode, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
CancelAccountDeletionActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1.this.lambda$run$1$CancelAccountDeletionActivity$LoginActivitySmsView$5$1(tLObject, tL_error);
}
}, 2);
return;
}
if (LoginActivitySmsView.this.nextType == 3) {
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
LoginActivitySmsView.this.waitingForEvent = false;
LoginActivitySmsView.this.destroyCodeTimer();
LoginActivitySmsView.this.resendCode();
return;
}
return;
}
return;
}
AndroidUtilities.setWaitingForCall(false);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didReceiveCall);
LoginActivitySmsView.this.waitingForEvent = false;
LoginActivitySmsView.this.destroyCodeTimer();
LoginActivitySmsView.this.resendCode();
}
public void lambda$run$1$CancelAccountDeletionActivity$LoginActivitySmsView$5$1(TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tL_error == null || tL_error.text == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CancelAccountDeletionActivity.LoginActivitySmsView.AnonymousClass5.AnonymousClass1.this.lambda$null$0$CancelAccountDeletionActivity$LoginActivitySmsView$5$1(tL_error);
}
});
}
public void lambda$null$0$CancelAccountDeletionActivity$LoginActivitySmsView$5$1(TLRPC.TL_error tL_error) {
LoginActivitySmsView.this.lastError = tL_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 sb = new StringBuilder();
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i < editTextBoldCursorArr.length) {
sb.append(PhoneFormat.stripExceptNumbers(editTextBoldCursorArr[i].getText().toString()));
i++;
} else {
return sb.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_confirmPhone tL_account_confirmPhone = new TLRPC.TL_account_confirmPhone();
tL_account_confirmPhone.phone_code = code;
tL_account_confirmPhone.phone_code_hash = this.phoneHash;
destroyTimer();
CancelAccountDeletionActivity.this.needShowProgress();
ConnectionsManager.getInstance(CancelAccountDeletionActivity.this.currentAccount).sendRequest(tL_account_confirmPhone, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$onNextPressed$7$CancelAccountDeletionActivity$LoginActivitySmsView(tL_account_confirmPhone, tLObject, tL_error);
}
}, 2);
}
public void lambda$onNextPressed$7$CancelAccountDeletionActivity$LoginActivitySmsView(final TLRPC.TL_account_confirmPhone tL_account_confirmPhone, TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$null$6$CancelAccountDeletionActivity$LoginActivitySmsView(tL_error, tL_account_confirmPhone);
}
});
}
public void lambda$null$6$CancelAccountDeletionActivity$LoginActivitySmsView(TLRPC.TL_error tL_error, TLRPC.TL_account_confirmPhone tL_account_confirmPhone) {
int i;
int i2;
CancelAccountDeletionActivity.this.needHideProgress();
this.nextPressed = false;
if (tL_error == null) {
CancelAccountDeletionActivity cancelAccountDeletionActivity = CancelAccountDeletionActivity.this;
cancelAccountDeletionActivity.errorDialog = AlertsCreator.showSimpleAlert(cancelAccountDeletionActivity, LocaleController.formatString("CancelLinkSuccess", R.string.CancelLinkSuccess, PhoneFormat.getInstance().format(Marker.ANY_NON_NULL_MARKER + this.phone)));
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(CancelAccountDeletionActivity.this.currentAccount, tL_error, CancelAccountDeletionActivity.this, tL_account_confirmPhone, new Object[0]);
}
if (!tL_error.text.contains("PHONE_CODE_EMPTY") && !tL_error.text.contains("PHONE_CODE_INVALID")) {
if (tL_error.text.contains("PHONE_CODE_EXPIRED")) {
onBackPressed(true);
CancelAccountDeletionActivity.this.setPage(0, true, null, true);
return;
}
return;
}
int i4 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (i4 < editTextBoldCursorArr.length) {
editTextBoldCursorArr[i4].setText("");
i4++;
} else {
editTextBoldCursorArr[0].requestFocus();
return;
}
}
}
@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() {
CancelAccountDeletionActivity.LoginActivitySmsView.this.lambda$onShow$8$CancelAccountDeletionActivity$LoginActivitySmsView();
}
}, 100L);
}
public void lambda$onShow$8$CancelAccountDeletionActivity$LoginActivitySmsView() {
EditTextBoldCursor[] editTextBoldCursorArr = this.codeField;
if (editTextBoldCursorArr != null) {
for (int length = editTextBoldCursorArr.length - 1; length >= 0; length--) {
if (length == 0 || this.codeField[length].length() != 0) {
this.codeField[length].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr2 = this.codeField;
editTextBoldCursorArr2[length].setSelection(editTextBoldCursorArr2[length].length());
AndroidUtilities.showKeyboard(this.codeField[length]);
return;
}
}
}
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (!this.waitingForEvent || this.codeField == null) {
return;
}
if (i == NotificationCenter.didReceiveSmsCode) {
this.codeField[0].setText("" + objArr[0]);
onNextPressed();
return;
}
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
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.progressBar, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
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]);
}
}