android.view.animation.BaseInterpolator Java Examples

The following examples show how to use android.view.animation.BaseInterpolator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnimationViewController.java    From Carpaccio with Apache License 2.0 5 votes vote down vote up
protected static BaseInterpolator stringToInterpolator(String s) {
    if (s != null) {
        switch (s) {
            case ACCELERATE:
                return new AccelerateInterpolator();
            case DESCELERATE:
                return new DecelerateInterpolator();
            case ACCELERATE_DESCELERATE:
                return new AccelerateDecelerateInterpolator();
        }
    }
    return null;
}
 
Example #2
Source File: AnimatorInflater.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new animation whose parameters come from the specified context
 * and attributes set.
 *
 * @param res The resources
 * @param attrs The set of attributes holding the animation parameters
 * @param anim Null if this is a ValueAnimator, otherwise this is an
 *            ObjectAnimator
 */
private static ValueAnimator loadAnimator(Resources res, Theme theme,
        AttributeSet attrs, ValueAnimator anim, float pathErrorScale)
        throws NotFoundException {
    TypedArray arrayAnimator = null;
    TypedArray arrayObjectAnimator = null;

    if (theme != null) {
        arrayAnimator = theme.obtainStyledAttributes(attrs, R.styleable.Animator, 0, 0);
    } else {
        arrayAnimator = res.obtainAttributes(attrs, R.styleable.Animator);
    }

    // If anim is not null, then it is an object animator.
    if (anim != null) {
        if (theme != null) {
            arrayObjectAnimator = theme.obtainStyledAttributes(attrs,
                    R.styleable.PropertyAnimator, 0, 0);
        } else {
            arrayObjectAnimator = res.obtainAttributes(attrs, R.styleable.PropertyAnimator);
        }
        anim.appendChangingConfigurations(arrayObjectAnimator.getChangingConfigurations());
    }

    if (anim == null) {
        anim = new ValueAnimator();
    }
    anim.appendChangingConfigurations(arrayAnimator.getChangingConfigurations());

    parseAnimatorFromTypeArray(anim, arrayAnimator, arrayObjectAnimator, pathErrorScale);

    final int resID = arrayAnimator.getResourceId(R.styleable.Animator_interpolator, 0);
    if (resID > 0) {
        final Interpolator interpolator = AnimationUtils.loadInterpolator(res, theme, resID);
        if (interpolator instanceof BaseInterpolator) {
            anim.appendChangingConfigurations(
                    ((BaseInterpolator) interpolator).getChangingConfiguration());
        }
        anim.setInterpolator(interpolator);
    }

    arrayAnimator.recycle();
    if (arrayObjectAnimator != null) {
        arrayObjectAnimator.recycle();
    }
    return anim;
}
 
Example #3
Source File: DescriptionAnimation.java    From LoyalNativeSlider with MIT License 4 votes vote down vote up
/**
 * @param animation_behavior the interpolator behavior
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
public DescriptionAnimation(BaseInterpolator animation_behavior) {
    this.animation_behavior = animation_behavior;
}
 
Example #4
Source File: DescriptionAnimation.java    From LoyalNativeSlider with MIT License 4 votes vote down vote up
/**
 * @param min_sec            additional setting minute second that controls the time threadhold between each slide
 * @param animation_behavior the interpolator behavior
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
public DescriptionAnimation(int min_sec, BaseInterpolator animation_behavior) {
    this.time_threadhold = min_sec;
    this.animation_behavior = animation_behavior;
}