redgram-for-reddit icon indicating copy to clipboard operation
redgram-for-reddit copied to clipboard

LinksView - App becomes unresponsive when loading big images in the preview of a post

Open sleepyfran opened this issue 8 years ago • 5 comments

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.

sleepyfran avatar Nov 08 '16 23:11 sleepyfran

#20

mhdatie avatar Nov 14 '16 03:11 mhdatie

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.

mhdatie avatar Nov 15 '16 15:11 mhdatie

@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?

sleepyfran avatar Dec 01 '16 19:12 sleepyfran

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:

  1. Determine what's available to show
  2. Design a component that deals with any kind of media efficiently
  3. 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?

mhdatie avatar Dec 03 '16 07:12 mhdatie

https://www.reddit.com/hot.json?compact=true.json

This is an example of a listing that is returned from the API.

mhdatie avatar Dec 03 '16 07:12 mhdatie