Added ellipsis tile for large conversations
For more than 4 members in a conversation, the fourth tile now contains an ellipsis to indicate this
This commit is contained in:
parent
901ce085a7
commit
132689376c
|
@ -84,19 +84,31 @@ public class UIHelper {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tiles = (names.length > 4)? 4 : names.length;
|
|
||||||
private static Bitmap getUnknownContactPicture(String[] names, int size, int bgColor, int fgColor) {
|
private static Bitmap getUnknownContactPicture(String[] names, int size, int bgColor, int fgColor) {
|
||||||
|
int tiles = (names.length > 4)? 4 :
|
||||||
|
(names.length < 1)? 1 :
|
||||||
|
names.length;
|
||||||
Bitmap bitmap = Bitmap
|
Bitmap bitmap = Bitmap
|
||||||
.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
|
||||||
String[] letters = new String[tiles];
|
String[] letters = new String[tiles];
|
||||||
int[] colors = new int[tiles];
|
int[] colors = new int[tiles];
|
||||||
|
if (names.length < 1) {
|
||||||
|
letters[0] = "?";
|
||||||
|
colors[0] = 0xFFe92727;
|
||||||
|
} else {
|
||||||
for(int i = 0; i < tiles; ++i) {
|
for(int i = 0; i < tiles; ++i) {
|
||||||
letters[i] = (names[i].length() > 0) ?
|
letters[i] = (names[i].length() > 0) ?
|
||||||
names[i].substring(0, 1).toUpperCase(Locale.US) : " ";
|
names[i].substring(0, 1).toUpperCase(Locale.US) : " ";
|
||||||
colors[i] = getNameColor(names[i]);
|
colors[i] = getNameColor(names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (names.length > 4) {
|
||||||
|
letters[3] = "\u2026"; // Unicode ellipsis
|
||||||
|
colors[3] = 0xFF444444;
|
||||||
|
}
|
||||||
|
}
|
||||||
Paint textPaint = new Paint(), tilePaint = new Paint();
|
Paint textPaint = new Paint(), tilePaint = new Paint();
|
||||||
textPaint.setColor(fgColor);
|
textPaint.setColor(fgColor);
|
||||||
Rect rect, left, right, topLeft, bottomLeft, topRight, bottomRight;
|
Rect rect, left, right, topLeft, bottomLeft, topRight, bottomRight;
|
||||||
|
|
Loading…
Reference in New Issue