Closed realitix closed 7 years ago
This pull request fix #104
@realitix Thanks for the PR! It works like a charm, but trying a gif image ends up with a blank. Do you think you could get it to work? thanks!
Indeed I didn't try with a gif, my bad! I will take a look tomorrow.
thanks!
After few tries. I noticed that it works but it's very long. I think that glide resizes the gif for each frame which explains why it's so long. When I restart the APP, it's very fast, so glide must have a cache. When the gif is in background, animation is not played, I will check with a single frame gif but it should be fast. It's useless to put a multi-frame gif to the body background. (Unless animation plays for you ?) Can you retry and wait 1 minute (it depends on the gif size and frame number) ?
I wait for your comment @gliechtenstein
Yes I think Glide does something like that.
That said, if you try switching to develop branch and try to render the same gif, it does display the gif (although we still have a problem of it only displaying the first frame)
I have played around with various configurations, and looks like it works if you use the default suggested approach of using asGif()
, which JasonImageComponent but not when you try to run any sort of manipulation on it and then try to render.
Fortunately most images on Jasonette are rendered through JasonImageComponent so I think the only places we have problem are:
Maybe we should really try out Glide4?
I will try updating to Glide4 but I'm not sure that API is compatible. We'll see!
@gliechtenstein It this pull request working for you ?
From my point of view. Glide migration is another subject.
@realitix I agree we can separate out glide migration but this fix still breaks what wasn't broken before.
Is Gif working at all for you? At least in my case, the previous version used to show the gif even if it was freeze frame, but this fix doesn't show a gif at all. it's just a blank white screen.
You can try this https://jasonbase.com/things/o2Kw
It's just a simple view with background:
{
"$jason": {
"head": {
"title": "background test"
},
"body": {
"style": {
"background": "https://lumiere-a.akamaihd.net/v1/images/smile_-_pooh_b9b622d6.gif"
}
}
}
}
Ok @gliechtenstein.
Called reconfigure on a bitmap that is in use! This may cause graphical corruption!
in log. So maybe it's working but it's too long to be usable anyway.Can you describe me the behavior of a gif background on IPhone ? Is it freezed or is it moving ? Is it cropped or streched ?
I just borrowed an Iphone and with IOs it works like expected... Gif plays and image is cropped.
I'm looking for a solution.
@gliechtenstein Can you try again ?
It's now fully working with animation support. Background image is now displayed inside an ImageView.
@realitix I just tried this but still getting the problem. In fact it's both stretched and non-animated :(
👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏
It works! Thanks so much for this! 🙌
Nice !
When you put a background image to your view, it is streched to fit screen dimension. With this patch, image is cropped to keep the aspect ratio.
Please @gliechtenstein, can you check the behavior on IPhone to be sure it's the same.
It's my first contribution to Jasonette, so don't hesitate to tell me if I do it wrong.