From 23e541461275599a7eb6d7d50717dbb259a9253d Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 25 Mar 2020 15:10:38 +0100 Subject: [PATCH] Color first letter account name in move to menu --- .../main/java/eu/faircode/email/FragmentMessages.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 435b07e5c5..57fb934803 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -58,6 +58,7 @@ import android.security.KeyChain; import android.text.SpannableString; import android.text.TextUtils; import android.text.format.DateUtils; +import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; import android.util.Base64; @@ -2377,9 +2378,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. popupMenu.getMenu().add(Menu.NONE, R.string.title_spam, order++, R.string.title_spam); for (EntityAccount account : result.accounts) { - MenuItem item = popupMenu.getMenu() - .add(Menu.NONE, R.string.title_move_to_account, order++, - getString(R.string.title_move_to_account, account.name)); + String title = getString(R.string.title_move_to_account, account.name); + SpannableString ss = new SpannableString(title); + if (account.name != null && account.color != null) { + int i = title.indexOf(account.name); + ss.setSpan(new ForegroundColorSpan(account.color), i, i + 1, 0); + } + MenuItem item = popupMenu.getMenu().add(Menu.NONE, R.string.title_move_to_account, order++, ss); item.setIntent(new Intent().putExtra("account", account.id)); }