use of android.animation.PropertyValuesHolder in project android_frameworks_base by ParanoidAndroid.
the class KeyguardWidgetCarousel method animatePagesToCarousel.
void animatePagesToCarousel() {
if (mChildrenTransformsAnimator != null) {
mChildrenTransformsAnimator.cancel();
mChildrenTransformsAnimator = null;
}
int count = getChildCount();
PropertyValuesHolder alpha;
PropertyValuesHolder outlineAlpha;
PropertyValuesHolder rotationY;
PropertyValuesHolder pivotX;
PropertyValuesHolder pivotY;
ArrayList<Animator> anims = new ArrayList<Animator>();
for (int i = 0; i < count; i++) {
KeyguardWidgetFrame child = getWidgetPageAt(i);
float finalAlpha = getAlphaForPage(mScreenCenter, i, true);
float finalOutlineAlpha = getOutlineAlphaForPage(mScreenCenter, i, true);
getTransformForPage(mScreenCenter, i, mTmpTransform);
boolean inVisibleRange = (i >= mCurrentPage - 1 && i <= mCurrentPage + 1);
ObjectAnimator a;
alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalAlpha);
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", finalOutlineAlpha);
pivotX = PropertyValuesHolder.ofFloat("pivotX", mTmpTransform[0]);
pivotY = PropertyValuesHolder.ofFloat("pivotY", mTmpTransform[1]);
rotationY = PropertyValuesHolder.ofFloat("rotationY", mTmpTransform[2]);
if (inVisibleRange) {
// for the central pages we animate into a rotated state
a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha, pivotX, pivotY, rotationY);
} else {
a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha);
a.setInterpolator(mFastFadeInterpolator);
}
anims.add(a);
}
int duration = REORDERING_ZOOM_IN_OUT_DURATION;
mChildrenTransformsAnimator = new AnimatorSet();
mChildrenTransformsAnimator.playTogether(anims);
mChildrenTransformsAnimator.setDuration(duration);
mChildrenTransformsAnimator.start();
}
use of android.animation.PropertyValuesHolder in project android_frameworks_base by ParanoidAndroid.
the class KeyguardWidgetCarousel method animatePagesToNeutral.
void animatePagesToNeutral() {
if (mChildrenTransformsAnimator != null) {
mChildrenTransformsAnimator.cancel();
mChildrenTransformsAnimator = null;
}
int count = getChildCount();
PropertyValuesHolder alpha;
PropertyValuesHolder outlineAlpha;
PropertyValuesHolder rotationY;
ArrayList<Animator> anims = new ArrayList<Animator>();
for (int i = 0; i < count; i++) {
KeyguardWidgetFrame child = getWidgetPageAt(i);
boolean inVisibleRange = (i >= mCurrentPage - 1 && i <= mCurrentPage + 1);
if (!inVisibleRange) {
child.setRotationY(0f);
}
alpha = PropertyValuesHolder.ofFloat("contentAlpha", 1.0f);
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER);
rotationY = PropertyValuesHolder.ofFloat("rotationY", 0f);
ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha, rotationY);
child.setVisibility(VISIBLE);
if (!inVisibleRange) {
a.setInterpolator(mSlowFadeInterpolator);
}
anims.add(a);
}
int duration = REORDERING_ZOOM_IN_OUT_DURATION;
mChildrenTransformsAnimator = new AnimatorSet();
mChildrenTransformsAnimator.playTogether(anims);
mChildrenTransformsAnimator.setDuration(duration);
mChildrenTransformsAnimator.start();
}
use of android.animation.PropertyValuesHolder in project android_frameworks_base by ParanoidAndroid.
the class KeyguardWidgetPager method animateOutlinesAndSidePages.
void animateOutlinesAndSidePages(final boolean show, int duration) {
if (mChildrenOutlineFadeAnimation != null) {
mChildrenOutlineFadeAnimation.cancel();
mChildrenOutlineFadeAnimation = null;
}
int count = getChildCount();
PropertyValuesHolder alpha;
ArrayList<Animator> anims = new ArrayList<Animator>();
if (duration == -1) {
duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION;
}
int curPage = getNextPage();
for (int i = 0; i < count; i++) {
float finalContentAlpha;
if (show) {
finalContentAlpha = getAlphaForPage(mScreenCenter, i, true);
} else if (!show && i == curPage) {
finalContentAlpha = 1f;
} else {
finalContentAlpha = 0f;
}
KeyguardWidgetFrame child = getWidgetPageAt(i);
alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha);
ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha);
anims.add(a);
float finalOutlineAlpha = show ? getOutlineAlphaForPage(mScreenCenter, i, true) : 0f;
child.fadeFrame(this, show, finalOutlineAlpha, duration);
}
mChildrenOutlineFadeAnimation = new AnimatorSet();
mChildrenOutlineFadeAnimation.playTogether(anims);
mChildrenOutlineFadeAnimation.setDuration(duration);
mChildrenOutlineFadeAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (show) {
enablePageContentLayers();
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (!show) {
disablePageContentLayers();
KeyguardWidgetFrame frame = getWidgetPageAt(mWidgetToResetAfterFadeOut);
if (frame != null && !(frame == getWidgetPageAt(mCurrentPage) && mViewStateManager.isChallengeOverlapping())) {
frame.resetSize();
}
mWidgetToResetAfterFadeOut = -1;
mShowingInitialHints = false;
}
updateWidgetFramesImportantForAccessibility();
}
});
mChildrenOutlineFadeAnimation.start();
}
use of android.animation.PropertyValuesHolder in project UltimateAndroid by cymcsg.
the class AnimationUtils method leftRightShake.
/**
* Shake the view from left to right
*
* @param view
* @return
*/
public static ObjectAnimator leftRightShake(View view) {
// int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
int delta = 40;
PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X, Keyframe.ofFloat(0f, 0), Keyframe.ofFloat(.10f, -delta), Keyframe.ofFloat(.26f, delta), Keyframe.ofFloat(.42f, -delta), Keyframe.ofFloat(.58f, delta), Keyframe.ofFloat(.74f, -delta), Keyframe.ofFloat(.90f, delta), Keyframe.ofFloat(1f, 0f));
return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).setDuration(500);
}
use of android.animation.PropertyValuesHolder in project UltimateAndroid by cymcsg.
the class AnimationUtils method nope.
public static ObjectAnimator nope(View view) {
// int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
int delta = 40;
PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X, Keyframe.ofFloat(0f, 0), Keyframe.ofFloat(.10f, -delta), Keyframe.ofFloat(.26f, delta), Keyframe.ofFloat(.42f, -delta), Keyframe.ofFloat(.58f, delta), Keyframe.ofFloat(.74f, -delta), Keyframe.ofFloat(.90f, delta), Keyframe.ofFloat(1f, 0f));
return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).setDuration(500);
}
Aggregations