Skip to content

Commit c9437aa

Browse files
committed
Merge branch 'pr/138' into develop
2 parents 8aa4ec6 + 7341ef3 commit c9437aa

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,16 +1424,18 @@ public void notifyDatasetChanged(){
14241424
* @param hour The hour to scroll to in 24-hour format. Supported values are 0-24.
14251425
*/
14261426
public void goToHour(double hour){
1427-
int verticalOffset = (int) (mHourHeight * hour);
1428-
if (hour < 0)
1429-
verticalOffset = 0;
1430-
else if (hour > 24)
1431-
verticalOffset = mHourHeight * 24;
1432-
14331427
if (mAreDimensionsInvalid) {
14341428
mScrollToHour = hour;
14351429
return;
1436-
} else if (verticalOffset > mHourHeight * 24 - getHeight() + mHeaderTextHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom)
1430+
}
1431+
1432+
int verticalOffset = 0;
1433+
if (hour > 24)
1434+
verticalOffset = mHourHeight * 24;
1435+
else if (hour > 0)
1436+
verticalOffset = (int) (mHourHeight * hour);
1437+
1438+
if (verticalOffset > mHourHeight * 24 - getHeight() + mHeaderTextHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom)
14371439
verticalOffset = (int)(mHourHeight * 24 - getHeight() + mHeaderTextHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom);
14381440

14391441
mCurrentOrigin.y = -verticalOffset;

0 commit comments

Comments
 (0)