Skip to content

Commit

Permalink
removed random proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
gdlbo committed Jan 30, 2024
1 parent 58c14fb commit dd6916c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 30 deletions.
20 changes: 10 additions & 10 deletions app/src/main/java/ru/vtosters/hooks/ProxyHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,22 @@ public static void callProxyDialog(Context ctx) {

RadioButton rgDefault = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton rgZaborona = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton rgRandomProxy = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
// RadioButton rgRandomProxy = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton rgVika = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));

SwitchHook.setCompoundButton(rgDefault);
SwitchHook.setCompoundButton(rgZaborona);
SwitchHook.setCompoundButton(rgRandomProxy);
// SwitchHook.setCompoundButton(rgRandomProxy);
SwitchHook.setCompoundButton(rgVika);

rg.addView(rgDefault);
rg.addView(rgVika);
rg.addView(rgZaborona);
rg.addView(rgRandomProxy);
// rg.addView(rgRandomProxy);

rgDefault.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
rgZaborona.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
rgRandomProxy.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
// rgRandomProxy.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
rgVika.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));

rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
Expand All @@ -134,15 +134,15 @@ public static void callProxyDialog(Context ctx) {
rgZaborona.setText(ctx.getString(R.string.proxy_enable) + " (Zaborona)");
rgZaborona.setTextColor(getTextAttr());

rgRandomProxy.setText(ctx.getString(R.string.proxy_enable) + " (Random Socks Proxy)");
rgRandomProxy.setTextColor(getTextAttr());
// rgRandomProxy.setText(ctx.getString(R.string.proxy_enable) + " (Random Socks Proxy)");
// rgRandomProxy.setTextColor(getTextAttr());

rgVika.setText(ctx.getString(R.string.proxy_enable) + " (Vika Mobile)");
rgVika.setTextColor(getTextAttr());

rgZaborona.setChecked(isZaboronaEnabled());
rgDefault.setChecked(!isZaboronaEnabled() && !isRandomProxyEnabled() && !isVikaProxyEnabled());
rgRandomProxy.setChecked(isRandomProxyEnabled());
// rgRandomProxy.setChecked(isRandomProxyEnabled());
rgVika.setChecked(isVikaProxyEnabled());

new VkAlertDialog.Builder(ctx)
Expand All @@ -153,9 +153,9 @@ public static void callProxyDialog(Context ctx) {
if (rgZaborona.isChecked()) {
Preferences.getPreferences().edit().putString("proxy", "zaborona").commit();
restartApplication();
} else if (rgRandomProxy.isChecked()) {
Preferences.getPreferences().edit().putString("proxy", "randomproxy").commit();
restartApplication();
// } else if (rgRandomProxy.isChecked()) {
// Preferences.getPreferences().edit().putString("proxy", "randomproxy").commit();
// restartApplication();
} else if (rgVika.isChecked()) {
Preferences.getPreferences().edit().putString("proxy", "vika").commit();
restartApplication();
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/ru/vtosters/lite/proxy/ProxyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public static Boolean isZaboronaEnabled() {
}

public static Boolean isRandomProxyEnabled() {
return Preferences.getString("proxy").equals("randomproxy");
// return Preferences.getString("proxy").equals("randomproxy");
return false;
}

public static Boolean isApiProxyEnabled() {
Expand Down Expand Up @@ -129,11 +130,11 @@ public static boolean hasProxy(String list) {
return list.contains(":"); // proxy format: ip:port
}

public static void setProxy() throws IOException {
public static void setProxy() {
if (!isAnyProxyEnabled()) return;
switch (Preferences.getString("proxy")) {
case "zaborona" -> Zaborona.loadProxy();
case "randomproxy" -> RandomProxy.loadProxy();
// case "randomproxy" -> RandomProxy.loadProxy();
case "socks" -> CustomSocks.loadProxy();
case "http" -> CustomHttp.loadProxy();
case "https" -> CustomHttps.loadProxy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public class ProxySettingsFragment extends TrackedMaterialPreferenceToolbarFragm
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.preferences_proxy);
findPreference("random_proxy").setOnPreferenceClickListener(preference -> {
try {
setupNewProxy();
} catch (IOException e) {
sendToast(requireContext().getString(R.string.get_proxy_error));
}
return true;
});
// findPreference("random_proxy").setOnPreferenceClickListener(preference -> {
// try {
// setupNewProxy();
// } catch (IOException e) {
// sendToast(requireContext().getString(R.string.get_proxy_error));
// }
// return true;
// });
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion smali/res/values-be/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@
<item>Без проксі</item>
<item>zaborona.help</item>
<item>VikaMobile</item>
<item>Рандомны проксі</item>
<!-- <item>Рандомны проксі</item>-->
<item>Іншы проксі для API</item>
<item>Іншы HTTP</item>
<item>Іншы HTTPS</item>
Expand Down
2 changes: 1 addition & 1 deletion smali/res/values-ru/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
<item>Без прокси</item>
<item>zaborona.help</item>
<item>VikaMobile</item>
<item>Рандомный прокси</item>
<!-- <item>Рандомный прокси</item>-->
<item>Сторонний прокси для API</item>
<item>Сторонний HTTP</item>
<item>Сторонний HTTPS</item>
Expand Down
2 changes: 1 addition & 1 deletion smali/res/values-uk/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
<item>Без проксі</item>
<item>zaborona.help</item>
<item>VikaMobile</item>
<item>Випадковий проксі</item>
<!-- <item>Випадковий проксі</item>-->
<item>Сторонній проксі для API</item>
<item>Сторонній HTTP</item>
<item>Сторонній HTTPS</item>
Expand Down
4 changes: 2 additions & 2 deletions smali/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@
<item>No proxy</item>
<item>zaborona.help</item>
<item>VikaMobile</item>
<item>Random proxy</item>
<!-- <item>Random proxy</item>-->
<item>Custom API proxy</item>
<item>Custom HTTP</item>
<item>Custom HTTPS</item>
Expand All @@ -746,7 +746,7 @@
<item>noproxy</item>
<item>zaborona</item>
<item>vika</item>
<item>randomproxy</item>
<!-- <item>randomproxy</item>-->
<item>apiproxy</item>
<item>http</item>
<item>https</item>
Expand Down
8 changes: 4 additions & 4 deletions smali/res/xml/preferences_proxy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
android:entryValues="@array/proxy_value"
android:key="proxy"
android:title="@string/useproxy"/>
<Preference
android:key="random_proxy"
android:summary="@string/proxy_setup_summ"
android:title="@string/proxy_setup_title"/>
<!-- <Preference-->
<!-- android:key="random_proxy"-->
<!-- android:summary="@string/proxy_setup_summ"-->
<!-- android:title="@string/proxy_setup_title"/>-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/proxyadvsettings">
<EditTextPreference
Expand Down

0 comments on commit dd6916c

Please sign in to comment.