Example usage for android.graphics.drawable AnimationDrawable setCallback

List of usage examples for android.graphics.drawable AnimationDrawable setCallback

Introduction

In this page you can find the example usage for android.graphics.drawable AnimationDrawable setCallback.

Prototype

public final void setCallback(@Nullable Callback cb) 

Source Link

Document

Bind a Callback object to this Drawable.

Usage

From source file:com.groundupworks.partyphotobooth.fragments.CaptureFragment.java

/**
 * Initiates the capture sequence with count down.
 *//*from w w  w. j a v  a2 s  .co  m*/
private void initiateCountdownCapture() {
    if (mCamera != null) {
        mStartButton.setEnabled(false);

        // Start auto-focus.
        mCamera.autoFocus(null);

        // Start animation. Take picture when count down animation completes.
        final AnimationDrawable countdownAnimation = (AnimationDrawable) mStartButton.getBackground();
        countdownAnimation
                .setCallback(new TakePictureAnimationDrawableCallback(countdownAnimation, mStartButton));

        mStartButton.post(new Runnable() {
            @Override
            public void run() {
                countdownAnimation.start();
            }
        });
    }
}

From source file:com.fatelon.partyphotobooth.fragments.CaptureFragment.java

/**
 * Initiates the capture sequence with count down.
 *///from  w w w . ja  v  a  2s. co m
private void initiateCountdownCapture() {
    if (mCamera != null) {
        mStartButton.setEnabled(false);
        // Start auto-focus.
        mCamera.autoFocus(null);

        if (PreferencesHelper.PhotoBoothMode.AUTOMATIC.equals(mPhotoBoothMode)) {
            //                mStartButton.set
        }

        // Start animation. Take picture when count down animation completes.
        final AnimationDrawable countdownAnimation = (AnimationDrawable) mStartButton.getBackground();
        countdownAnimation
                .setCallback(new TakePictureAnimationDrawableCallback(countdownAnimation, mStartButton));

        mStartButton.post(new Runnable() {
            @Override
            public void run() {
                countdownAnimation.start();
            }
        });
    }
}