From 966e229e7990b531b5efadb24e24a035e625814f Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 5 Jan 2024 21:38:27 +0100 Subject: [PATCH] Small layout improvement --- .../java/eu/faircode/email/FragmentOptionsConnection.java | 4 ++++ app/src/main/res/layout/fragment_options_connection.xml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java index 07c3a1d0b5..05494227c4 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java @@ -97,6 +97,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre private SwitchCompat swBindSocket; private SwitchCompat swStandaloneVpn; private SwitchCompat swDnsCustom; + private TextView tvDnsExtra; private EditText etDnsExtra; private SwitchCompat swTcpKeepAlive; private SwitchCompat swSslUpdate; @@ -164,6 +165,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre swBindSocket = view.findViewById(R.id.swBindSocket); swStandaloneVpn = view.findViewById(R.id.swStandaloneVpn); swDnsCustom = view.findViewById(R.id.swDnsCustom); + tvDnsExtra = view.findViewById(R.id.tvDnsExtra); etDnsExtra = view.findViewById(R.id.etDnsExtra); swTcpKeepAlive = view.findViewById(R.id.swTcpKeepAlive); swSslUpdate = view.findViewById(R.id.swSslUpdate); @@ -348,6 +350,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre public void onCheckedChanged(CompoundButton buttonView, boolean checked) { DnsHelper.clear(buttonView.getContext()); prefs.edit().putBoolean("dns_custom", checked).apply(); + tvDnsExtra.setEnabled(checked || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q); etDnsExtra.setEnabled(checked || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q); } }); @@ -755,6 +758,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre swStandaloneVpn.setChecked(prefs.getBoolean("standalone_vpn", false)); swDnsCustom.setChecked(prefs.getBoolean("dns_custom", false)); etDnsExtra.setText(prefs.getString("dns_extra", null)); + tvDnsExtra.setEnabled(swDnsCustom.isChecked() || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q); etDnsExtra.setEnabled(swDnsCustom.isChecked() || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q); swTcpKeepAlive.setChecked(prefs.getBoolean("tcp_keep_alive", false)); swSslUpdate.setChecked(prefs.getBoolean("ssl_update", true)); diff --git a/app/src/main/res/layout/fragment_options_connection.xml b/app/src/main/res/layout/fragment_options_connection.xml index 7544e5b507..d47878a2ca 100644 --- a/app/src/main/res/layout/fragment_options_connection.xml +++ b/app/src/main/res/layout/fragment_options_connection.xml @@ -435,7 +435,7 @@ app:switchPadding="12dp" /> + app:layout_constraintTop_toBottomOf="@id/tvDnsExtra" />