Example usage for android.graphics.drawable AnimatedStateListDrawable jumpToCurrentState

List of usage examples for android.graphics.drawable AnimatedStateListDrawable jumpToCurrentState

Introduction

In this page you can find the example usage for android.graphics.drawable AnimatedStateListDrawable jumpToCurrentState.

Prototype

@Override
    public void jumpToCurrentState() 

Source Link

Usage

From source file:com.google.samples.apps.iosched.util.LPreviewUtilsImpl.java

@Override
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) {
    AnimatedStateListDrawable drawable = (AnimatedStateListDrawable) mActivity.getResources()
            .getDrawable(R.drawable.add_schedule_fab_icon_anim);
    imageView.setImageDrawable(drawable);
    if (allowAnimate) {
        // TODO: figure out if there's a way to always animate from current state
        imageView.setImageState(isCheck ? STATE_UNCHECKED : STATE_CHECKED, false);
        drawable.jumpToCurrentState();
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
    } else {//from w  w  w  .  j a va 2  s.c  o m
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
        drawable.jumpToCurrentState();
    }
}