Fix solid circle show on message notification
am: 1250cd1407
Change-Id: I9742ab1f93c797e23d4545d6659efcfa4808b03c
This commit is contained in:
@@ -60,6 +60,13 @@ import java.util.regex.Pattern;
|
|||||||
public class MessagingLayout extends FrameLayout {
|
public class MessagingLayout extends FrameLayout {
|
||||||
|
|
||||||
private static final float COLOR_SHIFT_AMOUNT = 60;
|
private static final float COLOR_SHIFT_AMOUNT = 60;
|
||||||
|
/**
|
||||||
|
* Pattren for filter some ingonable characters.
|
||||||
|
* p{Z} for any kind of whitespace or invisible separator.
|
||||||
|
* p{C} for any kind of punctuation character.
|
||||||
|
*/
|
||||||
|
private static final Pattern IGNORABLE_CHAR_PATTERN
|
||||||
|
= Pattern.compile("[\\p{C}\\p{Z}]");
|
||||||
private static final Pattern SPECIAL_CHAR_PATTERN
|
private static final Pattern SPECIAL_CHAR_PATTERN
|
||||||
= Pattern.compile ("[!@#$%&*()_+=|<>?{}\\[\\]~-]");
|
= Pattern.compile ("[!@#$%&*()_+=|<>?{}\\[\\]~-]");
|
||||||
private static final Consumer<MessagingMessage> REMOVE_MESSAGE
|
private static final Consumer<MessagingMessage> REMOVE_MESSAGE
|
||||||
@@ -233,7 +240,10 @@ public class MessagingLayout extends FrameLayout {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!uniqueNames.containsKey(senderName)) {
|
if (!uniqueNames.containsKey(senderName)) {
|
||||||
char c = senderName.charAt(0);
|
// Only use visible characters to get uniqueNames
|
||||||
|
String pureSenderName = IGNORABLE_CHAR_PATTERN
|
||||||
|
.matcher(senderName).replaceAll("" /* replacement */);
|
||||||
|
char c = pureSenderName.charAt(0);
|
||||||
if (uniqueCharacters.containsKey(c)) {
|
if (uniqueCharacters.containsKey(c)) {
|
||||||
// this character was already used, lets make it more unique. We first need to
|
// this character was already used, lets make it more unique. We first need to
|
||||||
// resolve the existing character if it exists
|
// resolve the existing character if it exists
|
||||||
@@ -245,7 +255,7 @@ public class MessagingLayout extends FrameLayout {
|
|||||||
uniqueNames.put(senderName, findNameSplit((String) senderName));
|
uniqueNames.put(senderName, findNameSplit((String) senderName));
|
||||||
} else {
|
} else {
|
||||||
uniqueNames.put(senderName, Character.toString(c));
|
uniqueNames.put(senderName, Character.toString(c));
|
||||||
uniqueCharacters.put(c, senderName);
|
uniqueCharacters.put(c, pureSenderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user