本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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");
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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);
}
};
}
示例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();
}
}
示例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;
}
示例14: removeAnimatorUpdateListener
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@SuppressWarnings("WeakerAccess") public void removeAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
animator.removeUpdateListener(updateListener);
}
示例15: removeUpdateListener
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void removeUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
lottieDrawable.removeAnimatorUpdateListener(updateListener);
}