alamkanak / Android-Week-View

Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Apache License 2.0
3.42k stars 1.23k forks source link

In 7 days view, I want when scroll view, it will scroll one to every 7 days, please help me, thanks very much. #529

Open bittergourdbd opened 5 years ago

AndroidDeveloperLB commented 5 years ago

@bittergourdbd I suggest trying out my fork for this repository. I've updated there a lot of things, fixed issues, and I've made it clearer for modification. It might have what you need. Sadly it can never be so customizable due to the amount of drawing within a single View, though. Please check it out here: https://github.com/AndroidDeveloperLB/Android-Week-View

benni12er commented 5 years ago

line 2570:

if (mNumberOfVisibleDays == 7) {
            if (mCurrentFlingDirection != Direction.NONE) {
                // snap to nearest day
                leftDays = 7 * Math.round(leftDays / 7);
            } else if (mCurrentScrollDirection == Direction.LEFT) {
                // snap to last day
                leftDays = 7 * Math.floor(leftDays / 7);
            } else if (mCurrentScrollDirection == Direction.RIGHT) {
                // snap to next day
                leftDays = 7 * Math.ceil(leftDays / 7);
            } else {
                // snap to nearest day
                leftDays = 7 * Math.round(leftDays / 7);
            }
        } else {
            if (mCurrentFlingDirection != Direction.NONE) {
                // snap to nearest day
                leftDays = Math.round(leftDays);
            } else if (mCurrentScrollDirection == Direction.LEFT) {
                // snap to last day
                leftDays = Math.floor(leftDays);
            } else if (mCurrentScrollDirection == Direction.RIGHT) {
                // snap to next day
                leftDays = Math.ceil(leftDays);
            } else {
                // snap to nearest day
                leftDays = Math.round(leftDays);
            }
        }

Code speaks for itself