aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/AvatarService.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
commitcf00f3fade1e76ff9360e96d5505d49c7c89d5c4 (patch)
tree0617dcc0eff219a19e555aba6096e24d9ef2e30c /src/main/java/eu/siacs/conversations/services/AvatarService.java
parent84b2ce10b7a38aaaa9d2d3ee8ad4e1213402640f (diff)
happy hanukkah
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/AvatarService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/AvatarService.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java
index 83bdacf8..fc1ed28e 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)];
- }
-
}