Open Bug 989617 Opened 6 years ago Updated 1 year ago
Home panels don't animate animated gifs in image
One of the features I've added to Whimsy for Android is a "Whimsy!" panel in the AwesomeScreen, but the animated gifs I set as the image_urls of the items don't animate. Currently I've set the url to the same image, so people can at least tap on the image to see the animation, but it would be way nicer if they images could animate on the panel. (I understand from http://droid-blog.net/2011/10/14/tutorial-how-to-use-animated-gifs-in-android-part-1/ (and parts 2 and 3) that this is probably a really hard feature to add, but figured it would be worth a bug, if only to give you all the chance to resolve it wontfix. ;) Thanks, Blake.
We use the Picasso image loading library to load these images. On quick glance, it doesn't look like Picasso supports animated gifs, so we would need to extend that somehow if we were to do this. I know this is a fun whimsy feature, but unfortunately this is probably a WONTFIX :/
If it helps, I did a little poking around again yesterday morning, and ended up on http://stackoverflow.com/questions/3660209/display-animated-gif which has a link to https://github.com/frapontillo/ImageViewEx (and http://androidosbeginning.blogspot.ca/2010/09/gif-animation-in-android.html, but the first link seems more useful…) So, perhaps it could be as simple as switching out Picasso for ImageViewEx (or hooking them together). (I agree that it's likely a WONTFIX, but perhaps it would be worth leaving open in case some community member wants to take a stab at it.)
(In reply to Blake Winton (:bwinton) from comment #2) > If it helps, I did a little poking around again yesterday morning, and ended > up on http://stackoverflow.com/questions/3660209/display-animated-gif which > has a link to https://github.com/frapontillo/ImageViewEx (and > http://androidosbeginning.blogspot.ca/2010/09/gif-animation-in-android.html, > but the first link seems more useful…) > > So, perhaps it could be as simple as switching out Picasso for ImageViewEx > (or hooking them together). > > (I agree that it's likely a WONTFIX, but perhaps it would be worth leaving > open in case some community member wants to take a stab at it.) Had a quick look. ImageViewEx (the widget) would actually be pretty simple to adapt (I'd probably write our version of it though). The tricky part would be to change Picasso to decode the input streams into Movie instances instead of Bitmaps. Picasso is very Bitmap-oriented under the hood. Let's leave this open. I might have a more thorough look at this bug in the future.
(In reply to Lucas Rocha (:lucasr) from comment #3) > Had a quick look. ImageViewEx (the widget) would actually be pretty simple > to adapt (I'd probably write our version of it though). The tricky part > would be to change Picasso to decode the input streams into Movie instances > instead of Bitmaps. Picasso is very Bitmap-oriented under the hood. Let's > leave this open. I might have a more thorough look at this bug in the future. You mention Movie class because it directly supports animated GIFs, right? https://code.google.com/p/apidemos/source/browse/trunk/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java#103 I see that ImageViewEx is deprecated, suggesting we use Picasso. I also see that ImageViewEx just uses a Movie like the sample code. Another thing we wanted to support in Home panels was videos. Does picasso support any type of media?
I was curious about this. Looks like we can grab the raw byte array here  (for network requests, other requests have their own hunters). We'd have to wrap it into some sort of fake bitmap class that could hold a reference and let us get the original raw undecoded data as well. From there, Picasso supports throwing a Target  object in instead of an ImageView anywhere. We can do whatever we want with our fake "Bitmap" there. Or maybe we'd be better to grab the raw stream at  and feed it to the Movie/VideoView instead. I'm sure none of that would make Picasso's caching happy. Ideally we'd probably only cache the "bitmap"/"poster frame" anyway...  http://mxr.mozilla.org/mozilla-central/source/mobile/android/thirdparty/com/squareup/picasso/NetworkBitmapHunter.java#75  http://mxr.mozilla.org/mozilla-central/source/mobile/android/thirdparty/com/squareup/picasso/Target.java
This doesn't work for me, but I got curious and wanted to try. This sends out a stream from Picasso to the Target. Then I try to make that a Movie. All of that works, just nothing appears. We'd also won't get a stream if something is in the in memory cache... I won't work on this anymore probably, but thought I'd at least save my place.
You need to log in before you can comment on or make changes to this bug.