diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogSend.java b/app/src/main/java/eu/faircode/email/FragmentDialogSend.java index 998bba683c..0eed55e739 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogSend.java @@ -28,8 +28,10 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Typeface; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; @@ -252,14 +254,25 @@ public class FragmentDialogSend extends FragmentDialogBase { ibMore.setOnClickListener(onMore); tvMore.setOnClickListener(onMore); + Runnable evalMore = new RunnableEx("more") { + @Override + protected void delegate() { + boolean warning = (cbPlainOnly.isChecked() && styled); + int color = Helper.resolveColor(tvMore.getContext(), warning ? R.attr.colorWarning : android.R.attr.textColorSecondary); + ibMore.setImageTintList(ColorStateList.valueOf(color)); + tvMore.setTextColor(color); + tvMore.setTypeface(warning ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + } + }; + + evalMore.run(); + cbPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - tvPlainHint.setVisibility(checked && styled ? View.VISIBLE : View.GONE); - if (checked && styled && grpMore.getVisibility() != View.VISIBLE) { - ibMore.setImageLevel(0); - grpMore.setVisibility(View.VISIBLE); - } + boolean more = (grpMore.getVisibility() == View.VISIBLE); + tvPlainHint.setVisibility(checked && styled && more ? View.VISIBLE : View.GONE); + evalMore.run(); Bundle args = new Bundle(); args.putLong("id", id); @@ -288,11 +301,8 @@ public class FragmentDialogSend extends FragmentDialogBase { cbReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - tvReceiptHint.setVisibility(checked ? View.VISIBLE : View.GONE); - if (checked && grpMore.getVisibility() != View.VISIBLE) { - ibMore.setImageLevel(0); - grpMore.setVisibility(View.VISIBLE); - } + boolean more = (grpMore.getVisibility() == View.VISIBLE); + tvReceiptHint.setVisibility(checked && more ? View.VISIBLE : View.GONE); Bundle args = new Bundle(); args.putLong("id", id); diff --git a/app/src/main/res/layout/dialog_send.xml b/app/src/main/res/layout/dialog_send.xml index 43b5d1d935..49c5a46dd3 100644 --- a/app/src/main/res/layout/dialog_send.xml +++ b/app/src/main/res/layout/dialog_send.xml @@ -530,7 +530,7 @@ android:id="@+id/cbArchive" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="12dp" + android:layout_marginTop="24dp" android:tag="ignore" android:text="@string/title_send_auto_archive" android:textAppearance="@style/TextAppearance.AppCompat.Small" @@ -541,7 +541,7 @@ android:id="@+id/cbNotAgain" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="24dp" + android:layout_marginTop="12dp" android:text="@string/title_no_ask_again" android:textAppearance="@style/TextAppearance.AppCompat.Small" app:layout_constraintStart_toStartOf="parent" @@ -567,8 +567,7 @@ tvEncrypt,spEncrypt,ibEncryption, tvPriority,spPriority, tvSensitivity,spSensitivity,ibSensitivity, - tvSendTitle,tvSendAt,ibSendAt, - cbArchive" /> + tvSendTitle,tvSendAt,ibSendAt" />