From 5c23a8acaaed934f9788fc2c211061cba9030dfb Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Sat, 11 Jan 2020 14:38:54 -0500 Subject: [PATCH] Improve randomness of contact colours --- .../src/main/java/com/moez/QKSMS/common/util/Colors.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/Colors.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/Colors.kt index 7eed9260..ed74dace 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/Colors.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/Colors.kt @@ -134,11 +134,7 @@ class Colors @Inject constructor( } private fun generateColor(recipient: Recipient): Int { - val first = recipient.contact?.name?.firstOrNull() - ?: phoneNumberUtils.normalizeNumber(recipient.address).firstOrNull() - ?: '#' - - val index = first.hashCode().absoluteValue % randomColors.size + val index = recipient.address.hashCode().absoluteValue % randomColors.size return randomColors[index] } }