Small layout fix

This commit is contained in:
M66B 2020-03-31 12:31:30 +02:00
parent 91fb1286a3
commit a564369efc
2 changed files with 13 additions and 1 deletions

View File

@ -50,6 +50,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle;
import androidx.preference.PreferenceManager;
@ -66,6 +67,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swSafeBrowsing;
private Button btnSafeBrowsing;
private Group grpSafeBrowsing;
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "confirm_images", "confirm_html", "disable_tracking",
"biometrics", "pin", "biometrics_timeout",
@ -95,6 +98,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swSafeBrowsing = view.findViewById(R.id.swSafeBrowsing);
btnSafeBrowsing = view.findViewById(R.id.btnSafeBrowsing);
grpSafeBrowsing = view.findViewById(R.id.grpSafeBrowsing);
setOptions();
// Wire controls
@ -195,7 +200,6 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
swSafeBrowsing.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
swSafeBrowsing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -210,6 +214,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
grpSafeBrowsing.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;

View File

@ -260,5 +260,11 @@
android:text="@string/title_info"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSafeBrowsing" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpSafeBrowsing"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swSafeBrowsing,btnSafeBrowsing" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>