Android-Week-View
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.
@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
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