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

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

Open bittergourdbd opened this issue 7 years ago • 2 comments

bittergourdbd avatar Oct 16 '18 14:10 bittergourdbd

@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

AndroidDeveloperLB avatar Feb 12 '19 18:02 AndroidDeveloperLB

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

benni12er avatar Mar 04 '19 14:03 benni12er