當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueAnimator.AnimatorUpdateListener方法代碼示例

本文整理匯總了Java中android.animation.ValueAnimator.AnimatorUpdateListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.AnimatorUpdateListener方法的具體用法?Java ValueAnimator.AnimatorUpdateListener怎麽用?Java ValueAnimator.AnimatorUpdateListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.AnimatorUpdateListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void startAnim() {
    if (mAnimators == null) createAnimators();
    if (mAnimators == null) return;
    if (isStarted()) return;

    for (int i = 0; i < mAnimators.size(); i++) {
        ValueAnimator animator = mAnimators.get(i);

        //when the animator restart , add the updateListener again because they was removed by animator stop .
        ValueAnimator.AnimatorUpdateListener updateListener = mUpdateListeners.get(animator);
        if (updateListener != null) {
            animator.addUpdateListener(updateListener);
        }
        animator.start();
    }
    mIsStarted = true;
    setIndicatorColor(animatingColor);
}
 
開發者ID:penghuanliang,項目名稱:Rxjava2.0Demo,代碼行數:19,代碼來源:BallPulseView.java

示例2: onAnimationUpdate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    if (DEBUG) {
        log("Animation update "
                + animation.getAnimatedFraction() + " on: "
                + Thread.currentThread().getName());
    }

    mBackgroundFraction = animation.getAnimatedFraction();

    // propagate the animation event to all listeners
    for (ValueAnimator.AnimatorUpdateListener listener : mAnimationListenerCache) {
        listener.onAnimationUpdate(animation);
    }

    // animation updates occur on the main thread. it is save to call invalidate here.
    PieLayout.this.invalidate();
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:19,代碼來源:PieLayout.java

示例3: startAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void startAnim() {
    if (mAnimators == null) createAnimators();
    if (mAnimators == null) return;
    if (isStarted()) return;

    for (int i = 0; i < mAnimators.size(); i++) {
        ValueAnimator animator = mAnimators.get(i);

        //when the animator restart , add the updateListener again because they was removed by animator stop .
        ValueAnimator.AnimatorUpdateListener updateListener = mUpdateListeners.get(animator);
        if (updateListener != null) {
            animator.addUpdateListener(updateListener);
        }
        animator.start();
    }
    setIndicatorColor(animatingColor);
}
 
開發者ID:Justson,項目名稱:AgentWebX5,代碼行數:18,代碼來源:BallPulseView.java

示例4: initAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * 初始化動畫效果
 *
 * @param name         String類型的名稱,用於標記需要初始化動畫的圖形
 * @param enabled      是否開啟動畫效果
 * @param animDuration 動畫執行時長
 */
public void initAnimation(String name, boolean enabled, long animDuration) {
    if (null == name)
        return;

    final EasyAnimationEntity animationEntity = new EasyAnimationEntity();
    animationEntity.isAnimationEnabled = enabled;
    animationEntity.animDuration = animDuration;
    animationEntity.animUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            animationEntity.animatorValue = (float) animation.getAnimatedValue();
            invalidate();
        }
    };
    animationMap.put(name, animationEntity);
}
 
開發者ID:huzenan,項目名稱:EasyChart,代碼行數:24,代碼來源:EasyCoordinate.java

示例5: activate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void activate(Point center, Position position) {
    if (Looper.myLooper() != Looper.getMainLooper()) {
        log("Activation not on main thread: " + Thread.currentThread().getName());
    }

    if (DEBUG) mActivateStartDebug = SystemClock.uptimeMillis();

    mPosition = position;
    mLayoutDoneForPosition = null;
    mActive = true;

    // Set the activation center as center of the pie
    // This will be corrected by the #onLayout call.
    mCenter = center;

    mAnimationListenerCache.clear();
    for (PieSlice slice : mSlices) {
        if (slice instanceof ValueAnimator.AnimatorUpdateListener) {
            mAnimationListenerCache.add((ValueAnimator.AnimatorUpdateListener)slice);
        }
    }

    mBackgroundFraction = 0.0f;
    mBackgroundAnimator.setStartDelay(mLongpressDelay+500);
    if (!mSysinfoDisabled) {
        mBackgroundAnimator.start();
    }

    setVisibility(View.VISIBLE);

    if (DEBUG) {
        log("activate finished within "
                + (SystemClock.uptimeMillis() - mActivateStartDebug) + " ms");
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:36,代碼來源:PieLayout.java

示例6: startAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startAnimators() {
    for (int i = 0; i < mAnimators.size(); i++) {
        ValueAnimator animator = mAnimators.get(i);

        //when the progressAnimator restart , add the updateListener again because they
        // was removed by progressAnimator stop .
        ValueAnimator.AnimatorUpdateListener updateListener = mUpdateListeners.get(animator);
        if (updateListener != null) {
            animator.addUpdateListener(updateListener);
        }

        animator.start();
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:15,代碼來源:Indicator.java

示例7: createAnimatorUpdateListener

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * Create an animator update listener to be used to update the drawable to be animated.
 *
 * @param drawable the drawable to create the animator update listener for
 * @return the listener to use
 */
@Nullable
public static ValueAnimator.AnimatorUpdateListener createAnimatorUpdateListener(
    final Drawable drawable) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
    return null;
  }

  if (drawable instanceof AnimatedDrawable2) {
    return AnimatedDrawable2ValueAnimatorHelper.createAnimatorUpdateListener(
        (AnimatedDrawable2) drawable);
  }
  return null;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:AnimatedDrawableValueAnimatorHelper.java

示例8: startAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startAnimators() {
    if (animators != null) {
        final Set<Map.Entry<ValueAnimator, ValueAnimator.AnimatorUpdateListener>> entries = animators.entrySet();
        for (Map.Entry<ValueAnimator, ValueAnimator.AnimatorUpdateListener> entry : entries) {
            ValueAnimator.AnimatorUpdateListener updateListener = entry.getValue();
            final ValueAnimator animator = entry.getKey();
            if (updateListener != null) {
                animator.addUpdateListener(updateListener);
            }
            animator.start();
        }
    }
}
 
開發者ID:Adyen,項目名稱:adyen-android,代碼行數:14,代碼來源:Animation.java

示例9: animationAddUpdateListener

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public RxAnimatorObservable animationAddUpdateListener(ValueAnimator.AnimatorUpdateListener animatorUpdateListener) {
    if (this.animatorUpdateListeners == null) {
        this.animatorUpdateListeners = new ArrayList<>();
    }
    this.animatorUpdateListeners.add(animatorUpdateListener);
    return this;
}
 
開發者ID:datalink747,項目名稱:Rx_java2_soussidev,代碼行數:8,代碼來源:RxAnimator_java.java

示例10: getOnTranslateYAnimationUpdate

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * 重置垂直動畫的監聽器
 *
 * @return
 */
public ValueAnimator.AnimatorUpdateListener getOnTranslateYAnimationUpdate() {
    if (onTranslateYAnimationUpdate != null) return onTranslateYAnimationUpdate;
    onTranslateYAnimationUpdate = new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            translateTop = (float) animation.getAnimatedValue();
            invalidate();
        }
    };
    return onTranslateYAnimationUpdate;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:ImagePreviewView.java

示例11: createAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void createAnimator() {
        mAnimator = ValueAnimator.ofInt(RES_IDS.length - 1);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mAnimator.setRepeatMode(ValueAnimator.RESTART);
        mAnimator.setDuration(RES_IDS.length / fps * 1000);

        mAnimUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                invalidate(((int) animation.getAnimatedValue()));
//                System.out.println("FrameAnimDrawable onAnimationUpdate resIndex "+resIndex);
            }
        };
    }
 
