Skip to content

Commit 58a11a1

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 39fd130 + 8aa4ec6 commit 58a11a1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
400400

401401
// If the week view is being drawn for the first time, then consider the first day of the week.
402402
if(mNumberOfVisibleDays >= 7 && mToday.get(Calendar.DAY_OF_WEEK) != mFirstDayOfWeek) {
403-
int difference = 7 + (mToday.get(Calendar.DAY_OF_WEEK) - mFirstDayOfWeek);
403+
int difference = (7 + (mToday.get(Calendar.DAY_OF_WEEK) - mFirstDayOfWeek)) % 7;
404404
mCurrentOrigin.x += (mWidthPerDay + mColumnGap) * difference;
405405
}
406406
}
@@ -851,7 +851,11 @@ else if (!isEventsCollide(eventRect.event, column.get(column.size()-1).event)) {
851851

852852

853853
// Calculate left and right position for all the events.
854-
int maxRowCount = columns.get(0).size();
854+
// Get the maxRowCount by looking in all columns.
855+
int maxRowCount = 0;
856+
for (List<EventRect> column : columns){
857+
maxRowCount = Math.max(maxRowCount, column.size());
858+
}
855859
for (int i = 0; i < maxRowCount; i++) {
856860
// Set the left and right values of the event.
857861
float j = 0;

0 commit comments

Comments
 (0)