From a956cb8733ac90c73dcea695359f95ae99fdfc31 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 4 Apr 2019 14:17:36 +0200 Subject: [PATCH] Fixed color blender --- app/src/main/java/eu/faircode/email/ActivitySetup.java | 2 ++ app/src/main/java/eu/faircode/email/ContactInfo.java | 6 ++++-- app/src/main/java/eu/faircode/email/Identicon.java | 2 +- app/src/main/res/values/styles.xml | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivitySetup.java b/app/src/main/java/eu/faircode/email/ActivitySetup.java index a07408123b..23224953c3 100644 --- a/app/src/main/java/eu/faircode/email/ActivitySetup.java +++ b/app/src/main/java/eu/faircode/email/ActivitySetup.java @@ -396,6 +396,8 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On prefs.edit().putString("theme", "system").apply(); break; } + + ContactInfo.clearCache(); } private void onMenuOptions() { diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 6e40046c0e..34bad320a6 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -9,6 +9,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.provider.ContactsContract; +import android.util.TypedValue; import java.io.InputStream; import java.util.Date; @@ -134,9 +135,10 @@ public class ContactInfo { if (info.bitmap == null) { boolean identicons = prefs.getBoolean("identicons", false); if (identicons) { - String theme = prefs.getString("theme", "light"); + TypedValue tv = new TypedValue(); + context.getTheme().resolveAttribute(R.attr.themeName, tv, true); int dp = Helper.dp2pixels(context, 48); - info.bitmap = Identicon.generate(key, dp, 5, "light".equals(theme)); + info.bitmap = Identicon.generate(key, dp, 5, !"light".equals(tv.string)); } } diff --git a/app/src/main/java/eu/faircode/email/Identicon.java b/app/src/main/java/eu/faircode/email/Identicon.java index 5832403378..4ca4ab9304 100644 --- a/app/src/main/java/eu/faircode/email/Identicon.java +++ b/app/src/main/java/eu/faircode/email/Identicon.java @@ -40,7 +40,7 @@ class Identicon { } int color = Color.argb(255, hash[0], hash[1], hash[2]); - color = ColorUtils.blendARGB(color, dark ? Color.BLACK : Color.WHITE, 0.2f); + color = ColorUtils.blendARGB(color, dark ? Color.WHITE : Color.BLACK, 0.2f); Paint paint = new Paint(); paint.setColor(color); diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a5bf5d240b..639649e08b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,4 +1,5 @@ + @@ -8,6 +9,7 @@