Fixed color blender

This commit is contained in:
M66B 2019-04-04 14:17:36 +02:00
parent ab7e3d073e
commit a956cb8733
4 changed files with 11 additions and 3 deletions

View File

@ -396,6 +396,8 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
prefs.edit().putString("theme", "system").apply();
break;
}
ContactInfo.clearCache();
}
private void onMenuOptions() {

View File

@ -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));
}
}

View File

@ -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);

View File

@ -1,4 +1,5 @@
<resources>
<attr name="themeName" format="string" />
<attr name="colorUnread" format="reference" />
<attr name="colorSeparator" format="reference" />
<attr name="colorWarning" format="reference" />
@ -8,6 +9,7 @@
<attr name="activatableItemBackground" format="reference" />
<style name="AppThemeLight" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="themeName">light</item>
<item name="android:windowDisablePreview">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
@ -31,6 +33,7 @@
</style>
<style name="AppThemeDark" parent="Base.Theme.AppCompat">
<item name="themeName">dark</item>
<item name="android:windowDisablePreview">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
@ -54,6 +57,7 @@
</style>
<style name="AppThemeBlack" parent="AppThemeDark">
<item name="themeName">black</item>
<item name="colorPrimary">@color/blackPrimary</item>
<item name="colorPrimaryDark">@color/blackPrimaryDark</item>
<item name="colorAccent">@color/blackAccent</item>