当前位置: 首页>>代码示例>>Java>>正文


Java AnimatorSet.addListener方法代码示例

本文整理汇总了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++;
}
 
开发者ID:sedstrom,项目名称:Witch-Android,代码行数:20,代码来源:FlipOut.java

示例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();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:28,代码来源:CardFlip.java

示例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();
        }
    });
}
 
开发者ID:Brave-wan,项目名称:SmartRefresh,代码行数:22,代码来源:FunGameHeader.java

示例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();
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:26,代码来源:BottomSheet.java

示例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();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:17,代码来源:AndroidUtilities.java

示例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();
            }
        });
    }
}
 
开发者ID:DyncKathline,项目名称:LiveGiftLayout,代码行数:20,代码来源:GiftControl.java

示例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();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:19,代码来源:ChatActivityEnterView.java

示例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();

}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:24,代码来源:DemoLikePathActivity.java

示例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();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:AppMenu.java

示例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();
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:41,代码来源:MaterialRippleLayout.java

示例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();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:33,代码来源:CardFlip.java

示例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();
}
 
开发者ID:wealthfront,项目名称:magellan,代码行数:12,代码来源:DefaultTransition.java

示例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();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:40,代码来源:MaterialRippleLayout.java

示例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();
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:54,代码来源:SlideOutUnderneathAnimation.java

示例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();
    }
}
 
开发者ID:mcassiano,项目名称:cute-currency-view,代码行数:44,代码来源:CuteCurrencyView.java


注:本文中的android.animation.AnimatorSet.addListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。