Skip to content

Conversation

@nolsigan
Copy link

When trying to do stuffs like auto scrolling,
setCurrentItem has to be used for every auto scroll.

Current version of setCurrentItem can't be used more than once because it adds offset to item every time.

This pull request resolves the issue.

}
item = getOffsetAmount() + (item % getAdapter().getCount());
// offset only for the first time
if (item < getOffsetAmount())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the first action is to scroll back the offset is still added.
I would recommend to get half of offset amount
if (item < getOffsetAmount() / 2)

eg. when offset is 1000 and you scroll back - the function returns 1999 it would be better to return 999

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I missed back scroll part. I fixed it as you recommended. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants