[Discussion] Image Handling Improvements
See original GitHub issueIssue details / Repro steps / Use case background: In this library, handling the memory used by images is not managed at all, which leads to OOMs on several devices(e.g. #551 )I would like to discuss, how we can improve the image handling on our library. I have a few ideas:
-
Scaling drawables(as Bitmaps) before setting them to their respective imageviews.***
-
For even better support you can take a look at these links:
a) https://developer.android.com/topic/performance/graphics/manage-memory
b) https://developer.android.com/topic/performance/graphics/cache-bitmap
c) https://blog.booking.com/android-reuse-bitmaps.html
OR
- We provide separate modules that use Image loading libraries like Glide, Picasso for loading images as optional dependencies along with our library (probably the easiest).
OR
- We could provide a way for the user to get imageviews so that an image loading library can be used(probably not recommended).
***: Highly recommended regardless of approach taken.
Tell me your thoughts on which approach is better and if you know of any other alternative.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Having some layer that takes care of image loading is ok for me. I’m not sure if we want to add anyway a method to get the ImageView from the default intro: it’s true that some devs could use other libaries or internal solutions to handle image loading but it’s also true they can simply write a slide fragment and handle resources themself.
Hey @AnuthaDev I’ll probably go for either 3 or 4.
Can you please justify why you would go for option 1 rather than the others?
My point of view is: 3 - I would generally like the idea of having some sort of abstraction layer that takes care of loading images. Then we can publish an
appintro-image-glide
orapp-image-picasso
to provide binding with the common libraries.4 - That’s the quick and dirty solution. Just expose an
ImageView
to the user, he will take care of loading the content inside. It will anyway break the encapsulation principle and is generally not the best solution.