Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minute interval #43

Open
hamfatfat opened this issue Jun 9, 2016 · 0 comments
Open

Minute interval #43

hamfatfat opened this issue Jun 9, 2016 · 0 comments
Labels

Comments

@hamfatfat
Copy link

hi,

I am adding minute to timeline widget and i changed minutes interval to 5 minutes
public static final long MINUTE_INTERVAL = 5*60 * 1000;

after scrolling the interval display wrong values
[capture1]

`private void fillTimelineForMinuteResolution(final long startDate, long endDate, final int left) {
firstDay = true;
fillTimelineForMinuteResolution(MINUTE_INTERVAL, startDate, endDate, new ResolutionBlockFiller() {

        int minuteCounter = getFirstMinuteOfVisibleRange(startDate);
        boolean even = isEven(startDate);

        @Override
        public void fillResolutionBlock(int index, Date date, String currentYear, boolean lastTimelineBlock) {
            int childCount = getResolutionDiv().getChildCount();
            if (isValidChildIndex(index, childCount)) {
                DivElement resBlock = DivElement.as(Element.as(getResolutionDiv().getChild(index)));
                fillMinuteResolutionBlock(resBlock, date, index, minuteCounter, lastTimelineBlock, left, even);
                minuteCounter = (minuteCounter + 1) % 60;
                even = !even;
            } else {
                logIndexOutOfBounds("minute", index, childCount);
                return;
            }
        }

        private boolean isEven(long startDate) {
            long normalDate = toNormalDate(startDate);
            if (normalStartDate < normalDate) {
                int minutes = (int) ((normalDate - normalStartDate) / MINUTE_INTERVAL);
                return (minutes % 2) == 1;
            }
            return false;
        }

        private int getFirstMinuteOfVisibleRange(long startDate) {
            long normalDate = toNormalDate(startDate);
            if (normalStartDate < normalDate) {
                int minutes = (int) ((normalDate - normalStartDate) / MINUTE_INTERVAL);
                return ((firstMinuteOfRange + minutes) % 60);
            }
            return firstMinuteOfRange;
        }
    });
}`

in
capture
capture1

Best Regards,
Hamzeh

@tltv tltv added the question label Sep 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants