Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an animated drawable as a placeholder? #29

Closed
osrl opened this issue Mar 28, 2015 · 16 comments
Closed

Adding an animated drawable as a placeholder? #29

osrl opened this issue Mar 28, 2015 · 16 comments

Comments

@osrl
Copy link

osrl commented Mar 28, 2015

Is there a way to add a prorgressBar or a different view (maybe a custom view like materialish-progress) as a placeholder? No image library is capable of this. Is the progressBarImage animatable?

@plamenko
Copy link
Contributor

I have changes ready to add a real progress information to Fresco, so expect this very soon.

The way the progressBar works at the moment is: display progress bar image until the final image is ready. This is just a drawable and at the moment we provide the AutoRotateDrawable which can be used for displaying an indefinite spinner until the image is ready. You can specify progressBarImage and progressBarAutoRotateInterval in XML. You can also use your own drawable if you wish.

What I am adding now is real progress, so that as the bytes are downloading, we set the level to the progressbar drawable (0 to 10000). That means that drawable is now aware of the real progress and based on its level can display that progress in whichever way it wants. We'll provide a ProgressBarDrawable that just draws a line based on the percentage, but you can implement your custom drawable to do whatever you want.

@adnan-SM
Copy link

Any way we could play GIF as the placeholder ? May be not a loader but some other GIF itself. The only way I can think of right now is having two Drawee Views on top of each other one playing a local GIF till the network fetch happens and then hide it and show the loaded image from the network.

@plamenko
Copy link
Contributor

This is possible, but in order to be able to answer on how to do it, I need the information on where do you get the GIF image from?

@plamenko
Copy link
Contributor

Also, you can try using low-res image as explained in the documentation: http://frescolib.org/docs/requesting-multiple-images.html#_

DraweeController controller = Fresco.newDraweeControllerBuilder()
    .setLowResImageRequest(ImageRequest.fromUri(gifPlaceholderUri))
    .setImageRequest(ImageRequest.fromUri(uri))
    .setOldController(mSimpleDraweeView.getController())
    .build();
mSimpleDraweeView.setController(controller);

@adnan-SM
Copy link

The low resolution thing works fine, but what if I wanted to play a GIF bundled locally within the app in assets ? How would I do something like that, apart from having 2 overlapping drawee objects ?

@plamenko
Copy link
Contributor

@blackiedm
Copy link

@plamenko I set GIF to actual image,and RoundingParams don't work.

@plamenko
Copy link
Contributor

Default rounding mode, BITMAP_ONLY, doesn't support animations. Please check if OVERLAY_COLOR rounding mode would work for you. For best appearance, you should use the same color that is beneath the DraweeView for overlay color (e.g. the ListView background color if DraweeView sits in the ListView).
See http://frescolib.org/docs/rounded-corners-and-circles.html#_

@blackiedm
Copy link

@plamenko thanks

@osrl
Copy link
Author

osrl commented Apr 1, 2015

Hello @plamenko . You say there is no way to use a custom prorgressBar right now am I right? Is there a plan on that? I want to show an indefinite progressBar instead of a real progress. I think the only way to show good looking progressBar is hide/show drawee and progressBar. Could progressBarImage be an AnimationDrawable? That wouldn't be as smooth as a custom view though.

@plamenko
Copy link
Contributor

plamenko commented Apr 1, 2015

Hi. Nope, I said that you can use whatever drawable you wish, but at the time we didn't support real progress. Now we do support real progress too, we just need to do a github push.

progressBarImage can be an AnimationDrawable, it's just that we don't call start/stop on it. I should probably add that logic.

@mhdatie
Copy link

mhdatie commented Apr 24, 2015

@plamenko did the push happen? It would be really useful

@tyronen
Copy link
Contributor

tyronen commented Apr 24, 2015

Progress bars have been supported since v0.2.0. See their documentation.

@mhdatie
Copy link

mhdatie commented Apr 24, 2015

@tyronen figured that out 30 mins after my post :)

@sydneyagcaoili
Copy link

Well, I have an animated drawable.. and it needs code to start it somewhere, can this be handled now on the current version?

@Xwally
Copy link

Xwally commented Jul 7, 2017

When I set the gif in function setLowResImageRequest(),it's showing but don't playing the animation @plamenko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants