use of com.nineoldandroids.animation.Animator in project Carbon by ZieIony.
the class Toolbar method startReveal.
@Override
public Animator startReveal(int x, int y, float startRadius, float finishRadius) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT_WATCH) {
android.animation.Animator circularReveal = ViewAnimationUtils.createCircularReveal(this, x, y, startRadius, finishRadius);
circularReveal.start();
return new Animator() {
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public long getStartDelay() {
return circularReveal.getStartDelay();
}
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public void setStartDelay(long startDelay) {
circularReveal.setStartDelay(startDelay);
}
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public Animator setDuration(long duration) {
circularReveal.setDuration(duration);
return this;
}
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public long getDuration() {
return circularReveal.getDuration();
}
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public void setInterpolator(Interpolator value) {
circularReveal.setInterpolator(value);
}
@Override
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public boolean isRunning() {
return circularReveal.isRunning();
}
};
} else {
reveal = new Reveal(x, y, startRadius);
ValueAnimator animator = ValueAnimator.ofFloat(startRadius, finishRadius);
animator.setDuration(Carbon.getDefaultRevealDuration());
animator.addUpdateListener(animation -> {
reveal.radius = (float) animation.getAnimatedValue();
reveal.mask.reset();
reveal.mask.addCircle(reveal.x, reveal.y, Math.max(reveal.radius, 1), Path.Direction.CW);
postInvalidate();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
reveal = null;
}
@Override
public void onAnimationEnd(Animator animation) {
reveal = null;
}
});
animator.start();
return animator;
}
}
use of com.nineoldandroids.animation.Animator in project CoCoin by Nightonke.
the class RippleView method onTouchEvent.
@Override
public boolean onTouchEvent(final MotionEvent event) {
Log.d("TouchEvent", String.valueOf(event.getActionMasked()));
Log.d("mIsAnimating", String.valueOf(mIsAnimating));
Log.d("mAnimationIsCancel", String.valueOf(mAnimationIsCancel));
boolean superResult = super.onTouchEvent(event);
if (event.getActionMasked() == MotionEvent.ACTION_DOWN && this.isEnabled() && mHover) {
mRect = new Rect(getLeft(), getTop(), getRight(), getBottom());
mAnimationIsCancel = false;
mDownX = event.getX();
mDownY = event.getY();
mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", 0, dp(50)).setDuration(400);
mRadiusAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
mRadiusAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mIsAnimating = true;
}
@Override
public void onAnimationEnd(Animator animator) {
setRadius(0);
ViewHelper.setAlpha(RippleView.this, 1);
mIsAnimating = false;
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
mRadiusAnimator.start();
if (!superResult) {
return true;
}
} else if (event.getActionMasked() == MotionEvent.ACTION_MOVE && this.isEnabled() && mHover) {
mDownX = event.getX();
mDownY = event.getY();
// Cancel the ripple animation when moved outside
if (mAnimationIsCancel = !mRect.contains(getLeft() + (int) event.getX(), getTop() + (int) event.getY())) {
setRadius(0);
} else {
setRadius(dp(50));
}
if (!superResult) {
return true;
}
} else if (event.getActionMasked() == MotionEvent.ACTION_UP && !mAnimationIsCancel && this.isEnabled()) {
mDownX = event.getX();
mDownY = event.getY();
final float tempRadius = (float) Math.sqrt(mDownX * mDownX + mDownY * mDownY);
float targetRadius = Math.max(tempRadius, mMaxRadius);
if (mIsAnimating) {
mRadiusAnimator.cancel();
}
mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", dp(50), targetRadius);
mRadiusAnimator.setDuration(500);
mRadiusAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
mRadiusAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mIsAnimating = true;
}
@Override
public void onAnimationEnd(Animator animator) {
setRadius(0);
ViewHelper.setAlpha(RippleView.this, 1);
mIsAnimating = false;
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
mRadiusAnimator.start();
if (!superResult) {
return true;
}
}
return superResult;
}
use of com.nineoldandroids.animation.Animator in project ride-read-android by Ride-Read.
the class ShowPictureActivity method MoveView.
private void MoveView() {
ObjectAnimator.ofFloat(mainView, "alpha", 0.8f).setDuration(0).start();
mainView.setVisibility(View.VISIBLE);
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(showImageView, "translationX", tx).setDuration(200), ObjectAnimator.ofFloat(showImageView, "translationY", ty).setDuration(200), ObjectAnimator.ofFloat(mainView, "alpha", 1).setDuration(200));
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
showImageView.setScaleType(ImageView.ScaleType.FIT_XY);
spring.setEndValue(1);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
set.start();
}
use of com.nineoldandroids.animation.Animator in project ride-read-android by Ride-Read.
the class ShowPictureActivity method MoveBackView.
private void MoveBackView() {
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(showImageView, "translationX", to_x).setDuration(200), ObjectAnimator.ofFloat(showImageView, "translationY", to_y).setDuration(200));
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
finish();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
set.start();
}
use of com.nineoldandroids.animation.Animator 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();
}
Aggregations