use of com.nineoldandroids.animation.ObjectAnimator in project android-betterpickers by code-troopers.
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(AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : this, radiusDisappear, fadeOut).setDuration(duration);
disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return disappearAnimator;
}
use of com.nineoldandroids.animation.ObjectAnimator in project android-betterpickers by code-troopers.
the class RadialTimePickerDialogFragment method setCurrentItemShowing.
// Show either Hours or Minutes.
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) {
mTimePicker.setCurrentItemShowing(index, animateCircle);
TextView labelToAnimate;
if (index == HOUR_INDEX) {
int hours = mTimePicker.getHours();
if (!mIs24HourMode) {
hours = hours % 12;
}
mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours);
if (announce) {
Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours);
}
labelToAnimate = mHourView;
} else {
int minutes = mTimePicker.getMinutes();
mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes);
if (announce) {
Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes);
}
labelToAnimate = mMinuteView;
}
int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor;
int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor;
mHourView.setTextColor(hourColor);
mMinuteView.setTextColor(minuteColor);
ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
if (delayLabelAnimate) {
pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
}
pulseAnimator.start();
}
use of com.nineoldandroids.animation.ObjectAnimator in project Context-Menu.Android by Yalantis.
the class MenuAdapter method buildChosenAnimation.
/**
* Builds and runs chosen item and menu closing animation
*/
private void buildChosenAnimation(int childIndex) {
List<Animator> fadeOutTextTopAnimatorList = new ArrayList<>();
List<Animator> closeToBottomImageAnimatorList = new ArrayList<>();
for (int i = 0; i < childIndex; i++) {
View view = mMenuWrapper.getChildAt(i);
resetVerticalAnimation(view, true);
closeToBottomImageAnimatorList.add(AnimatorUtils.rotationCloseVertical(view));
fadeOutTextTopAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i), mContext.getResources().getDimension(R.dimen.text_right_translation)));
}
AnimatorSet closeToBottom = new AnimatorSet();
closeToBottom.playSequentially(closeToBottomImageAnimatorList);
AnimatorSet fadeOutTop = new AnimatorSet();
fadeOutTop.playSequentially(fadeOutTextTopAnimatorList);
List<Animator> fadeOutTextBottomAnimatorList = new ArrayList<>();
List<Animator> closeToTopAnimatorObjects = new ArrayList<>();
for (int i = getItemCount() - 1; i > childIndex; i--) {
View view = mMenuWrapper.getChildAt(i);
resetVerticalAnimation(view, false);
closeToTopAnimatorObjects.add(AnimatorUtils.rotationCloseVertical(view));
fadeOutTextBottomAnimatorList.add(AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(i), mContext.getResources().getDimension(R.dimen.text_right_translation)));
}
AnimatorSet closeToTop = new AnimatorSet();
closeToTop.playSequentially(closeToTopAnimatorObjects);
AnimatorSet fadeOutBottom = new AnimatorSet();
fadeOutBottom.playSequentially(fadeOutTextBottomAnimatorList);
resetSideAnimation(mMenuWrapper.getChildAt(childIndex));
ObjectAnimator closeToRight = AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(childIndex));
closeToRight.addListener(mChosenItemFinishAnimatorListener);
AnimatorSet fadeOutChosenText = AnimatorUtils.fadeOutSet(mTextWrapper.getChildAt(childIndex), mContext.getResources().getDimension(R.dimen.text_right_translation));
AnimatorSet imageFullAnimatorSet = new AnimatorSet();
imageFullAnimatorSet.play(closeToBottom).with(closeToTop);
AnimatorSet textFullAnimatorSet = new AnimatorSet();
textFullAnimatorSet.play(fadeOutTop).with(fadeOutBottom);
if (closeToBottomImageAnimatorList.size() >= closeToTopAnimatorObjects.size()) {
imageFullAnimatorSet.play(closeToBottom).before(closeToRight);
textFullAnimatorSet.play(fadeOutTop).before(fadeOutChosenText);
} else {
imageFullAnimatorSet.play(closeToTop).before(closeToRight);
textFullAnimatorSet.play(fadeOutBottom).before(fadeOutChosenText);
}
AnimatorSet fullAnimatorSet = new AnimatorSet();
fullAnimatorSet.playTogether(imageFullAnimatorSet, textFullAnimatorSet);
fullAnimatorSet.setDuration(mAnimationDurationMilis);
fullAnimatorSet.setInterpolator(new HesitateInterpolator());
fullAnimatorSet.start();
}
use of com.nineoldandroids.animation.ObjectAnimator in project Carbon by ZieIony.
the class RippleForeground method createSoftwareEnter.
@Override
protected Animator createSoftwareEnter(boolean fast) {
// Bounded ripples don't have enter animations.
if (mIsBounded) {
return null;
}
final int duration = (int) (1000 * Math.sqrt(mTargetRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5);
final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1);
AnimatorsCompat.setAutoCancel(tweenRadius);
// tweenRadius.setAutoCancel(true);
tweenRadius.setDuration(duration);
tweenRadius.setInterpolator(LINEAR_INTERPOLATOR);
tweenRadius.setStartDelay(RIPPLE_ENTER_DELAY);
final ObjectAnimator tweenOrigin = ObjectAnimator.ofFloat(this, TWEEN_ORIGIN, 1);
AnimatorsCompat.setAutoCancel(tweenOrigin);
// tweenOrigin.setAutoCancel(true);
tweenOrigin.setDuration(duration);
tweenOrigin.setInterpolator(LINEAR_INTERPOLATOR);
tweenOrigin.setStartDelay(RIPPLE_ENTER_DELAY);
final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1);
AnimatorsCompat.setAutoCancel(opacity);
// opacity.setAutoCancel(true);
opacity.setDuration(OPACITY_ENTER_DURATION_FAST);
opacity.setInterpolator(LINEAR_INTERPOLATOR);
final AnimatorSet set = new AnimatorSet();
set.play(tweenOrigin).with(tweenRadius).with(opacity);
return set;
}
use of com.nineoldandroids.animation.ObjectAnimator in project Carbon by ZieIony.
the class RippleBackground method createSoftwareEnter.
@Override
protected Animator createSoftwareEnter(boolean fast) {
// Linear enter based on current opacity.
final int maxDuration = fast ? OPACITY_ENTER_DURATION_FAST : OPACITY_ENTER_DURATION;
final int duration = (int) ((1 - mOpacity) * maxDuration);
final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1);
AnimatorsCompat.setAutoCancel(opacity);
//opacity.setAutoCancel(true);
opacity.setDuration(duration);
opacity.setInterpolator(LINEAR_INTERPOLATOR);
return opacity;
}
Aggregations