How to use `PagingEpoxyController` with a header?
See original GitHub issueWhat I’d like to do: Display a list of items (this is a PagedList, because I use the paging lib to request data as I scroll) but also have a header at the top.
With a normal TypedEpoxyController
, I can achieve this by having some state type that contains the header and the list, and I set it using TypedEpoxyController.setData()
.
However, inside the PagingEpoxyController
, all I have the option for is submitList(pagedList)
or submitList(itemList)
and I’m not sure how to approach including a header in all of this. Any nudges in the right direction could help.
If I’m able to get this working, I’m more than happy to contribute back with a PR including samples of doing this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
2021 Android Guide: Paging 3 adding headers! - YouTube
This video completes our implementation of adding headers to our PagedList while working with the Paging 3 library!
Read more >Exploring Paging3 — Part 2. Learn how to add header, footer ...
This article will learn how to add custom footers, headers, separators, and retry layouts to the paging adapter with code snippets. You'll also ......
Read more >The Recyclerview List Refresh Incorretly When Using Paging ...
I have a RecyclerView with PagingEpoxyController, and when I insert some data to if you use equals, your object must properly override Object#equals() ......
Read more >add list section headers with PagedListAdapter / PagedList
I'd like to headers in a list using the android.arch.paging components. ... Usually this would easy enough, just add different types for a ......
Read more >sticky-header-linear-layout-manager - epoxy 4.5.0 javadoc
isStickyHeader to indicate which items are sticky. Example usage: class StickyHeaderController() : EpoxyController() { override fun isStickyHeader(position: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve just published 2.18.0 release, which includes a new, improve paged list support (created by Yigit from the Android team). Check out the wiki that I just updated too: https://github.com/airbnb/epoxy/wiki/Paging-Support
TLDR: extend
PagedListEpoxyController
to create your controller. overridebuildItemModel
to define how each item in the paged list gets converted to an epoxy model. then overrideaddModels
to modify the items list to add headers or whatever other changes you want.Edit: It seems like part of your confusion is a
TypedEpoxyController
vs a base EpoxyController. With the typed controller you specific all of your data viasetData
as a helper. In a basic controller, like the paging controller you have to set it manually. This could be anything you want, like a constructor param, or a simple field. Just callrequestModelBuild
if it ever changes. This doesn’t have to do with paging so much, its the same as a normal epoxy controllerSeems like something like that should work: