Android-Week-View
Android-Week-View copied to clipboard
How to show half hour?
How to show 8, 8:30, 9, 9:30...?
I know there is answer here: https://github.com/alamkanak/Android-Week-View/issues/99 Sorry for noob question , but i didnt realize how to implement it.
Create event: Date d = new Date(Long.valueOf(singleEvent.getStartTime())); Calendar cStart = Calendar.getInstance(); Calendar cEnd = (Calendar) cStart.clone(); cEnd.add(Calendar.MINUTE, 30); event.setStartTime(cStart); event.setEndTime(cEnd);
Add it to your array of events events.add(event)
Update the view mWeekView.notifyDatasetChanged()
With this you create event which last 30 minutes. What I want is to show time on Week-view with a range of 30 minutes
Has anyone resolve this? I also need this, and cannot find solution.
There is code for 1 hour find that like this:
// Prepare the separator lines for hours.
int i = 0;
for (int hourNumber = 0; hourNumber < (MAX_HOUR - MIN_HOUR); hourNumber++) {
float top = mHeaderHeight + mHeaderRowPadding * 2 + mCurrentOrigin.y + mHourHeight * hourNumber + mTimeTextHeight/2 + mHeaderMarginBottom;
if (top > mHeaderHeight + mHeaderRowPadding * 2 + mTimeTextHeight/2 + mHeaderMarginBottom - mHourSeparatorHeight && top < getHeight() && startPixel + mWidthPerDay - start > 0){
hourLines[i * 4] = start;
hourLines[i * 4 + 1] = top;
hourLines[i * 4 + 2] = startPixel + mWidthPerDay;
hourLines[i * 4 + 3] = top;
i++;
}
}
Just Replace with:
/*For half hour coding start*/
int i = 0;
for (int hourNumber = 0; hourNumber < (MAX_HOUR - MIN_HOUR); hourNumber++) {
float top = mHeaderHeight + mHeaderRowPadding * 2 + mCurrentOrigin.y + mHourHeight * hourNumber + mTimeTextHeight / 2 + mHeaderMarginBottom;
if (top > mHeaderHeight + mHeaderRowPadding * 2 + mTimeTextHeight/2 + mHeaderMarginBottom - mHourSeparatorHeight && top < getHeight() && startPixel + mWidthPerDay - start > 0) {
for (int j = 0; j < 2; ++j, ++i) {
hourLines[i * 4] = start;
hourLines[i * 4 + 1] = top + mHourHeight * j / 2;
hourLines[i * 4 + 2] = startPixel + mWidthPerDay;
hourLines[i * 4 + 3] = top + mHourHeight * j / 2;
}
}
}
/*For Half hour coding ends*/