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

does not work with swipe to refresh layout #11

Open
sharmaraju352 opened this issue May 26, 2017 · 6 comments
Open

does not work with swipe to refresh layout #11

sharmaraju352 opened this issue May 26, 2017 · 6 comments
Labels

Comments

@sharmaraju352
Copy link

it works great on single use. but when i scroll down and go up again to refresh the contents then recyclerview starts from random index instead of starting from 0th index. while refreshing i am calling the same methods again these are
items = createItems();
initRecyclerView();

@pwittchen pwittchen added the bug label May 26, 2017
@pwittchen
Copy link
Owner

Hi @sharmaraju352,

Thanks for reporting that issue. I'll take a look on that when I have some time.

@sharmaraju352
Copy link
Author

and one more thing..why it needs number_of_items to be in the table of MAX_ITEMS_PER_REQUEST. it crashes if i assign the number which is not in the table.

@pwittchen
Copy link
Owner

"Max items per request" is a number of items per single "page". The library needs to know how many items it should load on start and when scroll reaches the bottom of the list of currently loaded items.

@sharmaraju352
Copy link
Author

yes i got that.but i am fetching my notifications from server and the number of notifications on the server is unknown initially.i am keeping MAX_ITEMS_PER_REQUEST=20 initially. if i detect that the number of notifications from server is less than MAX_ITEMS_PER_REQUEST then i am assingning the number of notification from server to MAX_ITEMS_PER_REQUEST.it is working flawlessly until this point.but the problem is if i have 21 notifications on my server then it will load first 20 but as soon as i scroll down it crashes.i am not able to change the value of MAX_ITEMS_PER_REQUEST dynamically.i want to assign MAX_ITEMS_PER_REQUEST=no_of_notifications_on_server%MAX_ITEMS_PER_REQUEST;

@sharmaraju352
Copy link
Author

how do i tell adapter about this change

@pwittchen
Copy link
Owner

It's a separate problem. Please, create another issue for that.

Quick answer:

Now the library is not able to do that.

We can extend the library to allow to set max items per request inside InfiniteScrollListener, but it will reduce code immutability. After that, you can listen to notifications from the server and set max items per request dynamically for the listener whenever you'll receive notification from the server.

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