Skip to content

Commit

Permalink
fix display current time line & onEmptyViewClicked
Browse files Browse the repository at this point in the history
  • Loading branch information
khacpv committed Jul 4, 2016
1 parent 3ed0eb4 commit bf5735f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/src/main/java/com/alamkanak/weekview/WeekView.java
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,9 @@ else if (day.before(today)) {
if (mShowNowLine && sameDay){
float startY = mHeaderHeight + mHeaderRowPadding * 2 + mTimeTextHeight/2 + mHeaderMarginBottom + mCurrentOrigin.y;
Calendar now = Calendar.getInstance();
float beforeNow = (now.get(Calendar.HOUR_OF_DAY) + now.get(Calendar.MINUTE)/60.0f) * mHourHeight;
canvas.drawLine(start, startY + beforeNow, startPixel + mWidthPerDay, startY + beforeNow, mNowLinePaint);
float beforeNow = (now.get(Calendar.HOUR_OF_DAY) - mStartTime + now.get(Calendar.MINUTE)/60.0f) * mHourHeight;
float top = startY + beforeNow;
canvas.drawLine(start, top, startPixel + mWidthPerDay, top, mNowLinePaint);
}

// In the next iteration, start from the next day.
Expand Down Expand Up @@ -772,7 +773,7 @@ private Calendar getTimeFromPoint(float x, float y){
- mHeaderRowPadding * 2 - mTimeTextHeight/2 - mHeaderMarginBottom;
int hour = (int)(pixelsFromZero / mHourHeight);
int minute = (int) (60 * (pixelsFromZero - hour * mHourHeight) / mHourHeight);
day.add(Calendar.HOUR, hour);
day.add(Calendar.HOUR, hour + mStartTime);
day.set(Calendar.MINUTE, minute);
return day;
}
Expand Down

0 comments on commit bf5735f

Please sign in to comment.