use of com.nineoldandroids.animation.AnimatorListenerAdapter in project PhotoNoter by yydcdut.
the class ZoomHeaderImageView method doAnimation.
private void doAnimation() {
AnimatorSet animatorSet = new AnimatorSet();
if (mCurrentIndex % 2 == 0) {
animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView0, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView1, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "alpha", 0.0f, 1.0f));
} else {
animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView1, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView0, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "alpha", 0.0f, 1.0f));
}
animatorSet.setDuration(400).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mImageView0.setVisibility(VISIBLE);
mImageView1.setVisibility(VISIBLE);
if (mCurrentIndex % 2 == 0) {
mImageView1.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
} else {
mImageView0.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
}
}
@Override
public void onAnimationEnd(Animator animation) {
mCurrentIndex++;
if (mCurrentIndex % 2 == 0) {
mImageView1.setVisibility(INVISIBLE);
} else {
mImageView0.setVisibility(INVISIBLE);
}
mHandler.sendEmptyMessageDelayed(0, 3000);
}
});
animatorSet.start();
}
use of com.nineoldandroids.animation.AnimatorListenerAdapter in project AisenWeiBo by wangdan.
the class FabAnimation method startArcAnim.
protected void startArcAnim(View view, float endX, float endY, float degrees, Side side, long duration, Interpolator interpolator, final AnimationListener listener) {
// Setup animation
// Cast end coordinates to ints so that the FAB will be animated to the same position even
// when there are minute differences in the coordinates
ArcAnimator anim = ArcAnimator.createArcAnimator(view, (int) endX, (int) endY, degrees, side);
anim.setDuration(duration);
anim.setInterpolator(interpolator);
// Add listener
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (listener != null) {
listener.onStart();
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (listener != null) {
listener.onEnd();
}
}
});
// Start animation
anim.start();
}
use of com.nineoldandroids.animation.AnimatorListenerAdapter in project SunDay by iQuick.
the class SwipeListViewTouchListener method generateDismissAnimate.
/**
* Create dismiss animation
*
* @param view affected view
* @param swap If will change state. If is "false" returns to the original position
* @param swapRight If swap is true, this parameter tells if move is to the right or left
* @param position Position of list
*/
private void generateDismissAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
int moveTo = 0;
if (opened.get(position)) {
if (!swap) {
moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
}
} else {
if (swap) {
moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
}
}
int alpha = 1;
if (swap) {
++dismissAnimationRefCount;
alpha = 0;
}
animate(view).translationX(moveTo).alpha(alpha).setDuration(animationTime).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (swap) {
closeOpenedItems();
performDismiss(view, position, true);
}
resetCell();
}
});
}
Aggregations