File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
library/src/main/java/com/alamkanak/weekview Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -517,7 +517,7 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
517
517
mHeaderColumnWidth = mTimeTextWidth + mHeaderColumnPadding *2 ;
518
518
mWidthPerDay = getWidth () - mHeaderColumnWidth - mColumnGap * (mNumberOfVisibleDays - 1 );
519
519
mWidthPerDay = mWidthPerDay /mNumberOfVisibleDays ;
520
- int maxAmountOfAllDayEventsInOneDay = 0 ;
520
+ boolean containsAllDayEvent = false ;
521
521
if (mEventRects != null && mEventRects .size () > 0 ) {
522
522
for (int dayNumber = 0 ;
523
523
dayNumber < mNumberOfVisibleDays ;
@@ -528,13 +528,21 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
528
528
for (int i = 0 ; i < mEventRects .size (); i ++) {
529
529
530
530
if (isSameDay (mEventRects .get (i ).event .getStartTime (), day ) && mEventRects .get (i ).event .isAllDay ()) {
531
- amountOfAllDayEvents ++;
531
+ containsAllDayEvent = true ;
532
+ break ;
532
533
}
533
534
}
534
- maxAmountOfAllDayEventsInOneDay = Math .max (maxAmountOfAllDayEventsInOneDay , amountOfAllDayEvents );
535
+ if (containsAllDayEvent ){
536
+ break ;
537
+ }
535
538
}
536
539
}
537
- mHeaderHeight = mHeaderTextHeight + (mAllDayEventHeight + mHeaderMarginBottom ) * Math .min (1 , maxAmountOfAllDayEventsInOneDay );
540
+ if (containsAllDayEvent ) {
541
+ mHeaderHeight = mHeaderTextHeight + (mAllDayEventHeight + mHeaderMarginBottom );
542
+ }
543
+ else {
544
+ mHeaderHeight = mHeaderTextHeight ;
545
+ }
538
546
Calendar today = today ();
539
547
540
548
if (mAreDimensionsInvalid ) {
You can’t perform that action at this time.
0 commit comments