diff options
author | Andreas Straub <andy@strb.org> | 2014-04-13 20:44:17 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2014-04-13 21:13:37 +0200 |
commit | 132689376cd3709bf25f949292bef81f496c4f37 (patch) | |
tree | 3058432c68306a6f4add617e5016d40e3ab4c0f9 /src/eu | |
parent | 901ce085a7df579b9c8c402b8af59a7ce7233044 (diff) |
Added ellipsis tile for large conversations
For more than 4 members in a conversation, the fourth tile now contains
an ellipsis to indicate this
Diffstat (limited to 'src/eu')
-rw-r--r-- | src/eu/siacs/conversations/utils/UIHelper.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index c794db5e1..322ca2109 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -84,18 +84,30 @@ public class UIHelper { return color; } - int tiles = (names.length > 4)? 4 : names.length; 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 .createBitmap(size, size, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); String[] letters = new String[tiles]; int[] colors = new int[tiles]; - for(int i = 0; i < tiles; ++i) { - letters[i] = (names[i].length() > 0) ? - names[i].substring(0, 1).toUpperCase(Locale.US) : " "; - colors[i] = getNameColor(names[i]); + if (names.length < 1) { + letters[0] = "?"; + colors[0] = 0xFFe92727; + } else { + for(int i = 0; i < tiles; ++i) { + letters[i] = (names[i].length() > 0) ? + names[i].substring(0, 1).toUpperCase(Locale.US) : " "; + colors[i] = getNameColor(names[i]); + } + + if (names.length > 4) { + letters[3] = "\u2026"; // Unicode ellipsis + colors[3] = 0xFF444444; + } } Paint textPaint = new Paint(), tilePaint = new Paint(); textPaint.setColor(fgColor); |