FileDocCategorySizeDatePackage
AnimatorSetEventsTest.javaAPI DocAndroid 5.1 API2870Thu Mar 12 22:22:12 GMT 2015android.animation

AnimatorSetEventsTest

public class AnimatorSetEventsTest extends EventsTest
Listener tests for AnimatorSet.

Fields Summary
android.widget.Button
button
ObjectAnimator
xAnim
ObjectAnimator
yAnim
Constructors Summary
Methods Summary
protected longgetTimeout()

        return (2 * mAnimator.getDuration()) + (2 * mAnimator.getStartDelay()) +
                ANIM_DELAY + FUTURE_RELEASE_DELAY;
    
public voidsetTranslationX(float value)

        button.setTranslationX(value);
    
public voidsetTranslationY(float value)

        button.setTranslationY(value);
    
public voidsetUp()


    
         
        button = (Button) getActivity().findViewById(R.id.animatingButton);
        mAnimator = new AnimatorSet();
        ((AnimatorSet)mAnimator).playSequentially(xAnim, yAnim);
        super.setUp();
    
public voidtestPlayingCancelDuringChildDelay()
Tests that an AnimatorSet can be correctly canceled during the delay of one of its children

        yAnim.setStartDelay(500);
        final AnimatorSet animSet = new AnimatorSet();
        animSet.playSequentially(xAnim, yAnim);
        mFutureListener = new FutureReleaseListener(mFuture);
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                try {
                    Handler handler = new Handler();
                    animSet.addListener(mFutureListener);
                    mRunning = true;
                    animSet.start();
                    handler.postDelayed(new Canceler(animSet, mFuture), ANIM_DURATION + 250);
                } catch (junit.framework.AssertionFailedError e) {
                    mFuture.setException(new RuntimeException(e));
                }
            }
        });
        mFuture.get(getTimeout(), TimeUnit.MILLISECONDS);