/** * 停止动画 */ public void cancelSunLineAnim() { if (mAnimator != null) { mAnimator.cancel(); } }
private void cancelChildAnimListAndClear() { for (ObjectAnimator animator : anims) { animator.cancel(); } anims.clear(); }
@Override public void onAnimationStart(Animator animation) { for (WeakReference<ObjectAnimator> wa : sRunningAnimators) { ObjectAnimator a = wa.get(); if (a == null) { continue; } if (hasSameTargetAndProperties(animator, a)) { a.cancel(); } } } });
private void showBubble() { AnimatorSet animatorSet = new AnimatorSet(); bubble.setVisibility(VISIBLE); if (currentAnimator != null) currentAnimator.cancel(); currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION); currentAnimator.start(); }
private void hideBubble() { if (currentAnimator != null) currentAnimator.cancel(); currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 1f, 0f).setDuration(BUBBLE_ANIMATION_DURATION); currentAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); bubble.setVisibility(INVISIBLE); currentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); bubble.setVisibility(INVISIBLE); currentAnimator = null; } }); currentAnimator.start(); }
@Override protected void onDetachedFromWindow() { if (arrowAnimator != null) { arrowAnimator.cancel(); } super.onDetachedFromWindow(); }
private void startHover() { if (eventCancelled) return; if (hoverAnimator != null) { hoverAnimator.cancel(); } final float radius = (float) (Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)) * 1.2f); hoverAnimator = ObjectAnimator.ofFloat(this, radiusProperty, rippleDiameter, radius) .setDuration(HOVER_DURATION); hoverAnimator.setInterpolator(new LinearInterpolator()); hoverAnimator.start(); }
private void hideSlider(View sliderPanel) { if (null != mSeekBarPanelAnimator) { mSeekBarPanelAnimator.cancel(); mSeekBarPanelAnimator = null; } mSeekBarPanelAnimator = ObjectAnimator.ofFloat(sliderPanel, "translationY", sliderPanel.getHeight()); mSeekBarPanelAnimator.setDuration(SLIDER_ANIMATION_DURING); mSeekBarPanelAnimator.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR); mSeekBarPanelAnimator.addUpdateListener(mUpdateSliderListener); mSeekBarPanelAnimator.addListener(mHideSliderListener); mSeekBarPanelAnimator.start(); if (null != mSystemUiHelper) { mSystemUiHelper.hide(); mShowSystemUi = false; } }
private void showSlider(View sliderPanel) { if (null != mSeekBarPanelAnimator) { mSeekBarPanelAnimator.cancel(); mSeekBarPanelAnimator = null; } sliderPanel.setTranslationY(sliderPanel.getHeight()); sliderPanel.setVisibility(View.VISIBLE); mSeekBarPanelAnimator = ObjectAnimator.ofFloat(sliderPanel, "translationY", 0.0f); mSeekBarPanelAnimator.setDuration(SLIDER_ANIMATION_DURING); mSeekBarPanelAnimator.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR); mSeekBarPanelAnimator.addUpdateListener(mUpdateSliderListener); mSeekBarPanelAnimator.addListener(mShowSliderListener); mSeekBarPanelAnimator.start(); if (null != mSystemUiHelper) { mSystemUiHelper.show(); mShowSystemUi = true; } }
private ObjectAnimator getTitleAnimator() { if (mAnimator == null) { if (mCurTitleProperty == null) mCurTitleProperty = new TitleProperty(); mAnimator = ObjectAnimator.ofObject(this, TITLE_PROPERTY, new TitleEvaluator(mCurTitleProperty), mCurTitleProperty); mAnimator.setDuration(ANIMATION_DURATION); mAnimator.setInterpolator(ANIMATION_INTERPOLATOR); } else { mAnimator.cancel(); } return mAnimator; }
private void cancelTopAnimation(){ if(mTopAnimator!=null){ mTopAnimator.cancel(); mTopAnimator.removeAllListeners(); mTopAnimator.removeAllUpdateListeners(); } }
private void cancelAnimations() { if (rippleAnimator != null) { rippleAnimator.cancel(); rippleAnimator.removeAllListeners(); } if (hoverAnimator != null) { hoverAnimator.cancel(); } }
private void cancelBottomAnimation(){ if(mBottomAnimator!=null){ mBottomAnimator.cancel(); mBottomAnimator.removeAllListeners(); mBottomAnimator.removeAllUpdateListeners(); } }
public void setVisibilityWithAnimation(final int visibility, int delayIndex) { if (visibility == View.VISIBLE && getVisibility() != View.VISIBLE) { setAlpha(0); setVisibility(visibility); if (null != alphaAnimator) { alphaAnimator.cancel(); } alphaAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f); alphaAnimator.setDuration(360); alphaAnimator.setStartDelay(delayIndex * 200); alphaAnimator.start(); } } }
private void transitionSecene(int position) { if (transitionAnimator != null) { transitionAnimator.cancel(); } countryView.saveNextPosition(position, dataList.get(position).getCountry() + "-" + position); temperatureView.saveNextPosition(position, dataList.get(position).getTemperature()); addressView.saveNextPosition(position, dataList.get(position).getAddress()); bottomView.saveNextPosition(position, dataList.get(position).getMapImageUrl()); timeView.saveNextPosition(position, dataList.get(position).getTime()); transitionAnimator = ObjectAnimator.ofFloat(this, "transitionValue", 0.0f, 1.0f); transitionAnimator.setDuration(300); transitionAnimator.start(); transitionAnimator.addListener(animatorListener); }
@Override public boolean onTouchEvent(@NonNull MotionEvent event) { final int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: if (event.getX() < handle.getX()) return false; if (currentAnimator != null) currentAnimator.cancel(); if (bubble.getVisibility() == INVISIBLE) showBubble(); handle.setSelected(true); case MotionEvent.ACTION_MOVE: final float y = event.getY(); setBubbleAndHandlePosition(y); setRecyclerViewPosition(y); return true; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: handle.setSelected(false); hideBubble(); return true; } return super.onTouchEvent(event); }
public void translationToLeft() { if (mObjectAnimator != null) { mObjectAnimator.cancel(); mObjectAnimator = null; } initTranlationAnimate(0, (int) (-getWidth() * 1.2)); initTranlationAnimate1(getWidth(), 0); }
public void stopRotation() { if (mObjectAnimator != null) { if (mObjectAnimator.isRunning()) { mObjectAnimator.cancel(); } float valueAvatar = (float) mObjectAnimator.getAnimatedValue(); v = valueAvatar; mObjectAnimator.setFloatValues(valueAvatar, 360f + valueAvatar); } else { initRotateAnimation(0f); } }
public void translationToRight() { mObjectAnimator.cancel(); mObjectAnimator = null; initRotateAnimation(0f); initTranlationAnimate(0, (int) (getWidth() * 1.2)); initTranlationAnimate1(-getWidth(), 0); }
mRotateAnim.cancel(); float valueAvatar = (float) mRotateAnim.getAnimatedValue(); mRotateAnim.setFloatValues(valueAvatar, 360f + valueAvatar);