[u] new conditions for the parameter

This commit is contained in:
Grisha 2024-11-16 02:41:28 +03:00
parent 7ec45197ec
commit 892e6e7768
3 changed files with 24 additions and 6 deletions

View file

@ -57,10 +57,16 @@ public final class DownloaderImpl extends Downloader {
App.getApp().getString(R.string.proxy_address_key), "192.168.1.1");
final String proxyPortStr = sharedPreferences.getString(
App.getApp().getString(R.string.proxy_port_key), "1080");
final String proxyTypeStr = sharedPreferences.getString(
App.getApp().getString(R.string.proxy_type_key), "socks");
final Proxy.Type proxyType = "http".equalsIgnoreCase(proxyTypeStr)
? Proxy.Type.HTTP
: Proxy.Type.SOCKS;
final int proxyPort = Integer.parseInt(proxyPortStr);
Log.d("DownloaderImpl_ProxySettings",
"Proxy enabled with address: " + proxyAddress + " and port: " + proxyPort);
final Proxy proxy = new Proxy(Proxy.Type.SOCKS,
"Proxy enabled with address: " + proxyAddress
+ " and port: " + proxyPort + ", type: " + proxyType);
final Proxy proxy = new Proxy(proxyType,
new InetSocketAddress(proxyAddress, proxyPort));
this.client = builder
.proxy(proxy)

View file

@ -736,10 +736,16 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
App.getApp().getString(R.string.proxy_address_key), "192.168.1.1");
final String proxyPortStr = sharedPreferences.getString(
App.getApp().getString(R.string.proxy_port_key), "1080");
final String proxyTypeStr = sharedPreferences.getString(
App.getApp().getString(R.string.proxy_type_key), "socks");
final Proxy.Type proxyType = "http".equalsIgnoreCase(proxyTypeStr)
? Proxy.Type.HTTP
: Proxy.Type.SOCKS;
final int proxyPort = Integer.parseInt(proxyPortStr);
android.util.Log.d("YoutubeHttpDataSource_ProxySettings",
"Proxy enabled with address: " + proxyAddress + " and port: " + proxyPort);
final Proxy proxy = new Proxy(Proxy.Type.SOCKS,
"Proxy enabled with address: "
+ proxyAddress + " and port: " + proxyPort + ", type: " + proxyType);
final Proxy proxy = new Proxy(proxyType,
new InetSocketAddress(proxyAddress, proxyPort));
connection = (HttpURLConnection) url.openConnection(proxy);
} else {

View file

@ -68,10 +68,16 @@ public final class PicassoHelper {
context.getString(R.string.proxy_address_key), "192.168.1.1");
final String proxyPortStr = sharedPreferences.getString(
context.getString(R.string.proxy_port_key), "1080");
final String proxyTypeStr = sharedPreferences.getString(
context.getString(R.string.proxy_type_key), "socks");
final Proxy.Type proxyType = "http".equalsIgnoreCase(proxyTypeStr)
? Proxy.Type.HTTP
: Proxy.Type.SOCKS;
final int proxyPort = Integer.parseInt(proxyPortStr);
Log.d("PicassoHelper_ProxySettings",
"Proxy enabled with address: " + proxyAddress + " and port: " + proxyPort);
proxySet = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyAddress, proxyPort));
"Proxy enabled with address: "
+ proxyAddress + " and port: " + proxyPort + ", type: " + proxyType);
proxySet = new Proxy(proxyType, new InetSocketAddress(proxyAddress, proxyPort));
} else {
Log.d("PicassoHelper_ProxySettings",
"Update called. proxy_enabled_key off: " + isProxyEnabled);