Correctly show validated option

pull/195/head
M66B 4 years ago
parent 854ee05571
commit cdf3b4cd52

@ -51,6 +51,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -71,6 +72,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private TextView tvNetworkRoaming; private TextView tvNetworkRoaming;
private TextView tvNetworkInfo; private TextView tvNetworkInfo;
private Group grpValidated;
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"metered", "download", "roaming", "rlah", "metered", "download", "roaming", "rlah",
"require_validated", "timeout", "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden" "require_validated", "timeout", "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden"
@ -103,6 +106,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
tvNetworkRoaming = view.findViewById(R.id.tvNetworkRoaming); tvNetworkRoaming = view.findViewById(R.id.tvNetworkRoaming);
tvNetworkInfo = view.findViewById(R.id.tvNetworkInfo); tvNetworkInfo = view.findViewById(R.id.tvNetworkInfo);
grpValidated = view.findViewById(R.id.grpValidated);
setOptions(); setOptions();
// Wire controls // Wire controls
@ -144,7 +149,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
} }
}); });
swValidated.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.M ? View.GONE : View.VISIBLE); grpValidated.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.M ? View.GONE : View.VISIBLE);
swValidated.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swValidated.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

@ -175,7 +175,7 @@
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvValidateHint" android:id="@+id/tvValidatedHint"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
@ -197,7 +197,7 @@
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
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/tvValidateHint" /> app:layout_constraintTop_toBottomOf="@id/tvValidatedHint" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvTimeoutHint" android:id="@+id/tvTimeoutHint"
@ -340,5 +340,11 @@
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/tvNetworkRoaming" /> app:layout_constraintTop_toBottomOf="@+id/tvNetworkRoaming" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpValidated"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swValidated,tvValidatedHint" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>

Loading…
Cancel
Save