From 1589a05a37b7ced1bdc06c1fb9b5de695b9dab1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sun, 5 Jan 2020 14:39:19 +0100 Subject: [PATCH] [Colors] Update default profile image colors (colorFromName). --- .../pl/szczodrzynski/edziennik/Extensions.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt index 5ab046bf..69d7cf1b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt @@ -210,25 +210,23 @@ fun List.join(delimiter: String): String { } fun colorFromName(name: String?): Int { - var crc = (name ?: "").crc16() - crc = (crc and 0xff) or (crc shr 8) - crc %= 16 - return when (crc) { + val i = (name ?: "").crc32() + return when ((i / 10 % 16 + 1).toInt()) { 13 -> 0xffF44336 4 -> 0xffF50057 2 -> 0xffD500F9 9 -> 0xff6200EA - 5 -> 0xff3F51B5 + 5 -> 0xffFFAB00 1 -> 0xff304FFE - 6 -> 0xff18FFFF + 6 -> 0xff40C4FF 14 -> 0xff26A69A - 15 -> 0xff4CAF50 + 15 -> 0xff00C853 7 -> 0xffFFD600 3 -> 0xffFF3D00 8 -> 0xffDD2C00 10 -> 0xff795548 - 12 -> 0xffBDBDBD - 11 -> 0xff78909C + 12 -> 0xff2979FF + 11 -> 0xffFF6D00 else -> 0xff64DD17 }.toInt() }