Small layout improvement

pull/214/head
M66B 12 months ago
parent cd0ccba175
commit 966e229e79

@ -97,6 +97,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private SwitchCompat swBindSocket; private SwitchCompat swBindSocket;
private SwitchCompat swStandaloneVpn; private SwitchCompat swStandaloneVpn;
private SwitchCompat swDnsCustom; private SwitchCompat swDnsCustom;
private TextView tvDnsExtra;
private EditText etDnsExtra; private EditText etDnsExtra;
private SwitchCompat swTcpKeepAlive; private SwitchCompat swTcpKeepAlive;
private SwitchCompat swSslUpdate; private SwitchCompat swSslUpdate;
@ -164,6 +165,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swBindSocket = view.findViewById(R.id.swBindSocket); swBindSocket = view.findViewById(R.id.swBindSocket);
swStandaloneVpn = view.findViewById(R.id.swStandaloneVpn); swStandaloneVpn = view.findViewById(R.id.swStandaloneVpn);
swDnsCustom = view.findViewById(R.id.swDnsCustom); swDnsCustom = view.findViewById(R.id.swDnsCustom);
tvDnsExtra = view.findViewById(R.id.tvDnsExtra);
etDnsExtra = view.findViewById(R.id.etDnsExtra); etDnsExtra = view.findViewById(R.id.etDnsExtra);
swTcpKeepAlive = view.findViewById(R.id.swTcpKeepAlive); swTcpKeepAlive = view.findViewById(R.id.swTcpKeepAlive);
swSslUpdate = view.findViewById(R.id.swSslUpdate); swSslUpdate = view.findViewById(R.id.swSslUpdate);
@ -348,6 +350,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
public void onCheckedChanged(CompoundButton buttonView, boolean checked) { public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
DnsHelper.clear(buttonView.getContext()); DnsHelper.clear(buttonView.getContext());
prefs.edit().putBoolean("dns_custom", checked).apply(); 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); 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)); swStandaloneVpn.setChecked(prefs.getBoolean("standalone_vpn", false));
swDnsCustom.setChecked(prefs.getBoolean("dns_custom", false)); swDnsCustom.setChecked(prefs.getBoolean("dns_custom", false));
etDnsExtra.setText(prefs.getString("dns_extra", null)); 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); etDnsExtra.setEnabled(swDnsCustom.isChecked() || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q);
swTcpKeepAlive.setChecked(prefs.getBoolean("tcp_keep_alive", false)); swTcpKeepAlive.setChecked(prefs.getBoolean("tcp_keep_alive", false));
swSslUpdate.setChecked(prefs.getBoolean("ssl_update", true)); swSslUpdate.setChecked(prefs.getBoolean("ssl_update", true));

@ -435,7 +435,7 @@
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<TextView <TextView
android:id="@+id/tvDns" android:id="@+id/tvDnsExtra"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
@ -459,7 +459,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDns" /> app:layout_constraintTop_toBottomOf="@id/tvDnsExtra" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTcpKeepAlive" android:id="@+id/swTcpKeepAlive"

Loading…
Cancel
Save