Skip to content

Commit 39cf84b

Browse files
marunjarjhoobergs
authored andcommitted
improve string checks
check not only null but also 0-length append separator ' ' only when location is set, to avoid trailing space and ellipsizing with small column width
1 parent 4792e36 commit 39cf84b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/src/main/java/com/alamkanak/weekview/WeekView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,14 +1141,14 @@ private void drawEventTitle(WeekViewEvent event, RectF rect, Canvas canvas, floa
11411141

11421142
// Prepare the name of the event.
11431143
SpannableStringBuilder bob = new SpannableStringBuilder();
1144-
if (event.getName() != null) {
1144+
if (!TextUtils.isEmpty(event.getName())) {
11451145
bob.append(event.getName());
11461146
bob.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, bob.length(), 0);
1147-
bob.append(' ');
11481147
}
1149-
11501148
// Prepare the location of the event.
1151-
if (event.getLocation() != null) {
1149+
if (!TextUtils.isEmpty(event.getLocation())) {
1150+
if (bob.length() > 0)
1151+
bob.append(' ');
11521152
bob.append(event.getLocation());
11531153
}
11541154

0 commit comments

Comments
 (0)