public AnimatedColorStateList(int[][] states, int[] colors, final ValueAnimator.AnimatorUpdateListener listener) { super(states, colors); this.states = states; colorAnimation = ValueAnimator.ofInt(0, 0); colorAnimation.setEvaluator(new ArgbEvaluator()); colorAnimation.setDuration(200); colorAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); colorAnimation.addUpdateListener(animation -> { synchronized (AnimatedColorStateList.this) { animatedColor = (int) animation.getAnimatedValue(); listener.onAnimationUpdate(animation); } }); }
final View background = XposedHelpers.getBooleanField(expandableView, "mDimmed") ? mBackgroundDimmed : mBackgroundNormal; background.setAlpha(0f); helper.mBackgroundVisibilityUpdater.onAnimationUpdate(null); background.setPivotX(mBackgroundDimmed.getWidth() / 2f); background.setPivotY(((int) XposedHelpers.callMethod(expandableView, "getActualHeight")) / 2f);
@Override public void onAnimationUpdate(ValueAnimator animation) { int height = (int) animation.getAnimatedValue(); //列表中加载到内容时滚动List if (!ScrollingUtil.isViewToBottom(cp.getTargetView(), cp.getTouchSlop())) { int dy = getVisibleFootHeight() - height; //可以让TargetView滚动dy高度,但这样两个方向上滚动感觉画面闪烁,改为dy/2是为了消除闪烁 if (dy > 0) { if (cp.getTargetView() instanceof RecyclerView) ScrollingUtil.scrollAViewBy(cp.getTargetView(), dy); else ScrollingUtil.scrollAViewBy(cp.getTargetView(), dy / 2); } } //decorate the AnimatorUpdateListener animBottomUpListener.onAnimationUpdate(animation); } }, new AnimatorListenerAdapter() {
@Override public void onAnimationUpdate(ValueAnimator animation) { Log.d("xxx", "onAnimationUpdate"); if (listener != null) { listener.onAnimationUpdate(animation); } } });
@Override public void onAnimationUpdate(ValueAnimator animation) { ValueAnimator.AnimatorUpdateListener listener = wrapped.get(); if (listener != null) { listener.onAnimationUpdate(animation); } } }
void notifyUpdate() { for (ValueAnimator.AnimatorUpdateListener listener : updateListeners) { listener.onAnimationUpdate(this); } } }