Load preivews eagerly
Currently, content preview is not started until the metadata for all the
shared URIs is loaded.
This CL changes it to eagerly loaded previews i.e. previews are getting
loaded as soon as the corresponding metadata becomes available.
This is achieved by:
* Adding support for a Flow as a preview source into
ScrollableImgePreviewView (patchset #1);
Specifically, as a Flow may never complete, the flow collection is
cancelled in `onDetachFromWindow` to avoid possible memory leaks.
The view is used inside a RecyclerView (the single-profile case) and
can be attached and detached multiple times per one `setPreviews`
call. Thus BatchPreviewLoader is made relaunchable and captures a
notion of a pending loading job; `#batchLoader` value gets updated
accordingly. (patchset #8)
* Make PreviewDataProvider expose a Flow of shared URIs metadata,
FileInfo (patchset #2, #3);
* Make content preview classes to pass the Flow from PreviewDataProvider
to ScrollableImagePreviewView (patchset #4).
Bug: 292157413
Test: manual testing with ShareTest app: with and without artificial
image loading delays, orientation changes and on single- and
multi-profile cases.
Test: unit tests
Test: integration test
Change-Id: Ib663bab8917624493a9ba619e64e4cb81fa35a93
13 files changed