use of android.animation.Animator in project platform_frameworks_base by android.
the class SettingsButton method startAccelSpin.
protected void startAccelSpin() {
cancelAnimation();
mAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, 360);
mAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.accelerate_quad));
mAnimator.setDuration(ACCEL_LENGTH);
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
startContinuousSpin();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
mAnimator.start();
}
use of android.animation.Animator in project platform_frameworks_base by android.
the class KeyguardUserSwitcher method startAppearAnimation.
private void startAppearAnimation() {
int count = mUserSwitcher.getChildCount();
View[] objects = new View[count];
for (int i = 0; i < count; i++) {
objects[i] = mUserSwitcher.getChildAt(i);
}
mUserSwitcher.setClipChildren(false);
mUserSwitcher.setClipToPadding(false);
mAppearAnimationUtils.startAnimation(objects, new Runnable() {
@Override
public void run() {
mUserSwitcher.setClipChildren(true);
mUserSwitcher.setClipToPadding(true);
}
});
mAnimating = true;
mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
mBgAnimator.setDuration(400);
mBgAnimator.setInterpolator(Interpolators.ALPHA_IN);
mBgAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mBgAnimator = null;
mAnimating = false;
}
});
mBgAnimator.start();
}
use of android.animation.Animator in project platform_frameworks_base by android.
the class PanelView method startUnlockHintAnimationPhase1.
/**
* Phase 1: Move everything upwards.
*/
private void startUnlockHintAnimationPhase1(final Runnable onAnimationFinished) {
float target = Math.max(0, getMaxPanelHeight() - mHintDistance);
ValueAnimator animator = createHeightAnimator(target);
animator.setDuration(250);
animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
animator.addListener(new AnimatorListenerAdapter() {
private boolean mCancelled;
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
if (mCancelled) {
mHeightAnimator = null;
onAnimationFinished.run();
} else {
startUnlockHintAnimationPhase2(onAnimationFinished);
}
}
});
animator.start();
mHeightAnimator = animator;
mKeyguardBottomArea.getIndicationView().animate().translationY(-mHintDistance).setDuration(250).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).withEndAction(new Runnable() {
@Override
public void run() {
mKeyguardBottomArea.getIndicationView().animate().translationY(0).setDuration(450).setInterpolator(mBounceInterpolator).start();
}
}).start();
}
use of android.animation.Animator in project platform_frameworks_base by android.
the class PanelView method startUnlockHintAnimationPhase2.
/**
* Phase 2: Bounce down.
*/
private void startUnlockHintAnimationPhase2(final Runnable onAnimationFinished) {
ValueAnimator animator = createHeightAnimator(getMaxPanelHeight());
animator.setDuration(450);
animator.setInterpolator(mBounceInterpolator);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mHeightAnimator = null;
onAnimationFinished.run();
notifyBarPanelExpansionChanged();
}
});
animator.start();
mHeightAnimator = animator;
}
use of android.animation.Animator in project platform_frameworks_base by android.
the class AnimatedVectorDrawable method inflate.
@Override
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
final AnimatedVectorDrawableState state = mAnimatedVectorState;
int eventType = parser.getEventType();
float pathErrorScale = 1;
final int innerDepth = parser.getDepth() + 1;
// Parse everything until the end of the animated-vector element.
while (eventType != XmlPullParser.END_DOCUMENT && (parser.getDepth() >= innerDepth || eventType != XmlPullParser.END_TAG)) {
if (eventType == XmlPullParser.START_TAG) {
final String tagName = parser.getName();
if (ANIMATED_VECTOR.equals(tagName)) {
final TypedArray a = obtainAttributes(res, theme, attrs, R.styleable.AnimatedVectorDrawable);
int drawableRes = a.getResourceId(R.styleable.AnimatedVectorDrawable_drawable, 0);
if (drawableRes != 0) {
VectorDrawable vectorDrawable = (VectorDrawable) res.getDrawable(drawableRes, theme).mutate();
vectorDrawable.setAllowCaching(false);
vectorDrawable.setCallback(mCallback);
pathErrorScale = vectorDrawable.getPixelSize();
if (state.mVectorDrawable != null) {
state.mVectorDrawable.setCallback(null);
}
state.mVectorDrawable = vectorDrawable;
}
a.recycle();
} else if (TARGET.equals(tagName)) {
final TypedArray a = obtainAttributes(res, theme, attrs, R.styleable.AnimatedVectorDrawableTarget);
final String target = a.getString(R.styleable.AnimatedVectorDrawableTarget_name);
final int animResId = a.getResourceId(R.styleable.AnimatedVectorDrawableTarget_animation, 0);
if (animResId != 0) {
if (theme != null) {
// The animator here could be ObjectAnimator or AnimatorSet.
final Animator animator = AnimatorInflater.loadAnimator(res, theme, animResId, pathErrorScale);
updateAnimatorProperty(animator, target, state.mVectorDrawable, state.mShouldIgnoreInvalidAnim);
state.addTargetAnimator(target, animator);
} else {
// The animation may be theme-dependent. As a
// workaround until Animator has full support for
// applyTheme(), postpone loading the animator
// until we have a theme in applyTheme().
state.addPendingAnimator(animResId, pathErrorScale, target);
}
}
a.recycle();
}
}
eventType = parser.next();
}
// If we don't have any pending animations, we don't need to hold a
// reference to the resources.
mRes = state.mPendingAnims == null ? null : res;
}
Aggregations