本文整理汇总了Java中android.animation.AnimatorSet.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.addListener方法的具体用法?Java AnimatorSet.addListener怎么用?Java AnimatorSet.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.addListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBind
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public void onBind(Target view, Value o, final OnBindListener onBindListener) {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, View.ROTATION, 0f, 10f);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, View.ROTATION_X, 0f, 90f);
AnimatorSet set = new AnimatorSet();
set.setInterpolator(new AccelerateInterpolator(2f));
set.setDuration(300);
set.setStartDelay(80 * count);
set.playTogether(animatorX, animatorY);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
onBindListener.onBindDone();
}
});
set.start();
count++;
}
示例2: rotateCardsFullRotation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Retrieves an animator object for each card in the specified stack to complete a
* full revolution around one of its corners, and plays all of them together.
*/
public void rotateCardsFullRotation (int stack, CardView.Corner corner) {
List<Animator> animations = new ArrayList<Animator>();
ArrayList <CardView> cards = mStackCards.get(stack);
for (int i = 0; i < cards.size(); i++) {
CardView cardView = cards.get(i);
animations.add(cardView.getFullRotationAnimator(i, corner, false));
mLayout.bringChildToFront(cardView);
}
/** Same reasoning for bringing cards to front as in rotateCards().*/
mLayout.requestLayout();
mTouchEventsEnabled = false;
AnimatorSet set = new AnimatorSet();
set.playTogether(animations);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mTouchEventsEnabled = true;
}
});
set.start();
}
示例3: doStart
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void doStart(long delay) {
ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight);
ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight);
ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator);
animatorSet.setDuration(800);
animatorSet.setStartDelay(delay);
animatorSet.start();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
topMaskView.setVisibility(View.GONE);
bottomMaskView.setVisibility(View.GONE);
maskReLayout.setVisibility(View.GONE);
onGameStart();
}
});
}
示例4: checkDismiss
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void checkDismiss(float velX, float velY) {
float translationY = containerView.getTranslationY();
boolean backAnimation = translationY < AndroidUtilities.getPixelsInCM(0.8f, false) && (velY < 3500 || Math.abs(velY) < Math.abs(velX)) || velY < 0 && Math.abs(velY) >= 3500;
if (!backAnimation) {
boolean allowOld = allowCustomAnimation;
allowCustomAnimation = false;
useFastDismiss = true;
dismiss();
allowCustomAnimation = allowOld;
} else {
currentAnimation = new AnimatorSet();
currentAnimation.playTogether(ObjectAnimator.ofFloat(containerView, "translationY", 0));
currentAnimation.setDuration((int) (150 * (translationY / AndroidUtilities.getPixelsInCM(0.8f, false))));
currentAnimation.setInterpolator(new DecelerateInterpolator());
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
if (currentAnimation != null && currentAnimation.equals(animation)) {
currentAnimation = null;
}
}
});
currentAnimation.start();
}
}
示例5: shakeView
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public static void shakeView(final View view, final float x, final int num) {
if (num == 6) {
view.setTranslationX(0);
return;
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(view, "translationX", AndroidUtilities.dp(x)));
animatorSet.setDuration(50);
animatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
shakeView(view, num == 5 ? 0 : -x, num + 1);
}
});
animatorSet.start();
}
示例6: reStartAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void reStartAnimation(final GiftFrameLayout giftFrameLayout, final int index) {
//动画结束,这时不能触发连击动画
giftFrameLayout.setCurrentShowStatus(false);
Log.d(TAG, "reStartAnimation: 动画结束");
AnimatorSet animatorSet = giftFrameLayout.endAnmation(custormAnim);
if (animatorSet != null) {
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
Log.i(TAG, "礼物动画dismiss: index = " + index);
//动画完全结束
giftFrameLayout.CurrentEndStatus(true);
giftFrameLayout.setGiftViewEndVisibility(isEmpty());
mGiftLayoutParent.removeView(giftFrameLayout);
showGift();
}
});
}
}
示例7: hideRecordedAudioPanel
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void hideRecordedAudioPanel() {
audioToSendPath = null;
audioToSend = null;
audioToSendMessageObject = null;
AnimatorSet AnimatorSet = new AnimatorSet();
AnimatorSet.playTogether(
ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
);
AnimatorSet.setDuration(200);
AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
recordedAudioPanel.setVisibility(GONE);
}
});
AnimatorSet.start();
}
示例8: hideMenu
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@SuppressWarnings("NewApi")
private void hideMenu() {
List<Animator> animList = new ArrayList<>();
for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(400);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
menuLayout.setVisibility(View.INVISIBLE);
}
});
animSet.start();
}
示例9: runMenuItemEnterAnimations
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void runMenuItemEnterAnimations() {
mMenuItemEnterAnimator = new AnimatorSet();
AnimatorSet.Builder builder = null;
ViewGroup list = mPopup.getListView();
for (int i = 0; i < list.getChildCount(); i++) {
View view = list.getChildAt(i);
Object animatorObject = view.getTag(R.id.menu_item_enter_anim_id);
if (animatorObject != null) {
if (builder == null) {
builder = mMenuItemEnterAnimator.play((Animator) animatorObject);
} else {
builder.with((Animator) animatorObject);
}
}
}
mMenuItemEnterAnimator.addListener(mAnimationHistogramRecorder);
mMenuItemEnterAnimator.start();
}
示例10: startRipple
import android.animation.AnimatorSet; //导入方法依赖的package包/类
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();
}
childView.setPressed(false);
}
});
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();
}
示例11: rotateCards
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Retrieves an animator object for each card in the specified stack that either
* rotates it in or out depending on its current state. All of these animations
* are then played together.
*/
public void rotateCards (final int stack, CardView.Corner corner,
final boolean isRotatingOut) {
List<Animator> animations = new ArrayList<Animator>();
ArrayList <CardView> cards = mStackCards.get(stack);
for (int i = 0; i < cards.size(); i++) {
CardView cardView = cards.get(i);
animations.add(cardView.getRotationAnimator(i, corner, isRotatingOut, false));
mLayout.bringChildToFront(cardView);
}
/** All the cards are being brought to the front in order to guarantee that
* the cards being rotated in the current stack will overlay the cards in the
* other stack. After the z-ordering of all the cards is updated, a layout must
* be requested in order to apply the changes made.*/
mLayout.requestLayout();
AnimatorSet set = new AnimatorSet();
set.playTogether(animations);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mIsStackEnabled[stack] = !isRotatingOut;
}
});
set.start();
}
示例12: animate
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public final void animate(View from, View to, NavigationType navType, Direction direction, final Callback callback) {
AnimatorSet animator = createAnimator(from, to, navType, direction);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
callback.onAnimationEnd();
}
});
animator.start();
}
示例13: startRipple
import android.animation.AnimatorSet; //导入方法依赖的package包/类
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();
}
childView.setPressed(false);
}
});
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();
}
示例14: animate
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public void animate() {
final ViewGroup parentView = (ViewGroup) view.getParent();
final FrameLayout slideOutFrame = new FrameLayout(view.getContext());
final int positionView = parentView.indexOfChild(view);
slideOutFrame.setLayoutParams(view.getLayoutParams());
slideOutFrame.setClipChildren(true);
parentView.removeView(view);
slideOutFrame.addView(view);
parentView.addView(slideOutFrame, positionView);
switch (direction) {
case DIRECTION_LEFT:
slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
view.getTranslationX() - view.getWidth());
break;
case DIRECTION_RIGHT:
slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
view.getTranslationX() + view.getWidth());
break;
case DIRECTION_UP:
slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
view.getTranslationY() - view.getHeight());
break;
case DIRECTION_DOWN:
slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
view.getTranslationY() + view.getHeight());
break;
default:
break;
}
AnimatorSet slideSet = new AnimatorSet();
slideSet.play(slideAnim);
slideSet.setInterpolator(interpolator);
slideSet.setDuration(duration);
slideSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.INVISIBLE);
slideAnim.reverse();
slideOutFrame.removeAllViews();
parentView.removeView(slideOutFrame);
parentView.addView(view, positionView);
if (getListener() != null) {
getListener().onAnimationEnd(
SlideOutUnderneathAnimation.this);
}
}
});
slideSet.start();
}
示例15: animateCharViews
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void animateCharViews(View[] viewsToAnimate,
final LinearLayout parentView, final EditText editText) {
// first, make sure the items are out of sight
// by moving them by their height (maybe use parent's height?)
for (View viewToAnimate : viewsToAnimate) {
int height = viewToAnimate.getHeight();
float y = viewToAnimate.getY();
viewToAnimate.setY(y + height);
}
// now the whole container can be visible since the views are clipped
parentView.setVisibility(View.VISIBLE);
for (int i = 0; i < viewsToAnimate.length; i++) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(
ObjectAnimator.ofFloat(viewsToAnimate[i], "translationY", 0));
animatorSet.setInterpolator(new SimpleSpringInterpolator());
animatorSet.setDuration(700);
animatorSet.setStartDelay(i * 100);
if (i == viewsToAnimate.length - 1) {
// when the last char finishes animating,
// hide parent container and show the EditText
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
parentView.removeAllViews();
parentView.setVisibility(View.GONE);
if (!TextUtils.isEmpty(editText.getText()))
editText.setSelection(editText.getText().length());
editText.setVisibility(View.VISIBLE);
}
});
}
animatorSet.start();
}
}