Search in sources :

Example 11 with PropertyValuesHolder

use of com.nineoldandroids.animation.PropertyValuesHolder in project android-betterpickers by code-troopers.

the class Utils method getPulseAnimator.

/**
     * Render an animator to pulsate a view in place.
     * @param labelToAnimate the view to pulsate.
     * @return The animator object. Use .start() to begin.
     */
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(labelToAnimate) : labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);
    return pulseAnimator;
}
Also used : Keyframe(com.nineoldandroids.animation.Keyframe) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) PropertyValuesHolder(com.nineoldandroids.animation.PropertyValuesHolder)

Example 12 with PropertyValuesHolder

use of com.nineoldandroids.animation.PropertyValuesHolder in project datetimepicker by flavienlaurent.

the class Utils method getPulseAnimator.

public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);
    return pulseAnimator;
}
Also used : Keyframe(com.nineoldandroids.animation.Keyframe) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) PropertyValuesHolder(com.nineoldandroids.animation.PropertyValuesHolder)

Example 13 with PropertyValuesHolder

use of com.nineoldandroids.animation.PropertyValuesHolder in project datetimepicker by flavienlaurent.

the class RadialSelectorView method getDisappearAnimator.

public ObjectAnimator getDisappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }
    Keyframe kf0, kf1, kf2;
    float midwayPoint = 0.2f;
    int duration = 500;
    kf0 = Keyframe.ofFloat(0f, 1);
    kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier);
    PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe("animationRadiusMultiplier", kf0, kf1, kf2);
    kf0 = Keyframe.ofFloat(0f, 1f);
    kf1 = Keyframe.ofFloat(1f, 0f);
    PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);
    ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, radiusDisappear, fadeOut).setDuration(duration);
    disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    return disappearAnimator;
}
Also used : Keyframe(com.nineoldandroids.animation.Keyframe) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) PropertyValuesHolder(com.nineoldandroids.animation.PropertyValuesHolder) Paint(android.graphics.Paint)

Example 14 with PropertyValuesHolder

use of com.nineoldandroids.animation.PropertyValuesHolder in project datetimepicker by flavienlaurent.

the class RadialSelectorView method getReappearAnimator.

public ObjectAnimator getReappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }
    Keyframe kf0, kf1, kf2, kf3;
    float midwayPoint = 0.2f;
    int duration = 500;
    // The time points are half of what they would normally be, because this animation is
    // staggered against the disappear so they happen seamlessly. The reappear starts
    // halfway into the disappear.
    float delayMultiplier = 0.25f;
    float transitionDurationMultiplier = 1f;
    float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    int totalDuration = (int) (duration * totalDurationMultiplier);
    float delayPoint = (delayMultiplier * duration) / totalDuration;
    midwayPoint = 1 - (midwayPoint * (1 - delayPoint));
    kf0 = Keyframe.ofFloat(0f, mTransitionEndRadiusMultiplier);
    kf1 = Keyframe.ofFloat(delayPoint, mTransitionEndRadiusMultiplier);
    kf2 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf3 = Keyframe.ofFloat(1f, 1);
    PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe("animationRadiusMultiplier", kf0, kf1, kf2, kf3);
    kf0 = Keyframe.ofFloat(0f, 0f);
    kf1 = Keyframe.ofFloat(delayPoint, 0f);
    kf2 = Keyframe.ofFloat(1f, 1f);
    PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);
    ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, radiusReappear, fadeIn).setDuration(totalDuration);
    reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    return reappearAnimator;
}
Also used : Keyframe(com.nineoldandroids.animation.Keyframe) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) PropertyValuesHolder(com.nineoldandroids.animation.PropertyValuesHolder) Paint(android.graphics.Paint)

Example 15 with PropertyValuesHolder

use of com.nineoldandroids.animation.PropertyValuesHolder in project Carbon by ZieIony.

the class AnimatorsCompat method hasSameTargetAndProperties.

private static boolean hasSameTargetAndProperties(ObjectAnimator self, @Nullable Animator anim) {
    if (anim instanceof ObjectAnimator) {
        PropertyValuesHolder[] theirValues = ((ObjectAnimator) anim).getValues();
        PropertyValuesHolder[] selfValues = self.getValues();
        if (((ObjectAnimator) anim).getTarget() == self.getTarget() && selfValues.length == theirValues.length) {
            final int length = selfValues.length;
            for (int i = 0; i < length; ++i) {
                PropertyValuesHolder pvhMine = selfValues[i];
                PropertyValuesHolder pvhTheirs = theirValues[i];
                if (pvhMine.getPropertyName() == null || !pvhMine.getPropertyName().equals(pvhTheirs.getPropertyName())) {
                    return false;
                }
            }
            return true;
        }
    }
    return false;
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) PropertyValuesHolder(com.nineoldandroids.animation.PropertyValuesHolder)

Aggregations

PropertyValuesHolder (com.nineoldandroids.animation.PropertyValuesHolder)15 Keyframe (com.nineoldandroids.animation.Keyframe)12 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)11 Paint (android.graphics.Paint)6 Animator (com.nineoldandroids.animation.Animator)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 SurfaceView (android.view.SurfaceView)1 View (android.view.View)1 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)1 ImageView (android.widget.ImageView)1 RadioGroup (android.widget.RadioGroup)1 RelativeLayout (android.widget.RelativeLayout)1 InjectView (butterknife.InjectView)1 CommonImagePickerListActivity (com.github.obsessive.simplifyreader.ui.activity.picker.CommonImagePickerListActivity)1 BeepManager (com.github.obsessive.simplifyreader.ui.activity.qrcode.utils.BeepManager)1 InactivityTimer (com.github.obsessive.simplifyreader.ui.activity.qrcode.utils.InactivityTimer)1