use of android.view.animation.AccelerateInterpolator in project appsly-android-rest by 47deg.
the class MainActivity method animateContent.
private void animateContent() {
ViewHelper.setRotation(imageViewIcon, 20);
ViewHelper.setTranslationY(imageViewIcon, -100);
ViewHelper.setTranslationX(textViewCity, 100);
ViewHelper.setAlpha(linearLayoutContent, 0);
ViewHelper.setTranslationY(descriptionTempContent, 200);
ViewHelper.setTranslationY(contentBottom, 200);
animate(imageViewIcon).setDuration(300).setInterpolator(new AccelerateInterpolator()).translationY(0).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
iconFall(imageViewIcon, 10);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
}).start();
animate(textViewCity).setDuration(1000).setInterpolator(new AccelerateDecelerateInterpolator()).translationX(0).start();
animate(linearLayoutContent).setDuration(1000).alpha(1).start();
animate(contentBottom).setDuration(1000).translationY(0).start();
animate(descriptionTempContent).setDuration(1000).translationY(0).start();
}
use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by DirtyUnicorns.
the class DessertCaseView method place.
public synchronized void place(View v, Point pt, boolean animate) {
final int i = pt.x;
final int j = pt.y;
final float rnd = frand();
if (v.getTag(TAG_POS) != null) {
for (final Point oc : getOccupied(v)) {
mFreeList.add(oc);
mCells[oc.y * mColumns + oc.x] = null;
}
}
int scale = 1;
if (rnd < PROB_4X) {
if (!(i >= mColumns - 3 || j >= mRows - 3)) {
scale = 4;
}
} else if (rnd < PROB_3X) {
if (!(i >= mColumns - 2 || j >= mRows - 2)) {
scale = 3;
}
} else if (rnd < PROB_2X) {
if (!(i == mColumns - 1 || j == mRows - 1)) {
scale = 2;
}
}
v.setTag(TAG_POS, pt);
v.setTag(TAG_SPAN, scale);
tmpSet.clear();
final Point[] occupied = getOccupied(v);
for (final Point oc : occupied) {
final View squatter = mCells[oc.y * mColumns + oc.x];
if (squatter != null) {
tmpSet.add(squatter);
}
}
for (final View squatter : tmpSet) {
for (final Point sq : getOccupied(squatter)) {
mFreeList.add(sq);
mCells[sq.y * mColumns + sq.x] = null;
}
if (squatter != v) {
squatter.setTag(TAG_POS, null);
if (animate) {
squatter.animate().withLayer().scaleX(0.5f).scaleY(0.5f).alpha(0).setDuration(DURATION).setInterpolator(new AccelerateInterpolator()).setListener(new Animator.AnimatorListener() {
public void onAnimationStart(Animator animator) {
}
public void onAnimationEnd(Animator animator) {
removeView(squatter);
}
public void onAnimationCancel(Animator animator) {
}
public void onAnimationRepeat(Animator animator) {
}
}).start();
} else {
removeView(squatter);
}
}
}
for (final Point oc : occupied) {
mCells[oc.y * mColumns + oc.x] = v;
mFreeList.remove(oc);
}
final float rot = (float) irand(0, 4) * 90f;
if (animate) {
v.bringToFront();
AnimatorSet set1 = new AnimatorSet();
set1.playTogether(ObjectAnimator.ofFloat(v, View.SCALE_X, (float) scale), ObjectAnimator.ofFloat(v, View.SCALE_Y, (float) scale));
set1.setInterpolator(new AnticipateOvershootInterpolator());
set1.setDuration(DURATION);
AnimatorSet set2 = new AnimatorSet();
set2.playTogether(ObjectAnimator.ofFloat(v, View.ROTATION, rot), ObjectAnimator.ofFloat(v, View.X, i * mCellSize + (scale - 1) * mCellSize / 2), ObjectAnimator.ofFloat(v, View.Y, j * mCellSize + (scale - 1) * mCellSize / 2));
set2.setInterpolator(new DecelerateInterpolator());
set2.setDuration(DURATION);
set1.addListener(makeHardwareLayerListener(v));
set1.start();
set2.start();
} else {
v.setX(i * mCellSize + (scale - 1) * mCellSize / 2);
v.setY(j * mCellSize + (scale - 1) * mCellSize / 2);
v.setScaleX((float) scale);
v.setScaleY((float) scale);
v.setRotation(rot);
}
}
use of android.view.animation.AccelerateInterpolator in project android_packages_apps_DUI by DirtyUnicorns.
the class FlingRipple method startRipple.
private void startRipple(final Runnable animationEndRunnable) {
if (eventCancelled)
return;
float endRadius = getEndRadius();
cancelAnimations();
rippleAnimator = new AnimatorSet();
rippleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!ripplePersistent) {
setRadius(0);
setRippleAlpha(rippleAlpha);
}
if (animationEndRunnable != null && rippleDelayClick) {
animationEndRunnable.run();
}
mDrawBackground = false;
mHost.invalidate();
}
});
ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
ripple.setDuration(rippleDuration);
ripple.setInterpolator(new DecelerateInterpolator());
ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
fade.setDuration(rippleFadeDuration);
fade.setInterpolator(new AccelerateInterpolator());
fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
if (ripplePersistent) {
rippleAnimator.play(ripple);
} else if (getRadius() > endRadius) {
fade.setStartDelay(0);
rippleAnimator.play(fade);
} else {
rippleAnimator.playTogether(ripple, fade);
}
rippleAnimator.start();
}
use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by AOSPA.
the class PhoneStatusBar method setAreThereNotifications.
@Override
protected void setAreThereNotifications() {
if (SPEW) {
final boolean clearable = hasActiveNotifications() && hasActiveClearableNotifications();
Log.d(TAG, "setAreThereNotifications: N=" + mNotificationData.getActiveNotifications().size() + " any=" + hasActiveNotifications() + " clearable=" + clearable);
}
final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out);
final boolean showDot = hasActiveNotifications() && !areLightsOn();
if (showDot != (nlo.getAlpha() == 1.0f)) {
if (showDot) {
nlo.setAlpha(0f);
nlo.setVisibility(View.VISIBLE);
}
nlo.animate().alpha(showDot ? 1 : 0).setDuration(showDot ? 750 : 250).setInterpolator(new AccelerateInterpolator(2.0f)).setListener(showDot ? null : new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator _a) {
nlo.setVisibility(View.GONE);
}
}).start();
}
findAndUpdateMediaNotifications();
}
use of android.view.animation.AccelerateInterpolator in project MultiPhotoPicker by wangeason.
the class ImagePagerFragment method runExitAnimation.
/**
* The exit animation is basically a reverse of the enter animation, except that if
* the orientation has changed we simply scale the picture back into the center of
* the screen.
*
* @param endAction This action gets run after the animation completes (this is
* when we actually switch activities)
*/
public void runExitAnimation(final Runnable endAction) {
if (!getArguments().getBoolean(ARG_HAS_ANIM, false) || !hasAnim) {
endAction.run();
return;
}
final long duration = ANIM_DURATION;
// Animate image back to thumbnail size/location
ViewPropertyAnimator.animate(mViewPager).setDuration(duration).setInterpolator(new AccelerateInterpolator()).scaleX((float) thumbnailWidth / mViewPager.getWidth()).scaleY((float) thumbnailHeight / mViewPager.getHeight()).translationX(thumbnailLeft).translationY(thumbnailTop).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
endAction.run();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
// Fade out background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image back to grayscale,
// in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this, "saturation", 1, 0);
colorizer.setDuration(duration);
colorizer.start();
}
Aggregations