mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 13:48:52 +01:00
Improve randomness of contact colours
This commit is contained in:
@@ -134,11 +134,7 @@ class Colors @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun generateColor(recipient: Recipient): Int {
|
private fun generateColor(recipient: Recipient): Int {
|
||||||
val first = recipient.contact?.name?.firstOrNull()
|
val index = recipient.address.hashCode().absoluteValue % randomColors.size
|
||||||
?: phoneNumberUtils.normalizeNumber(recipient.address).firstOrNull()
|
|
||||||
?: '#'
|
|
||||||
|
|
||||||
val index = first.hashCode().absoluteValue % randomColors.size
|
|
||||||
return randomColors[index]
|
return randomColors[index]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user