Small layout improvement

pull/217/head
M66B 11 months ago
parent 985af2959b
commit 3b19d03eff

@ -80,9 +80,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swDisableTracking; private SwitchCompat swDisableTracking;
private Button btnPin; private Button btnPin;
private Button btnBiometrics; private Button btnBiometrics;
private Spinner spBiometricsTimeout;
private SwitchCompat swAutoLock; private SwitchCompat swAutoLock;
private SwitchCompat swAutoLockNav; private SwitchCompat swAutoLockNav;
private Spinner spBiometricsTimeout;
private SwitchCompat swClientId; private SwitchCompat swClientId;
private TextView tvClientId; private TextView tvClientId;
private ImageButton ibClientId; private ImageButton ibClientId;
@ -154,9 +154,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisableTracking = view.findViewById(R.id.swDisableTracking);
btnPin = view.findViewById(R.id.btnPin); btnPin = view.findViewById(R.id.btnPin);
btnBiometrics = view.findViewById(R.id.btnBiometrics); btnBiometrics = view.findViewById(R.id.btnBiometrics);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
swAutoLock = view.findViewById(R.id.swAutoLock); swAutoLock = view.findViewById(R.id.swAutoLock);
swAutoLockNav = view.findViewById(R.id.swAutoLockNav); swAutoLockNav = view.findViewById(R.id.swAutoLockNav);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
swClientId = view.findViewById(R.id.swClientId); swClientId = view.findViewById(R.id.swClientId);
tvClientId = view.findViewById(R.id.tvClientId); tvClientId = view.findViewById(R.id.tvClientId);
ibClientId = view.findViewById(R.id.ibClientId); ibClientId = view.findViewById(R.id.ibClientId);
@ -386,30 +386,30 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
} }
}); });
swAutoLock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { spBiometricsTimeout.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
prefs.edit().putBoolean("autolock", checked).apply(); int[] values = getResources().getIntArray(R.array.biometricsTimeoutValues);
prefs.edit().putInt("biometrics_timeout", values[position]).apply();
} }
});
swAutoLockNav.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onNothingSelected(AdapterView<?> parent) {
prefs.edit().putBoolean("autolock_nav", checked).apply(); prefs.edit().remove("biometrics_timeout").apply();
} }
}); });
spBiometricsTimeout.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { swAutoLock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
int[] values = getResources().getIntArray(R.array.biometricsTimeoutValues); prefs.edit().putBoolean("autolock", checked).apply();
prefs.edit().putInt("biometrics_timeout", values[position]).apply();
} }
});
swAutoLockNav.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().remove("biometrics_timeout").apply(); prefs.edit().putBoolean("autolock_nav", checked).apply();
} }
}); });
@ -694,9 +694,6 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
: R.string.title_setup_biometrics_enable); : R.string.title_setup_biometrics_enable);
btnBiometrics.setEnabled(Helper.canAuthenticate(getContext())); btnBiometrics.setEnabled(Helper.canAuthenticate(getContext()));
swAutoLock.setChecked(prefs.getBoolean("autolock", true));
swAutoLockNav.setChecked(prefs.getBoolean("autolock_nav", false));
int biometrics_timeout = prefs.getInt("biometrics_timeout", 2); int biometrics_timeout = prefs.getInt("biometrics_timeout", 2);
int[] biometricTimeoutValues = getResources().getIntArray(R.array.biometricsTimeoutValues); int[] biometricTimeoutValues = getResources().getIntArray(R.array.biometricsTimeoutValues);
for (int pos = 0; pos < biometricTimeoutValues.length; pos++) for (int pos = 0; pos < biometricTimeoutValues.length; pos++)
@ -705,6 +702,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
break; break;
} }
swAutoLock.setChecked(prefs.getBoolean("autolock", true));
swAutoLockNav.setChecked(prefs.getBoolean("autolock_nav", false));
swClientId.setChecked(prefs.getBoolean("client_id", true)); swClientId.setChecked(prefs.getBoolean("client_id", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", false)); swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", false));
swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false)); swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false));

@ -357,6 +357,30 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnPin" /> app:layout_constraintTop_toBottomOf="@id/btnPin" />
<TextView
android:id="@+id/tvBiometricsTimeout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_biometrics_timeout"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPinHint" />
<eu.faircode.email.SpinnerEx
android:id="@+id/spBiometricsTimeout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:entries="@array/biometricsTimeoutNames"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBiometricsTimeout" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoLock" android:id="@+id/swAutoLock"
android:layout_width="0dp" android:layout_width="0dp"
@ -367,7 +391,7 @@
android:text="@string/title_advanced_autolock" android:text="@string/title_advanced_autolock"
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/tvPinHint" app:layout_constraintTop_toBottomOf="@+id/spBiometricsTimeout"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
@ -382,30 +406,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swAutoLock" app:layout_constraintTop_toBottomOf="@+id/swAutoLock"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<TextView
android:id="@+id/tvBiometricsTimeout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_biometrics_timeout"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoLockNav" />
<eu.faircode.email.SpinnerEx
android:id="@+id/spBiometricsTimeout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:entries="@array/biometricsTimeoutNames"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBiometricsTimeout" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

Loading…
Cancel
Save