Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is it okay to initialize endlessly scrolling adapter with null? #269

Closed
shymmq opened this issue Jan 19, 2017 · 2 comments
Closed

Is it okay to initialize endlessly scrolling adapter with null? #269

shymmq opened this issue Jan 19, 2017 · 2 comments

Comments

@shymmq
Copy link
Contributor

shymmq commented Jan 19, 2017

I was wondering if I always have to add some starting elements in order to endless scroll to work?
Let's say I initialize my adapter with FlexibleAdapter<IFlexible> adapter = new FlexibleAdapter<>(null);
Then i set EndlessScrollListener on it, for example adapter.setEndlessScrollListener(this, progressItem);.
In this case, will onLoadMore fire on startup? In all examples i have seen there are some starting items.
Is this considered a good practice?

@davideas
Copy link
Owner

@shymmq, indeed, at the moment you need to bind something to trigger it (not the progressItem!), one item is necessary.
If I added if (getItemCount() == 0) onLoadMore(0); when setting the first time the progress, it will start automatically. But you can tell me better, since you are using it more than me: when adapter is empty at startup, better an implicit automatic start or a boolean settings?

However, this also works: your remote method at startup and also show the progressItem with mAdapter.addScrollableFooter(mProgressItem);

@shymmq
Copy link
Contributor Author

shymmq commented Jan 19, 2017

Thank you, that makes sense. I think that something like adapter.loadMoreOnStartup(boolean b) would be perfect. It should be set to false by default, though, so it doesn't break any old code.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants