正在查看: Plus 12 v10.13.1.1 应用的 ProxySettingsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 ProxySettingsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.transition.ChangeBounds;
import android.transition.Fade;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.transition.TransitionSet;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.RadioCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.QRCodeBottomSheet;
import org.telegram.ui.Components.RLottieDrawable;
public class ProxySettingsActivity extends BaseFragment {
public boolean addingNewProxy;
public TextInfoPrivacyCell[] bottomCells;
public ClipboardManager.OnPrimaryClipChangedListener clipChangedListener;
public ClipboardManager clipboardManager;
public SharedConfig.ProxyInfo currentProxyInfo;
public int currentType;
public ActionBarMenuItem doneItem;
public HeaderCell headerCell;
public boolean ignoreOnTextChange;
public EditTextBoldCursor[] inputFields;
public LinearLayout inputFieldsContainer;
public LinearLayout linearLayout2;
public TextSettingsCell pasteCell;
public String[] pasteFields;
public String pasteString;
public int pasteType;
public ScrollView scrollView;
public ShadowSectionCell[] sectionCell;
public TextSettingsCell shareCell;
public ValueAnimator shareDoneAnimator;
public boolean shareDoneEnabled;
public float shareDoneProgress;
public float[] shareDoneProgressAnimValues;
public RadioCell[] typeCell;
public ProxySettingsActivity() {
this.sectionCell = new ShadowSectionCell[3];
this.bottomCells = new TextInfoPrivacyCell[2];
this.typeCell = new RadioCell[2];
this.currentType = -1;
this.pasteType = -1;
this.shareDoneProgress = 1.0f;
this.shareDoneProgressAnimValues = new float[2];
this.shareDoneEnabled = true;
this.clipChangedListener = new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public final void onPrimaryClipChanged() {
ProxySettingsActivity.this.updatePasteCell();
}
};
this.currentProxyInfo = new SharedConfig.ProxyInfo("", 1080, "", "", "");
this.addingNewProxy = true;
}
public ProxySettingsActivity(SharedConfig.ProxyInfo proxyInfo) {
this.sectionCell = new ShadowSectionCell[3];
this.bottomCells = new TextInfoPrivacyCell[2];
this.typeCell = new RadioCell[2];
this.currentType = -1;
this.pasteType = -1;
this.shareDoneProgress = 1.0f;
this.shareDoneProgressAnimValues = new float[2];
this.shareDoneEnabled = true;
this.clipChangedListener = new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public final void onPrimaryClipChanged() {
ProxySettingsActivity.this.updatePasteCell();
}
};
this.currentProxyInfo = proxyInfo;
}
public void onResume() {
super.onResume();
AndroidUtilities.requestAdjustResize(getParentActivity(), ((BaseFragment) this).classGuid);
this.clipboardManager.addPrimaryClipChangedListener(this.clipChangedListener);
updatePasteCell();
}
public void onPause() {
super.onPause();
this.clipboardManager.removePrimaryClipChangedListener(this.clipChangedListener);
}
public View createView(final Context context) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ProxyDetails", R.string.ProxyDetails));
((BaseFragment) this).actionBar.setBackButtonImage(R.drawable.ic_ab_back);
((BaseFragment) this).actionBar.setAllowOverlayTitle(false);
if (AndroidUtilities.isTablet()) {
((BaseFragment) this).actionBar.setOccupyStatusBar(false);
}
((BaseFragment) this).actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
boolean z;
if (id == -1) {
ProxySettingsActivity.this.finishFragment();
return;
}
if (id != 1 || ProxySettingsActivity.this.getParentActivity() == null) {
return;
}
ProxySettingsActivity.this.currentProxyInfo.address = ProxySettingsActivity.this.inputFields[0].getText().toString();
ProxySettingsActivity.this.currentProxyInfo.port = Utilities.parseInt(ProxySettingsActivity.this.inputFields[1].getText().toString()).intValue();
if (ProxySettingsActivity.this.currentType == 0) {
ProxySettingsActivity.this.currentProxyInfo.secret = "";
ProxySettingsActivity.this.currentProxyInfo.username = ProxySettingsActivity.this.inputFields[2].getText().toString();
ProxySettingsActivity.this.currentProxyInfo.password = ProxySettingsActivity.this.inputFields[3].getText().toString();
} else {
ProxySettingsActivity.this.currentProxyInfo.secret = ProxySettingsActivity.this.inputFields[4].getText().toString();
ProxySettingsActivity.this.currentProxyInfo.username = "";
ProxySettingsActivity.this.currentProxyInfo.password = "";
}
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor edit = globalMainSettings.edit();
if (ProxySettingsActivity.this.addingNewProxy) {
SharedConfig.addProxy(ProxySettingsActivity.this.currentProxyInfo);
SharedConfig.currentProxy = ProxySettingsActivity.this.currentProxyInfo;
edit.putBoolean("proxy_enabled", true);
z = true;
} else {
boolean z2 = globalMainSettings.getBoolean("proxy_enabled", false);
SharedConfig.saveProxyList();
z = z2;
}
if (ProxySettingsActivity.this.addingNewProxy || SharedConfig.currentProxy == ProxySettingsActivity.this.currentProxyInfo) {
edit.putString("proxy_ip", ProxySettingsActivity.this.currentProxyInfo.address);
edit.putString("proxy_pass", ProxySettingsActivity.this.currentProxyInfo.password);
edit.putString("proxy_user", ProxySettingsActivity.this.currentProxyInfo.username);
edit.putInt("proxy_port", ProxySettingsActivity.this.currentProxyInfo.port);
edit.putString("proxy_secret", ProxySettingsActivity.this.currentProxyInfo.secret);
ConnectionsManager.setProxySettings(z, ProxySettingsActivity.this.currentProxyInfo.address, ProxySettingsActivity.this.currentProxyInfo.port, ProxySettingsActivity.this.currentProxyInfo.username, ProxySettingsActivity.this.currentProxyInfo.password, ProxySettingsActivity.this.currentProxyInfo.secret);
}
edit.commit();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged, new Object[0]);
ProxySettingsActivity.this.finishFragment();
}
});
ActionBarMenuItem addItemWithWidth = ((BaseFragment) this).actionBar.createMenu().addItemWithWidth(1, R.drawable.ic_ab_done, AndroidUtilities.dp(56.0f));
this.doneItem = addItemWithWidth;
addItemWithWidth.setContentDescription(LocaleController.getString("Done", R.string.Done));
FrameLayout frameLayout = new FrameLayout(context);
((BaseFragment) this).fragmentView = frameLayout;
FrameLayout frameLayout2 = frameLayout;
frameLayout.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundGray));
ScrollView scrollView = new ScrollView(context);
this.scrollView = scrollView;
scrollView.setFillViewport(true);
AndroidUtilities.setScrollViewEdgeEffectColor(this.scrollView, Theme.getColor(Theme.key_actionBarDefault));
frameLayout2.addView(this.scrollView, LayoutHelper.createFrame(-1, -1.0f));
LinearLayout linearLayout = new LinearLayout(context);
this.linearLayout2 = linearLayout;
linearLayout.setOrientation(1);
this.scrollView.addView(this.linearLayout2, new FrameLayout.LayoutParams(-1, -2));
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public final void onClick(View view) {
ProxySettingsActivity.this.lambda$createView$0(view);
}
};
int i = 0;
while (i < 2) {
this.typeCell[i] = new RadioCell(context);
this.typeCell[i].setBackground(Theme.getSelectorDrawable(true));
this.typeCell[i].setTag(Integer.valueOf(i));
if (i == 0) {
this.typeCell[i].setText(LocaleController.getString("UseProxySocks5", R.string.UseProxySocks5), i == this.currentType, true);
} else {
this.typeCell[i].setText(LocaleController.getString("UseProxyTelegram", R.string.UseProxyTelegram), i == this.currentType, false);
}
this.linearLayout2.addView(this.typeCell[i], LayoutHelper.createLinear(-1, 50));
this.typeCell[i].setOnClickListener(onClickListener);
i++;
}
this.sectionCell[0] = new ShadowSectionCell(context);
this.linearLayout2.addView(this.sectionCell[0], LayoutHelper.createLinear(-1, -2));
LinearLayout linearLayout2 = new LinearLayout(context);
this.inputFieldsContainer = linearLayout2;
linearLayout2.setOrientation(1);
this.inputFieldsContainer.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
if (Build.VERSION.SDK_INT >= 21) {
this.inputFieldsContainer.setElevation(AndroidUtilities.dp(1.0f));
this.inputFieldsContainer.setOutlineProvider(null);
}
this.linearLayout2.addView(this.inputFieldsContainer, LayoutHelper.createLinear(-1, -2));
this.inputFields = new EditTextBoldCursor[5];
int i2 = 0;
for (int i3 = 5; i2 < i3; i3 = 5) {
FrameLayout frameLayout3 = new FrameLayout(context);
this.inputFieldsContainer.addView(frameLayout3, LayoutHelper.createLinear(-1, 64));
this.inputFields[i2] = new EditTextBoldCursor(context);
this.inputFields[i2].setTag(Integer.valueOf(i2));
this.inputFields[i2].setTextSize(1, 16.0f);
this.inputFields[i2].setHintColor(Theme.usePlusTheme ? Theme.prefSummaryColor : Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
this.inputFields[i2].setTextColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i2].setBackground(null);
this.inputFields[i2].setCursorColor(Theme.usePlusTheme ? Theme.prefTitleColor : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
this.inputFields[i2].setCursorSize(AndroidUtilities.dp(20.0f));
this.inputFields[i2].setCursorWidth(1.5f);
this.inputFields[i2].setSingleLine(true);
this.inputFields[i2].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
this.inputFields[i2].setHeaderHintColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
this.inputFields[i2].setTransformHintToHeader(true);
this.inputFields[i2].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_text_RedRegular));
if (i2 == 0) {
this.inputFields[i2].setInputType(524305);
this.inputFields[i2].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
ProxySettingsActivity.this.checkShareDone(true);
}
});
} else if (i2 == 1) {
this.inputFields[i2].setInputType(2);
this.inputFields[i2].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (ProxySettingsActivity.this.ignoreOnTextChange) {
return;
}
EditText editText = ProxySettingsActivity.this.inputFields[1];
int selectionStart = editText.getSelectionStart();
String obj = editText.getText().toString();
StringBuilder sb = new StringBuilder(obj.length());
int i4 = 0;
while (i4 < obj.length()) {
int i5 = i4 + 1;
String substring = obj.substring(i4, i5);
if ("0123456789".contains(substring)) {
sb.append(substring);
}
i4 = i5;
}
ProxySettingsActivity.this.ignoreOnTextChange = true;
int intValue = Utilities.parseInt(sb.toString()).intValue();
if (intValue < 0 || intValue > 65535 || !obj.equals(sb.toString())) {
if (intValue < 0) {
editText.setText("0");
} else if (intValue > 65535) {
editText.setText("65535");
} else {
editText.setText(sb.toString());
}
} else if (selectionStart >= 0) {
editText.setSelection(Math.min(selectionStart, editText.length()));
}
ProxySettingsActivity.this.ignoreOnTextChange = false;
ProxySettingsActivity.this.checkShareDone(true);
}
});
} else if (i2 == 3) {
this.inputFields[i2].setInputType(129);
this.inputFields[i2].setTypeface(Typeface.DEFAULT);
this.inputFields[i2].setTransformationMethod(PasswordTransformationMethod.getInstance());
} else {
this.inputFields[i2].setInputType(524289);
}
this.inputFields[i2].setImeOptions(268435461);
if (i2 == 0) {
this.inputFields[i2].setHintText(LocaleController.getString("UseProxyAddress", R.string.UseProxyAddress));
this.inputFields[i2].setText(this.currentProxyInfo.address);
} else if (i2 == 1) {
this.inputFields[i2].setHintText(LocaleController.getString("UseProxyPort", R.string.UseProxyPort));
this.inputFields[i2].setText("" + this.currentProxyInfo.port);
} else if (i2 == 2) {
this.inputFields[i2].setHintText(LocaleController.getString("UseProxyUsername", R.string.UseProxyUsername));
this.inputFields[i2].setText(this.currentProxyInfo.username);
} else if (i2 == 3) {
this.inputFields[i2].setHintText(LocaleController.getString("UseProxyPassword", R.string.UseProxyPassword));
this.inputFields[i2].setText(this.currentProxyInfo.password);
} else if (i2 == 4) {
this.inputFields[i2].setHintText(LocaleController.getString("UseProxySecret", R.string.UseProxySecret));
this.inputFields[i2].setText(this.currentProxyInfo.secret);
}
EditText[] editTextArr = this.inputFields;
editTextArr[i2].setSelection(editTextArr[i2].length());
this.inputFields[i2].setPadding(0, 0, 0, 0);
frameLayout3.addView(this.inputFields[i2], LayoutHelper.createFrame(-1, -1.0f, 51, 17.0f, i2 == 0 ? 12.0f : 0.0f, 17.0f, 0.0f));
this.inputFields[i2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i4, KeyEvent keyEvent) {
boolean lambda$createView$1;
lambda$createView$1 = ProxySettingsActivity.this.lambda$createView$1(textView, i4, keyEvent);
return lambda$createView$1;
}
});
i2++;
}
for (int i4 = 0; i4 < 2; i4++) {
this.bottomCells[i4] = new TextInfoPrivacyCell(context);
this.bottomCells[i4].setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
if (i4 == 0) {
this.bottomCells[i4].setText(LocaleController.getString("UseProxyInfo", R.string.UseProxyInfo));
} else {
this.bottomCells[i4].setText(LocaleController.getString("UseProxyTelegramInfo", R.string.UseProxyTelegramInfo) + "\n\n" + LocaleController.getString("UseProxyTelegramInfo2", R.string.UseProxyTelegramInfo2));
this.bottomCells[i4].setVisibility(8);
}
this.linearLayout2.addView(this.bottomCells[i4], LayoutHelper.createLinear(-1, -2));
}
TextSettingsCell textSettingsCell = new TextSettingsCell(((BaseFragment) this).fragmentView.getContext());
this.pasteCell = textSettingsCell;
textSettingsCell.setBackground(Theme.getSelectorDrawable(true));
this.pasteCell.setText(LocaleController.getString("PasteFromClipboard", R.string.PasteFromClipboard), false);
TextSettingsCell textSettingsCell2 = this.pasteCell;
int i5 = Theme.key_windowBackgroundWhiteBlueText4;
textSettingsCell2.setTextColor(Theme.getColor(i5));
this.pasteCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ProxySettingsActivity.this.lambda$createView$3(view);
}
});
this.linearLayout2.addView(this.pasteCell, 0, LayoutHelper.createLinear(-1, -2));
this.pasteCell.setVisibility(8);
this.sectionCell[2] = new ShadowSectionCell(((BaseFragment) this).fragmentView.getContext());
ShadowSectionCell shadowSectionCell = this.sectionCell[2];
Context context2 = ((BaseFragment) this).fragmentView.getContext();
int i6 = R.drawable.greydivider_bottom;
int i7 = Theme.key_windowBackgroundGrayShadow;
shadowSectionCell.setBackground(Theme.getThemedDrawableByKey(context2, i6, i7));
this.linearLayout2.addView(this.sectionCell[2], 1, LayoutHelper.createLinear(-1, -2));
this.sectionCell[2].setVisibility(8);
TextSettingsCell textSettingsCell3 = new TextSettingsCell(context);
this.shareCell = textSettingsCell3;
textSettingsCell3.setBackgroundDrawable(Theme.getSelectorDrawable(true));
this.shareCell.setText(LocaleController.getString("ShareFile", R.string.ShareFile), false);
this.shareCell.setTextColor(Theme.getColor(i5));
this.linearLayout2.addView(this.shareCell, LayoutHelper.createLinear(-1, -2));
this.shareCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ProxySettingsActivity.this.lambda$createView$4(context, view);
}
});
this.sectionCell[1] = new ShadowSectionCell(context);
this.sectionCell[1].setBackgroundDrawable(Theme.getThemedDrawableByKey(context, i6, i7));
this.linearLayout2.addView(this.sectionCell[1], LayoutHelper.createLinear(-1, -2));
this.clipboardManager = (ClipboardManager) context.getSystemService("clipboard");
this.shareDoneEnabled = true;
this.shareDoneProgress = 1.0f;
checkShareDone(false);
this.currentType = -1;
setProxyType(!TextUtils.isEmpty(this.currentProxyInfo.secret) ? 1 : 0, false);
this.pasteType = -1;
this.pasteString = null;
updatePasteCell();
return ((BaseFragment) this).fragmentView;
}
public void lambda$createView$0(View view) {
setProxyType(((Integer) view.getTag()).intValue(), true);
}
public boolean lambda$createView$1(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
if (i != 6) {
return false;
}
finishFragment();
return true;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditText[] editTextArr = this.inputFields;
if (intValue < editTextArr.length) {
editTextArr[intValue].requestFocus();
}
return true;
}
public void lambda$createView$3(View view) {
if (this.pasteType == -1) {
return;
}
int i = 0;
while (true) {
String[] strArr = this.pasteFields;
if (i < strArr.length) {
int i2 = this.pasteType;
if ((i2 != 0 || i != 4) && (i2 != 1 || (i != 2 && i != 3))) {
if (strArr[i] != null) {
try {
this.inputFields[i].setText(URLDecoder.decode(strArr[i], "UTF-8"));
} catch (UnsupportedEncodingException unused) {
this.inputFields[i].setText(this.pasteFields[i]);
}
} else {
this.inputFields[i].setText((CharSequence) null);
}
}
i++;
} else {
EditText[] editTextArr = this.inputFields;
editTextArr[0].setSelection(editTextArr[0].length());
setProxyType(this.pasteType, true, new Runnable() {
@Override
public final void run() {
ProxySettingsActivity.this.lambda$createView$2();
}
});
return;
}
}
}
public void lambda$createView$2() {
AndroidUtilities.hideKeyboard(this.inputFieldsContainer.findFocus());
for (int i = 0; i < this.pasteFields.length; i++) {
int i2 = this.pasteType;
if ((i2 != 0 || i == 4) && (i2 != 1 || i == 2 || i == 3)) {
this.inputFields[i].setText((CharSequence) null);
}
}
}
public void lambda$createView$4(Context context, View view) {
String str;
StringBuilder sb = new StringBuilder();
String obj = this.inputFields[0].getText().toString();
String obj2 = this.inputFields[3].getText().toString();
String obj3 = this.inputFields[2].getText().toString();
String obj4 = this.inputFields[1].getText().toString();
String obj5 = this.inputFields[4].getText().toString();
try {
if (!TextUtils.isEmpty(obj)) {
sb.append("server=");
sb.append(URLEncoder.encode(obj, "UTF-8"));
}
if (!TextUtils.isEmpty(obj4)) {
if (sb.length() != 0) {
sb.append("&");
}
sb.append("port=");
sb.append(URLEncoder.encode(obj4, "UTF-8"));
}
if (this.currentType == 1) {
str = "https://t.me/proxy?";
if (sb.length() != 0) {
sb.append("&");
}
sb.append("secret=");
sb.append(URLEncoder.encode(obj5, "UTF-8"));
} else {
str = "https://t.me/socks?";
if (!TextUtils.isEmpty(obj3)) {
if (sb.length() != 0) {
sb.append("&");
}
sb.append("user=");
sb.append(URLEncoder.encode(obj3, "UTF-8"));
}
if (!TextUtils.isEmpty(obj2)) {
if (sb.length() != 0) {
sb.append("&");
}
sb.append("pass=");
sb.append(URLEncoder.encode(obj2, "UTF-8"));
}
}
if (sb.length() == 0) {
return;
}
QRCodeBottomSheet qRCodeBottomSheet = new QRCodeBottomSheet(context, LocaleController.getString("ShareQrCode", R.string.ShareQrCode), str + sb.toString(), LocaleController.getString("QRCodeLinkHelpProxy", R.string.QRCodeLinkHelpProxy), true);
qRCodeBottomSheet.setCenterImage(SvgHelper.getBitmap(RLottieDrawable.readRes((File) null, R.raw.qr_dog), AndroidUtilities.dp(60.0f), AndroidUtilities.dp(60.0f), false));
showDialog(qRCodeBottomSheet);
} catch (Exception unused) {
}
}
public final void updatePasteCell() {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ProxySettingsActivity.updatePasteCell():void");
}
public final void setShareDoneEnabled(boolean enabled, boolean animated) {
if (this.shareDoneEnabled != enabled) {
ValueAnimator valueAnimator = this.shareDoneAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
} else if (animated) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.shareDoneAnimator = ofFloat;
ofFloat.setDuration(200L);
this.shareDoneAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
ProxySettingsActivity.this.lambda$setShareDoneEnabled$5(valueAnimator2);
}
});
}
if (animated) {
float[] fArr = this.shareDoneProgressAnimValues;
fArr[0] = this.shareDoneProgress;
fArr[1] = enabled ? 1.0f : 0.0f;
this.shareDoneAnimator.start();
} else {
this.shareDoneProgress = enabled ? 1.0f : 0.0f;
this.shareCell.setTextColor(Theme.getColor(enabled ? Theme.key_windowBackgroundWhiteBlueText4 : Theme.key_windowBackgroundWhiteGrayText2));
this.doneItem.setAlpha(enabled ? 1.0f : 0.5f);
}
this.shareCell.setEnabled(enabled);
this.doneItem.setEnabled(enabled);
this.shareDoneEnabled = enabled;
}
}
public void lambda$setShareDoneEnabled$5(ValueAnimator valueAnimator) {
this.shareDoneProgress = AndroidUtilities.lerp(this.shareDoneProgressAnimValues, valueAnimator.getAnimatedFraction());
this.shareCell.setTextColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4), this.shareDoneProgress));
this.doneItem.setAlpha((this.shareDoneProgress / 2.0f) + 0.5f);
}
public final void checkShareDone(boolean animated) {
if (this.shareCell == null || this.doneItem == null) {
return;
}
EditText[] editTextArr = this.inputFields;
boolean z = false;
if (editTextArr[0] == null || editTextArr[1] == null) {
return;
}
if (editTextArr[0].length() != 0 && Utilities.parseInt(this.inputFields[1].getText().toString()).intValue() != 0) {
z = true;
}
setShareDoneEnabled(z, animated);
}
public final void setProxyType(int type, boolean animated) {
setProxyType(type, animated, null);
}
public final void setProxyType(int type, boolean animated, final Runnable onTransitionEnd) {
String str;
if (this.currentType != type) {
this.currentType = type;
int i = Build.VERSION.SDK_INT;
if (i >= 23) {
TransitionManager.endTransitions(this.linearLayout2);
}
if (animated && i >= 21) {
TransitionSet duration = new TransitionSet().addTransition(new Fade(2)).addTransition(new ChangeBounds()).addTransition(new Fade(1)).setInterpolator((TimeInterpolator) CubicBezierInterpolator.DEFAULT).setDuration(250L);
if (onTransitionEnd != null) {
duration.addListener(new Transition.TransitionListener(this) {
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
onTransitionEnd.run();
}
});
}
TransitionManager.beginDelayedTransition(this.linearLayout2, duration);
}
int i2 = this.currentType;
if (i2 == 0) {
this.bottomCells[0].setVisibility(0);
this.bottomCells[1].setVisibility(8);
((View) this.inputFields[4].getParent()).setVisibility(8);
((View) this.inputFields[3].getParent()).setVisibility(0);
((View) this.inputFields[2].getParent()).setVisibility(0);
} else if (i2 == 1) {
this.bottomCells[0].setVisibility(8);
this.bottomCells[1].setVisibility(0);
((View) this.inputFields[4].getParent()).setVisibility(0);
((View) this.inputFields[3].getParent()).setVisibility(8);
((View) this.inputFields[2].getParent()).setVisibility(8);
long j = MessagesController.getGlobalMainSettings().getLong("proxy_dialog", 0L);
if (j != 0) {
TLRPC.Chat chat = getMessagesController().getChat(Long.valueOf(-j));
String str2 = null;
if (chat != null) {
str2 = chat.username;
str = chat.title;
} else {
str = null;
}
this.bottomCells[this.currentType].setText(LocaleController.getString("UseProxyTelegramInfo", R.string.UseProxyTelegramInfo) + "\n\n" + LocaleController.getString("UseProxyTelegramInfo2", R.string.UseProxyTelegramInfo2) + "\n\n@" + str2 + "\n\n" + str);
}
}
this.typeCell[0].setChecked(this.currentType == 0, animated);
this.typeCell[1].setChecked(this.currentType == 1, animated);
}
}
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
if (isOpen && !backward && this.addingNewProxy) {
this.inputFields[0].requestFocus();
AndroidUtilities.showKeyboard(this.inputFields[0]);
}
}
public ArrayList<ThemeDescription> getThemeDescriptions() {
ThemeDescription.ThemeDescriptionDelegate themeDescriptionDelegate = new ThemeDescription.ThemeDescriptionDelegate() {
@Override
public final void didSetColor() {
ProxySettingsActivity.this.lambda$getThemeDescriptions$6();
}
@Override
public void onAnimationProgress(float f) {
ThemeDescription.ThemeDescriptionDelegate.CC.$default$onAnimationProgress(this, f);
}
};
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(((BaseFragment) this).fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray));
ActionBar actionBar = ((BaseFragment) this).actionBar;
int i = ThemeDescription.FLAG_BACKGROUND;
int i2 = Theme.key_actionBarDefault;
arrayList.add(new ThemeDescription(actionBar, i, null, null, null, null, i2));
arrayList.add(new ThemeDescription(this.scrollView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, i2));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
LinearLayout linearLayout = this.inputFieldsContainer;
int i3 = ThemeDescription.FLAG_BACKGROUND;
int i4 = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(linearLayout, i3, null, null, null, null, i4));
arrayList.add(new ThemeDescription(this.linearLayout2, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider));
arrayList.add(new ThemeDescription(this.shareCell, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i4));
TextSettingsCell textSettingsCell = this.shareCell;
int i5 = ThemeDescription.FLAG_SELECTORWHITE;
int i6 = Theme.key_listSelector;
arrayList.add(new ThemeDescription(textSettingsCell, i5, null, null, null, null, i6));
int i7 = Theme.key_windowBackgroundWhiteBlueText4;
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, i7));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(this.pasteCell, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i4));
arrayList.add(new ThemeDescription(this.pasteCell, ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, i6));
arrayList.add(new ThemeDescription(this.pasteCell, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
for (int i8 = 0; i8 < this.typeCell.length; i8++) {
arrayList.add(new ThemeDescription(this.typeCell[i8], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.typeCell[i8], ThemeDescription.FLAG_SELECTORWHITE, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(this.typeCell[i8], 0, new Class[]{RadioCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(this.typeCell[i8], ThemeDescription.FLAG_CHECKBOX, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackground));
arrayList.add(new ThemeDescription(this.typeCell[i8], ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{RadioCell.class}, new String[]{"radioButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_radioBackgroundChecked));
}
if (this.inputFields != null) {
for (int i9 = 0; i9 < this.inputFields.length; i9++) {
View view = this.inputFields[i9];
int i10 = ThemeDescription.FLAG_TEXTCOLOR;
int i11 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(view, i10, null, null, null, null, i11));
arrayList.add(new ThemeDescription(this.inputFields[i9], ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
arrayList.add(new ThemeDescription(this.inputFields[i9], ThemeDescription.FLAG_HINTTEXTCOLOR | ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
arrayList.add(new ThemeDescription(this.inputFields[i9], ThemeDescription.FLAG_CURSORCOLOR, null, null, null, null, i11));
arrayList.add(new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_windowBackgroundWhiteInputField));
arrayList.add(new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_windowBackgroundWhiteInputFieldActivated));
arrayList.add(new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_text_RedRegular));
}
} else {
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(null, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
}
arrayList.add(new ThemeDescription(this.headerCell, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(this.headerCell, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueHeader));
int i12 = 0;
while (true) {
ShadowSectionCell[] shadowSectionCellArr = this.sectionCell;
if (i12 >= shadowSectionCellArr.length) {
break;
}
if (shadowSectionCellArr[i12] != null) {
arrayList.add(new ThemeDescription(this.sectionCell[i12], ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
}
i12++;
}
for (int i13 = 0; i13 < this.bottomCells.length; i13++) {
arrayList.add(new ThemeDescription(this.bottomCells[i13], ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(this.bottomCells[i13], 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText4));
arrayList.add(new ThemeDescription(this.bottomCells[i13], ThemeDescription.FLAG_LINKCOLOR, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteLinkText));
}
return arrayList;
}
public void lambda$getThemeDescriptions$6() {
ValueAnimator valueAnimator;
if (this.shareCell != null && ((valueAnimator = this.shareDoneAnimator) == null || !valueAnimator.isRunning())) {
this.shareCell.setTextColor(Theme.getColor(this.shareDoneEnabled ? Theme.key_windowBackgroundWhiteBlueText4 : Theme.key_windowBackgroundWhiteGrayText2));
}
if (this.inputFields == null) {
return;
}
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.inputFields;
if (i >= editTextBoldCursorArr.length) {
return;
}
editTextBoldCursorArr[i].setLineColors(Theme.getColor(Theme.key_windowBackgroundWhiteInputField), Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated), Theme.getColor(Theme.key_text_RedRegular));
i++;
}
}
}