Add examples of animator resource files to ApiDemos

Issue #17939329 Expose multi-property and multi-keyframe capabilities in animation resources

Change-Id: If5b66b054b132b34c56b921209835793c7bbe674
This commit is contained in:
Chet Haase
2015-01-09 11:17:22 -08:00
parent d54687fbdd
commit eda0dbc81c
6 changed files with 113 additions and 1 deletions

View File

@@ -78,6 +78,9 @@ public class AnimationLoading extends Activity {
addBall(200, 50);
addBall(350, 50);
addBall(500, 50, Color.GREEN);
addBall(650, 50);
addBall(800, 50);
addBall(950, 50);
}
private void createAnimation() {
@@ -106,8 +109,27 @@ public class AnimationLoading extends Activity {
loadAnimator(appContext, R.anim.color_animator);
colorizer.setTarget(balls.get(3));
ObjectAnimator animPvh = (ObjectAnimator) AnimatorInflater.
loadAnimator(appContext, R.anim.object_animator_pvh);
animPvh.setTarget(balls.get(4));
ObjectAnimator animPvhKf = (ObjectAnimator) AnimatorInflater.
loadAnimator(appContext, R.anim.object_animator_pvh_kf);
animPvhKf.setTarget(balls.get(5));
ValueAnimator faderKf = (ValueAnimator) AnimatorInflater.
loadAnimator(appContext, R.anim.value_animator_pvh_kf);
faderKf.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
balls.get(6).setAlpha((Float) animation.getAnimatedValue());
}
});
animation = new AnimatorSet();
((AnimatorSet) animation).playTogether(anim, fader, seq, colorizer);
((AnimatorSet) animation).playTogether(anim, fader, seq, colorizer, animPvh,
animPvhKf, faderKf);
}
}