From cf00f3fade1e76ff9360e96d5505d49c7c89d5c4 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Sun, 16 Nov 2014 17:21:21 +0100 Subject: happy hanukkah --- .../eu/siacs/conversations/services/AvatarService.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/services/AvatarService.java') diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index 83bdacf84..fc1ed28ea 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -17,6 +17,7 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.utils.UIHelper; public class AvatarService { @@ -119,7 +120,7 @@ public class AvatarService { if (count == 0) { String name = mucOptions.getConversation().getName(); String letter = name.substring(0, 1); - int color = this.getColorForName(name); + int color = UIHelper.getColorForName(name); drawTile(canvas, letter, color, 0, 0, size, size); } else if (count == 1) { drawTile(canvas, users.get(0), 0, 0, size, size); @@ -209,7 +210,7 @@ public class AvatarService { int color; if (name.length() > 0) { letter = name.substring(0, 1); - color = this.getColorForName(name); + color = UIHelper.getColorForName(name); } else { letter = "X"; color = PLACEHOLDER_COLOR; @@ -272,7 +273,7 @@ public class AvatarService { int color; if (name.length() > 0) { letter = name.substring(0, 1); - color = this.getColorForName(name); + color = UIHelper.getColorForName(name); } else { letter = "X"; color = PLACEHOLDER_COLOR; @@ -286,11 +287,4 @@ public class AvatarService { canvas.drawBitmap(bm, null, dst, null); } - private int getColorForName(String name) { - int holoColors[] = {0xFFe91e63, 0xFF9c27b0, 0xFF673ab7, 0xFF3f51b5, - 0xFF5677fc, 0xFF03a9f4, 0xFF00bcd4, 0xFF009688, 0xFFff5722, - 0xFF795548, 0xFF607d8b}; - return holoColors[(int) ((name.hashCode() & 0xffffffffl) % holoColors.length)]; - } - } -- cgit v1.2.3