From 76a1937745ed0281e817722ab0ce159546397b3c Mon Sep 17 00:00:00 2001 From: lookshe Date: Mon, 14 Mar 2016 23:39:44 +0100 Subject: once again: FS#34 - review all calls for String.trim() --- .../de/thedevstack/conversationsplus/services/AvatarService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/services') diff --git a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java index 11ff36da..6311d739 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java @@ -308,8 +308,7 @@ public class AvatarService { } bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); - final String trimmedName = name.trim(); - drawTile(canvas, trimmedName, 0, 0, size, size); + drawTile(canvas, name, 0, 0, size, size); ImageUtil.addBitmapToCache(KEY, bitmap); return bitmap; } @@ -382,7 +381,8 @@ public class AvatarService { private boolean drawTile(Canvas canvas, String name, int left, int top, int right, int bottom) { if (name != null) { - final String letter = name.isEmpty() ? "X" : name.substring(0, 1); + String trimmedName = name.trim(); + final String letter = trimmedName.isEmpty() ? "X" : trimmedName.substring(0, 1); final int color = UIHelper.getColorForName(name); drawTile(canvas, letter, color, left, top, right, bottom); return true; -- cgit v1.2.3