summaryrefslogtreecommitdiff
path: root/java/src-debug
diff options
context:
space:
mode:
author Andrey Epin <ayepin@google.com> 2023-05-11 18:03:10 -0700
committer Andrey Epin <ayepin@google.com> 2023-05-11 22:02:44 -0700
commita418a7e57a4856efae1bc5511ad24944a640da63 (patch)
tree16b4e57a0717f5ea3cc1d9ac0c4881b6cba8c73b /java/src-debug
parent60910d0b4bd0381a6e3f86b851b65c7b76a2d27b (diff)
Retain the image loader through configuration change
Make PreviewViewModel own an image loader instance. This required ImagePreviewImageLoader to: * receive a CoroutineScope instance instead of a Lifecycle as ViewModel does not offer an associated Lifecycle; * make ImagePreviewImageLoader#loadImage to receive a caller's Lifecycle to avoid potential memory (Activity) leak. With ImagePreviewImageLoader now receiving a scope, the dispatcher argument is dropped as a scope can be configured with a proper dispatcher. As ChooserActivity is no longer responsible for the image loader instantiation, to facilitate testing, a method hook to create an image loader is replaced with a method hook to create a preview view model and all the associated plumbing is done for the tests. Plus some kfmt complience changes. ImagePreviewImageLoader (and ImagePreviewImageLoaderTest) is moved into contentpreview package as it's accessed only from within this package. Fix: 282029067 Test: manual testing with an injected debug logging Change-Id: I5dcdee2599714a2c51c3e1b63f5c727e43b26f6a
Diffstat (limited to 'java/src-debug')
0 files changed, 0 insertions, 0 deletions