android - Custom view and animated GIF - gif is not playing correctly -


i have implemented custom view has draweeholder. have implemented callbacks , listeners custom view (attach / detach / invalidatedrawable / setlistener).

if set gif image url controller - not play gif correctly. refreshes gif when view redrawn. guess animated gif should have invalidation callback or something.

p.s. gif work correctly if use draweeview. other images work correctly inside custom view.

creating holder:

private draweeholder<genericdraweehierarchy> createcomponentholder(view parent, context context) {     genericdraweehierarchy componenthierarchy = new genericdraweehierarchybuilder(parent.getresources())             .setroundingparams(roundingparams.fromcornersradius(layouthelper.dp(3)).setborder(theme.color_media_border, 1))             .build();     draweeholder<genericdraweehierarchy> holder = draweeholder.create(componenthierarchy, context);     holder.gettopleveldrawable().setcallback(parent);     return holder; } 

setting controller:

pipelinedraweecontrollerbuilder controllerbuilder = fresco.newdraweecontrollerbuilder()             .setimagerequest(mediahelper.getimagerequest(filepath))             .setautoplayanimations(true)             .setcontrollerlistener(controllerlistener)             .setoldcontroller(draweeholder.getcontroller());      if (thumburl != null) {         controllerbuilder.setlowresimagerequest(getthumbnailrequest(thumburl));     }      draweeholder.setcontroller(controllerbuilder.build()); 

image request:

public static imagerequest getimagerequest(string filepath) {     int imagesize = layouthelper.dp(100);     return imagerequestbuilder.newbuilderwithsource(uri.fromfile(new file(filepath)))             .setresizeoptions(new resizeoptions(imagesize, imagesize))             .setautorotateenabled(true)             .build(); } 

there no custom invalidation callback gifs, animated drawable invalidates itself each frame, if set callbacks invalidation should work.

however, if drawable callback (in case parent) not invalidate correct area (or everything), animated drawable invalidation not refresh correctly. example when can happen when callback not know exact location of drawable , invalidates wrong area. can try debugging drawable.callback of custom view or write custom drawable.callback class invalidates whole view including gif drawable.

also, make sure override verifydrawable , follow other steps custom views described in custom view documentation.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -