Closed shunf4 closed 2 days ago
It sounds it's related to Androidx paging library. I got some problems with this library, I hope 3.0 will be better quality though.
Enabling placeholders in buildPagedList()
will fix this.
https://github.com/readrops/Readrops/blob/28dda2f1b514a470cd6a12a11bcc717b200e8bdb/app/src/main/java/com/readrops/app/itemslist/MainViewModel.java#L75
In addition, we should check for null after getItem(position)
in getPreloadItems
since it now can be null.https://github.com/readrops/Readrops/blob/28dda2f1b514a470cd6a12a11bcc717b200e8bdb/app/src/main/java/com/readrops/app/itemslist/MainItemListAdapter.java#L221
Will there be other side effects?
When I implemented the paging library, I didn't want to handle null items and as the scrolling bar behavior didn't bother me, I disabled the placeholders.
Are you sure this will fix the bug?
Are you sure this will fix the bug?
Yes.
Another place to take care of https://github.com/readrops/Readrops/blob/28dda2f1b514a470cd6a12a11bcc717b200e8bdb/app/src/main/java/com/readrops/app/itemslist/MainItemListAdapter.java#L153
Then I believe at least there would not be any NullPointerException crash. I've been using my modified version and so far, so good.
With the upcoming 2.0, this should be fixed.