Open anisias opened 6 years ago
I am having this problem as well after setting max and min time attr. I tried your change but unfortunately it doesn't help with the problem.
I modified also other parts of this method, do you have problems when current hour > maxTime, when current hour > minTime or in both cases? This is my current method:
public void goToHour(double hour) {
if (mAreDimensionsInvalid) {
mScrollToHour = hour;
return;
}
int verticalOffset = 0;
if (hour > mMinTime && hour < mMaxTime) {
verticalOffset = (int) (mHourHeight * (hour - mMinTime));
}
if (verticalOffset > mHourHeight * (mMaxTime - mMinTime) - getHeight() + mHeaderHeight + mHeaderMarginBottom) {
verticalOffset = (int) (mHourHeight * (mMaxTime - mMinTime) - getHeight() + mHeaderHeight + mHeaderMarginBottom);
}
mCurrentOrigin.y = -verticalOffset;
invalidate();
mScroller.forceFinished(true);
}
Hope it helps
Yes it works now! Thanx soo much!
If a time range is set and goToHour(currentTime) method is called the view will not scroll to currentTime hour because of a bug in goToHour method
https://github.com/Quivr/Android-Week-View/blob/2a5f09a6c6ccad3158491acb8c3b05eaf8150b1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L2677
it should be verticalOffset = (int) (mHourHeight * (hour - mMinTime)); otherwise it works only with the default range of 0-24