I'm using the Paging Architecture Components in my project to load a list from the network (no database usage yet). My DataSource is a PositionalDataSource subclass, and my PagedList.Config looks like this:
PagedList.Config config = new PagedList.Config.Builder()
.setPageSize(10)
.setInitialLoadSizeHint(20)
.setPrefetchDistance(20)
.setEnablePlaceholders(true)
.build();
Placeholders are enabled, and I handle null ViewHolders in my PagedListAdapter subclass to display placeholder items differently. The placeholders work fine when loading additional items at the end of the list, but I also want to display a placeholder item before the first few items are loaded (like a regular loading indicator).
Is there a way to do this with the Paging library? I tried to call LoadInitialCallback.onResult() with a position of 1 instead of 0, but this only creates a placeholder item before the first real item, and that placeholder item never disappears.