fixed auth proxy dialog

This commit is contained in:
gdlbo
2022-07-11 17:56:03 +03:00
parent 2d21a85259
commit 1e876a9217
@@ -1,11 +1,13 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import static ru.vtosters.lite.utils.Proxy.isZaboronaEnabled;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.TypedValue;
import android.view.View;
@@ -43,16 +45,19 @@ public class ProxyHook{
rg.setPadding(convertDpToPixel(18f), convertDpToPixel(12f), convertDpToPixel(18f), 0);
rgDefault.setText("Отключить");
rgDefault.setTextColor(Themes.getTextAttr());
rgProxy.setText("Включить (Zaborona)");
rgProxy.setTextColor(Themes.getTextAttr());
rgProxy.setChecked(isZaboronaEnabled());
rgDefault.setChecked(!isZaboronaEnabled());
new AlertDialog.Builder(ctx)
.setTitle("Прокси")
.setMessage("Zaborona никак не связана с ВТостерс и мы не можем гарантировать её работу и безопасность")
.setView(rg)
.setPositiveButton("Применить", ((dialog, which) -> {
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, com.vtosters.lite.R.style.Base_Theme_MaterialComponents_Dialog_Alert);
builder.setTitle("Прокси");
builder.setMessage("Zaborona никак не связана с ВТостерс и мы не можем гарантировать её работу и безопасность");
builder.setView(rg);
builder.setPositiveButton("Применить", ((dialog, which) -> {
if (rgProxy.isChecked()){
edit().putString("proxy", "zaborona").commit();
restartApplication();
@@ -64,11 +69,19 @@ public class ProxyHook{
edit().putString("proxy", "noproxy").commit();
}
}))
.setNeutralButton("Настройки прокси", ((dialog, which) -> {
}));
builder.setNeutralButton("Настройки прокси", ((dialog, which) -> {
Intent a2 = new Navigator(ProxySettingsFragment.class).b(ctx);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(a2);
})).show();
}));
var alert = builder.create();
alert.show();
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(Themes.getAccentColor());
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(Themes.getAccentColor());
}
}