After a lot of searching, I know its possible with regular adapter, but I have no idea how to do it using Paging Library. I don`t need code just a clue.
Example
Kiskae's answer is excellent and for your case option 2 probably works well.
In my case I wanted to have one additional item that wasn't in the database, like this:
It needed to be clickable as well. There's the usual way of overriding getItemCount
to return +1 and offsetting positions for the other methods.
But I stumbled on another way that I haven't seen documented yet that might be useful for some cases. You might be able to incorporate additional elements into your query using union
:
@Query("select '' as name, 0 as id " +
"union " +
"select name, id from user " +
"order by 1 asc")
DataSource.Factory getAllDataSource();
That means the data source actually returns another item in the beginning, and there's no need to adjust positions. In your adapter, you can check for that item and handle it differently.
In your case the query would have to be different but I think it would be possible.