summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-26 12:37:32 +0100
committercyBerta <cyberta@riseup.net>2021-11-26 12:37:32 +0100
commitcf3e52d0b4add8d805ac7a9e0b5e6e340106265e (patch)
tree770c482cdf30fc343894521c860c015bca74f7e1
parent7e55369cb99cf8362072a0d4fc78bdd238bc24f4 (diff)
disable UDP UI settings while using bridges
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java12
-rw-r--r--app/src/main/res/values/strings.xml1
2 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
index a695fcb2..d4f142ef 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
@@ -134,10 +134,10 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
}
private void initPreferUDPEntry(View rootView) {
- IconSwitchEntry useSnowflake = rootView.findViewById(R.id.prefer_udp);
- useSnowflake.setVisibility(VISIBLE);
- useSnowflake.setChecked(getPreferUDP(getContext()));
- useSnowflake.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ IconSwitchEntry useUdpEntry = rootView.findViewById(R.id.prefer_udp);
+ useUdpEntry.setVisibility(VISIBLE);
+ useUdpEntry.setChecked(getPreferUDP(getContext()));
+ useUdpEntry.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (!buttonView.isPressed()) {
return;
}
@@ -147,6 +147,9 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show();
}
});
+ boolean bridgesEnabled = getUseBridges(getContext());
+ useUdpEntry.setEnabled(!bridgesEnabled);
+ useUdpEntry.setSubtitle(getString(bridgesEnabled ? R.string.disabled_while_bridges_on : R.string.prefer_udp_subtitle));
}
private void initExcludeAppsEntry(View rootView) {
@@ -234,6 +237,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
}
if (key.equals(USE_BRIDGES)) {
initUseBridgesEntry(rootView);
+ initPreferUDPEntry(rootView);
} else if (key.equals(USE_IPv6_FIREWALL)) {
initFirewallEntry(getView());
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 79f03764..c32e0d3c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -189,6 +189,7 @@
<string name="vpn_settings">VPN settings</string>
<string name="prefer_udp">Use UDP if available</string>
<string name="prefer_udp_subtitle">UDP can be faster and better for streaming, but does not work for all networks.</string>
+ <string name="disabled_while_bridges_on">Disabled while using bridges.</string>
<string name="hint_bridges">Only locations supporting bridges are currently selectable.</string>
<string name="option_disable_bridges">Disable bridges</string>
<string name="eip_state_insecure">Connection insecure</string>