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

Scrollable Header appears under main items in endlessly scrolling list (rc4) #552

Closed
shymmq opened this issue Feb 23, 2018 · 0 comments
Closed
Milestone

Comments

@shymmq
Copy link
Contributor

shymmq commented Feb 23, 2018

I'm initializing the adapter using this code:

adapter.setEndlessScrollListener(this, ProgressItem())
                .setEndlessScrollThreshold(Config.scrollThreshold)
                .setLoadingMoreAtStartUp(true)
adapter.endlessPageSize = Config.pageSize

adapter.addScrollableHeader(AddUsItem())

fragment_post_list_recycler.layoutManager = LinearLayoutManager(activity)
fragment_post_list_recycler.adapter = adapter

and my endless scroll listener looks like this:

override fun noMoreLoad(newItemsSize: Int) = println("All posts loaded")

    override fun onLoadMore(lastPosition: Int, currentPage: Int) {
        viewModel.loadPage(currentPage).subscribe { posts ->
            val postItems = posts.mapIndexed { index: Int, post: Post ->
                val showAd = (index + lastPosition + 1) % adFrequency == 0
                PostItem(post, showAd)
            }
            adapter.onLoadMoreComplete(postItems)
        }
    }

The header always appears under main items, but above progress item.

I have downgraded to v5.0.0-rc3 for now, which seems to have solved the issue.

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

No branches or pull requests

2 participants