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

What is 'isLeftOverScrolled'? #12

Closed
HanderWei opened this issue Dec 1, 2016 · 1 comment
Closed

What is 'isLeftOverScrolled'? #12

HanderWei opened this issue Dec 1, 2016 · 1 comment
Labels

Comments

@HanderWei
Copy link

HanderWei commented Dec 1, 2016

private Pair<Integer, Float> getProgress(int position, float positionOffset) {
    boolean isRightOverScrolled = position > selectedPosition;
    boolean isLeftOverScrolled = position + 1 < selectedPosition;
    if (isRightOverScrolled || isLeftOverScrolled) {
        Log.d(TAG, "getProgress: " + (isRightOverScrolled ? "isRightOverScrolled" : "isLeftOverScrolled"));
        Log.d(TAG, "getProgress: " + "position :" + position + "\t selectedPosition:" + selectedPosition);
        selectedPosition = position;
    }
    ...
}

isRightOverScrolled means that scrolled to the right page.

I think isRightOverScrolled means scrolled to the left page.

But when I print the log, it does't show.

@romandanylyk @vdubedout Any help will be highly appreciated.

@romandanylyk
Copy link
Owner

romandanylyk commented Dec 19, 2016

Hi @HanderWei.
getProgress method has this if operator to cover one interesting thing in ViewPager.
While scrolling really fast from page to page, ViewPager 's positionOffset could not be 1.0 for every scrolled page. And because I set a new selected page every time positionOffset is 1.0, I need this to properly update selected page number.

So basically it is required check if PageIndicatorView works with a right page at the moment.
Hope it will help you to understand how it works.
Thanks.

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