Verified
Status Update
Comments
yb...@google.com <yb...@google.com> #2
ViewModels need to be cleared on Fragments that are being really destroyed, where "really destroyed" means that they are being destroyed without their state being saved, indicating that there's no chance they are going to be restored at a later time.
Unfortunately, isStateSaved(), despite its name, does double duty as a check on whether it is safe to do Fragment Transactions and is always true after onStop(), meaning it can be true even if the state has really not been saved, oddly enough.
We'll just not use isStateSaved() here and rely on a separate indicator for the "really destroyed" case.
Unfortunately, isStateSaved(), despite its name, does double duty as a check on whether it is safe to do Fragment Transactions and is always true after onStop(), meaning it can be true even if the state has really not been saved, oddly enough.
We'll just not use isStateSaved() here and rely on a separate indicator for the "really destroyed" case.
Description
Version used: 1.0.0-alpha5
Devices/Android versions reproduced on: n/a
A PagedList has access to the DataSource that we supply to page against. Admittedly, in the current PagedList implementation, that is buried under some wrapper layers.
Some DataSource implementations may require us to clean them up when we are done with them (e.g., to avoid garbage collection issues). When we are done with a PagedList, in many cases we are done with the DataSource backing that PagedList. It stands to reason that we should be able to retrieve our DataSource from the PagedList in order to be able to clean it up (e.g., call some close() method).
Thanks for considering this!