android - Setting end values without animation with AnimatorSet -


according documentation http://developer.android.com/reference/android/animation/animatorset.html#end() end() method should assign end values animations inside set. ending nothing if set not started. different valueanimator i.e. not care , artifically starts animation, fires onanimationstart() event , ends results in setting end values properly.

let me tell why problem. if want have ability update view , without animation (depending on situation) don't want have 2 separate methods it. instead create animation , start or set end values. valueanimator works nicely. animatorset not play ball , if try end before calling start() exits.

one workaround call start() , end() after not cover situation nested animatorsets this:

    animatorset mainset = new animatorset();      animatorset scaleset = new animatorset();     scaleset.playtogether(             objectanimator.offloat(view, "scalex", 0.5f),             objectanimator.offloat(view, "scaley", 0.5f));      mainset.playsequentially(             objectanimator.offloat(view, "alpha", 0.5f),             scaleset);      mainset.start();     mainset.end(); 

this causes mainset call end() on children. since animatorset.end() broken scaleset not set ending values. attempted extend animatorset class , fix found out marked final.

in app use animations have few cases animations not needed. have idea how achieve proper behaviour?

you can on child animations with:

for (animator animation : mainset.getchildanimations()) {     animation.start();     animation.end(); } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -