redgram-for-reddit
redgram-for-reddit copied to clipboard
LinksView - App becomes unresponsive when loading big images in the preview of a post
Happens right after loading images like the one in this post. It continues unresponsive and laggy even if you scroll down or lose the preview out of sight, the only way to resolve the issue is to restart the app.
#20
https://github.com/Redgram/redgram-for-reddit/blob/master/Redgram/app/src/main/java/com/matie/redgram/ui/common/views/widgets/postlist/dynamic/PostItemImageView.java#L65
setImageRequest
should be setLowResImageRequest
https://github.com/Redgram/redgram-for-reddit/blob/master/Redgram/app/src/main/java/com/matie/redgram/data/managers/media/video/ImageManager.java#L89
In here I'm not even requesting the thumbnail anywhere.
@MohamadAtieh I'm taking a look at it right now. At the moment of loading the image in the PostItemImageView
should I use setThumbnail
with the URL (getUrl()
) or the thumbnail of the image (getThumbnail()
)? I tried both and with the original URL it looks much better but it consumes more data (as expected).
Maybe we can even move this to an option in the settings to allow the user to specify whether they want to limit the data usage?
Yes, we can do that but we need to understand the definition of low and high quality images. Once we do that, we need to explore ways to turn that media viewer into a separate component that can resolve a given request (url), check the cache, then request the real thing. If we are loading a low res image at first and then they click on the image to view a better one, there should be a mechanism to check the cache request the image.
So I would say:
- Determine what's available to show
- Design a component that deals with any kind of media efficiently
- Embed settings into that component as parameters.
The last point is important. The media component should be unaware of the preferences we store and recognize them as parameters that are set upon calling that component based on the state of the user.
What do you think?
https://www.reddit.com/hot.json?compact=true.json
This is an example of a listing that is returned from the API.