diff --git a/app/src/main/java/eu/faircode/email/FragmentPop.java b/app/src/main/java/eu/faircode/email/FragmentPop.java index f2c5976fa4..91e3d5d33f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentPop.java +++ b/app/src/main/java/eu/faircode/email/FragmentPop.java @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Typeface; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -135,6 +136,9 @@ public class FragmentPop extends FragmentBase { private String calendar = null; private boolean saving = false; + private int colorWarning; + private int textColorSecondary; + private static final int REQUEST_COLOR = 1; private static final int REQUEST_AVATAR = 2; private static final int REQUEST_CALENDAR = 3; @@ -217,6 +221,9 @@ public class FragmentPop extends FragmentBase { pbWait = view.findViewById(R.id.pbWait); + this.colorWarning = Helper.resolveColor(getContext(), R.attr.colorWarning); + this.textColorSecondary = Helper.resolveColor(getContext(), android.R.attr.textColorSecondary); + rgEncryption.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int id) { @@ -369,6 +376,10 @@ public class FragmentPop extends FragmentBase { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { cbClientDelete.setEnabled(!isChecked); + cbLeaveServer.setTextColor(isChecked ? textColorSecondary : colorWarning); + cbLeaveServer.setTypeface(isChecked ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD); + cbLeaveServer.setCompoundDrawablesRelativeWithIntrinsicBounds( + 0, 0, isChecked ? 0 : R.drawable.twotone_warning_24, 0); } }); @@ -958,6 +969,11 @@ public class FragmentPop extends FragmentBase { cbAutoSeen.setChecked(account == null ? true : account.auto_seen); cbLeaveServer.setChecked(account == null ? true : account.leave_on_server); + cbLeaveServer.setTextColor(cbLeaveServer.isChecked() ? textColorSecondary : colorWarning); + cbLeaveServer.setTypeface(cbLeaveServer.isChecked() ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD); + cbLeaveServer.setCompoundDrawablesRelativeWithIntrinsicBounds( + 0, 0, cbLeaveServer.isChecked() ? 0 : R.drawable.twotone_warning_24, 0); + cbClientDelete.setChecked(account == null ? false : account.client_delete); cbClientDelete.setEnabled(!cbLeaveServer.isChecked()); cbLeaveDeleted.setChecked(account == null ? true : account.leave_deleted); diff --git a/app/src/main/res/layout/fragment_pop.xml b/app/src/main/res/layout/fragment_pop.xml index 17cec7ca6d..59906898e9 100644 --- a/app/src/main/res/layout/fragment_pop.xml +++ b/app/src/main/res/layout/fragment_pop.xml @@ -578,6 +578,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" + android:drawablePadding="6dp" + android:drawableTint="?attr/colorWarning" android:text="@string/title_leave_on_server" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbAutoSeen" />