Skip to content

Commit fec85ae

Browse files
author
marunjar
committed
fix height of last hour
addresses #163 onDraw: add missing height for checking minimum of mCurrentOrigin.y scroller.fling: add missing height to minY in so fling can scroll to full last hour
1 parent c1f7d0b commit fec85ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve
175175
mScroller.fling((int) mCurrentOrigin.x, 0, (int) (velocityX * mXScrollingSpeed), 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
176176
}
177177
else if (mCurrentFlingDirection == Direction.VERTICAL){
178-
mScroller.fling(0, (int) mCurrentOrigin.y, 0, (int) velocityY, 0, 0, (int) -(mHourHeight * 24 + mHeaderTextHeight + mHeaderRowPadding * 2 - getHeight()), 0);
178+
mScroller.fling(0, (int) mCurrentOrigin.y, 0, (int) velocityY, 0, 0, (int) -(mHourHeight * 24 + mHeaderTextHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom + mTimeTextHeight/2 - getHeight()), 0);
179179
}
180180

181181
ViewCompat.postInvalidateOnAnimation(WeekView.this);
@@ -500,8 +500,8 @@ else if(mNewHourHeight > mMaxHourHeight)
500500
}
501501

502502
//if the new mCurrentOrigin.y is invalid, make it valid.
503-
if (mCurrentOrigin.y < getHeight() - mHourHeight * 24 - mHeaderTextHeight - mHeaderRowPadding * 2 - mHeaderMarginBottom)
504-
mCurrentOrigin.y = getHeight() - mHourHeight * 24 - mHeaderTextHeight - mHeaderRowPadding * 2 - mHeaderMarginBottom;
503+
if (mCurrentOrigin.y < getHeight() - mHourHeight * 24 - mHeaderTextHeight - mHeaderRowPadding * 2 - mHeaderMarginBottom - mTimeTextHeight/2)
504+
mCurrentOrigin.y = getHeight() - mHourHeight * 24 - mHeaderTextHeight - mHeaderRowPadding * 2 - mHeaderMarginBottom - mTimeTextHeight/2;
505505
//Don't put an else if because it will trigger a glitch when completly zoomed out and scrolling vertically.
506506
if(mCurrentOrigin.y > 0)
507507
mCurrentOrigin.y = 0;

0 commit comments

Comments
 (0)