開發者ID:yangjiantao,項目名稱:AndroidUiKit,代碼行數:16,代碼來源:FrameAnimDrawable.java

示例12: startAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void startAnimators() {
    for (int i = 0; i < mAnimators.size(); i++) {
        ValueAnimator animator = mAnimators.get(i);

        //when the animator restart , add the updateListener again because they
        // was removed by animator stop .
        ValueAnimator.AnimatorUpdateListener updateListener = mUpdateListeners.get(animator);
        if (updateListener != null) {
            animator.addUpdateListener(updateListener);
        }

        animator.start();
    }
}
 
開發者ID:yedashen,項目名稱:UltimateRecyclerView,代碼行數:15,代碼來源:Indicator.java

示例13: startToMaxAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * 視圖從一個中心點坐標, 平移放大到結束點坐標
 */
public static ValueAnimator startToMaxAnim(Rect startRect, final View targetView,
                                           Point from, Point to,
                                           int maxWidth, int maxHeight, final long startDelay,
                                           Animator.AnimatorListener listener) {
    startRect = ensureRect(startRect);

    int statusBarHeight = 0;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        statusBarHeight = RApplication.getApp().getResources().getDimensionPixelOffset(R.dimen.status_bar_height);
    }

    final Point startPoint = new Point(from.x, from.y - statusBarHeight);
    final Point endPoint = new Point(to.x, to.y - statusBarHeight);

    final int targetWidth = Math.min(ScreenUtil.screenWidth, maxWidth);
    final int targetHeight = Math.min(ScreenUtil.screenHeight, maxHeight);

    final float startScaleX = startRect.width() * 1f / targetWidth;
    final float startScaleY = startRect.height() * 1f / targetHeight;

    final ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
    animator.addListener(listener);

    final ValueAnimator.AnimatorUpdateListener updateListener = new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (float) animation.getAnimatedValue();

            updateMaxValue(targetView, startScaleX, startScaleY, startPoint, endPoint, value);

            notifyAnimProgress(animation, animation.getAnimatedFraction());
        }
    };

    animator.addUpdateListener(updateListener);

    animator.setDuration(UIIViewImpl.DEFAULT_FINISH_ANIM_TIME);
    if (startDelay > 0) {
        animator.setStartDelay(startDelay);
    }
    animator.setInterpolator(new DecelerateInterpolator());

    if (targetView.getMeasuredWidth() == 0 || targetView.getMeasuredHeight() == 0) {
        targetView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                if (startDelay > 0) {
                    updateMaxValue(targetView, startScaleX, startScaleY, startPoint, endPoint, 0);
                }
                notifyAnimDelayStart(animator);
                animator.start();
                targetView.getViewTreeObserver().removeOnPreDrawListener(this);
                return false;
            }
        });
    } else {
        if (startDelay > 0) {
            updateMaxValue(targetView, startScaleX, startScaleY, startPoint, endPoint, 0);
        }
        notifyAnimDelayStart(animator);
        animator.start();
    }

    return animator;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:69,代碼來源:AnimUtil.java

示例14: removeAnimatorUpdateListener

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@SuppressWarnings("WeakerAccess") public void removeAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
  animator.removeUpdateListener(updateListener);
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:4,代碼來源:LottieDrawable.java

示例15: removeUpdateListener

import android.animation.ValueAnimator; //導入方法依賴的package包/類
@SuppressWarnings("unused")
public void removeUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
  lottieDrawable.removeAnimatorUpdateListener(updateListener);
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:5,代碼來源:LottieAnimationView.java


注:本文中的android.animation.ValueAnimator.AnimatorUpdateListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。