Android-Week-View icon indicating copy to clipboard operation
Android-Week-View copied to clipboard

How to show half hour?

Open ghost opened this issue 7 years ago • 4 comments

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.

ghost avatar Dec 14 '17 08:12 ghost

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()

yoninezer avatar Jan 06 '18 21:01 yoninezer

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

ghost avatar Jan 06 '18 22:01 ghost

Has anyone resolve this? I also need this, and cannot find solution.

Vidoje avatar Aug 30 '18 09:08 Vidoje

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*/

Hanif-abuvani avatar Aug 31 '18 11:08 Hanif-abuvani