Improve code style

This commit is contained in:
rezanejati 2019-08-11 09:11:11 +04:30
parent 2f1ebbbf74
commit c47ceb7f73
1 changed files with 4 additions and 5 deletions

View File

@ -95,11 +95,12 @@ public class ProxyDialog {
if(!TextUtils.isEmpty(port)) { if(!TextUtils.isEmpty(port)) {
portValue = Integer.valueOf(port); portValue = Integer.valueOf(port);
} }
if (Proxy.Type.valueOf(type) == Proxy.Type.SOCKS) if (Proxy.Type.valueOf(type) == Proxy.Type.SOCKS) {
proxy = ProxyConfig.socks(host, portValue, username, password); proxy = ProxyConfig.socks(host, portValue, username, password);
else } else {
proxy = ProxyConfig.http(host, portValue, username, password); proxy = ProxyConfig.http(host, portValue, username, password);
} }
}
UserPreferences.setProxyConfig(proxy); UserPreferences.setProxyConfig(proxy);
AntennapodHttpClient.reinit(); AntennapodHttpClient.reinit();
dialog.dismiss(); dialog.dismiss();
@ -113,11 +114,9 @@ public class ProxyDialog {
List<String> types= new ArrayList<>(); List<String> types= new ArrayList<>();
types.add(Proxy.Type.DIRECT.name()); types.add(Proxy.Type.DIRECT.name());
types.add(Proxy.Type.HTTP.name()); types.add(Proxy.Type.HTTP.name());
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
types.add(Proxy.Type.SOCKS.name()); types.add(Proxy.Type.SOCKS.name());
} }
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, ArrayAdapter<String> adapter = new ArrayAdapter<>(context,
android.R.layout.simple_spinner_item, types); android.R.layout.simple_spinner_item, types);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);