use of android.animation.AnimatorSet in project android_frameworks_base by ParanoidAndroid.
the class KeyButtonView method setPressed.
public void setPressed(boolean pressed) {
if (mGlowBG != null) {
if (pressed != isPressed()) {
if (mPressedAnim != null && mPressedAnim.isRunning()) {
mPressedAnim.cancel();
}
final AnimatorSet as = mPressedAnim = new AnimatorSet();
if (pressed) {
if (mGlowScale < GLOW_MAX_SCALE_FACTOR)
mGlowScale = GLOW_MAX_SCALE_FACTOR;
if (mGlowAlpha < BUTTON_QUIESCENT_ALPHA)
mGlowAlpha = BUTTON_QUIESCENT_ALPHA;
setDrawingAlpha(1f);
as.playTogether(ObjectAnimator.ofFloat(this, "glowAlpha", 1f), ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR));
as.setDuration(50);
} else {
mOldDrawingAlpha = BUTTON_QUIESCENT_ALPHA;
as.playTogether(ObjectAnimator.ofFloat(this, "glowAlpha", 0f), ObjectAnimator.ofFloat(this, "glowScale", 1f), ObjectAnimator.ofFloat(this, "drawingAlpha", BUTTON_QUIESCENT_ALPHA));
as.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
setDrawingAlpha(BUTTON_QUIESCENT_ALPHA);
}
});
as.setDuration(500);
}
as.start();
}
}
super.setPressed(pressed);
}
use of android.animation.AnimatorSet 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.AnimatorSet 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.AnimatorSet 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.AnimatorSet in project paper-onboarding-android by Ramotion.
the class PaperOnboardingEngine method createBGAnimatorSet.
/**
* @param color new background color for new
* @return animator set with background color circular reveal animation
*/
protected AnimatorSet createBGAnimatorSet(final int color) {
final View bgColorView = new ImageView(mAppContext);
bgColorView.setLayoutParams(new RelativeLayout.LayoutParams(mRootLayout.getWidth(), mRootLayout.getHeight()));
bgColorView.setBackgroundColor(color);
mBackgroundContainer.addView(bgColorView);
int[] pos = calculateCurrentCenterCoordinatesOfPagerElement(mActiveElementIndex);
float finalRadius = mRootLayout.getWidth() > mRootLayout.getHeight() ? mRootLayout.getWidth() : mRootLayout.getHeight();
AnimatorSet bgAnimSet = new AnimatorSet();
Animator fadeIn = ObjectAnimator.ofFloat(bgColorView, "alpha", 0, 1);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Animator circularReveal = ViewAnimationUtils.createCircularReveal(bgColorView, pos[0], pos[1], 0, finalRadius);
circularReveal.setInterpolator(new AccelerateInterpolator());
bgAnimSet.playTogether(circularReveal, fadeIn);
} else {
bgAnimSet.playTogether(fadeIn);
}
bgAnimSet.setDuration(ANIM_BACKGROUND_TIME);
bgAnimSet.addListener(new AnimatorEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mRootLayout.setBackgroundColor(color);
bgColorView.setVisibility(View.GONE);
mBackgroundContainer.removeView(bgColorView);
}
});
return bgAnimSet;
}
Aggregations