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


Java AnimatorUpdateListener類代碼示例

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


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

示例1: spin

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
/**
 * Applys a spin animation to the Chart.
 *
 * @param durationmillis
 * @param fromangle
 * @param toangle
 */
@SuppressLint("NewApi")
public void spin(int durationmillis, float fromangle, float toangle, Easing.EasingOption easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    setRotationAngle(fromangle);

    ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle,
            toangle);
    spinAnimator.setDuration(durationmillis);
    spinAnimator.setInterpolator(Easing.getEasingFunctionFromOption(easing));

    spinAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            postInvalidate();
        }
    });
    spinAnimator.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:PieRadarChartBase.java

示例2: animateFilterTo

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:21,代碼來源:DragView.java

示例3: animateShift

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
public void animateShift(final int shiftX, final int shiftY) {
    if (mAnim.isStarted()) {
        return;
    }
    mAnimatedShiftX = shiftX;
    mAnimatedShiftY = shiftY;
    applyTranslation();
    mAnim.addUpdateListener(new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float fraction = 1 - animation.getAnimatedFraction();
            mAnimatedShiftX = (int) (fraction * shiftX);
            mAnimatedShiftY = (int) (fraction * shiftY);
            applyTranslation();
        }
    });
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:18,代碼來源:DragView.java

示例4: createHotseatAlphaAnimator

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
public ValueAnimator createHotseatAlphaAnimator(float finalValue) {
    if (Float.compare(finalValue, mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX]) == 0) {
        // Return a dummy animator to avoid null checks.
        return ValueAnimator.ofFloat(0, 0);
    } else {
        ValueAnimator animator = ValueAnimator
                .ofFloat(mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX], finalValue);
        animator.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float value = (Float) valueAnimator.getAnimatedValue();
                setHotseatAlphaAtIndex(value, HOTSEAT_STATE_ALPHA_INDEX);
            }
        });

        AccessibilityManager am = (AccessibilityManager)
                mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
        final boolean accessibilityEnabled = am.isEnabled();
        animator.addUpdateListener(
                new AlphaUpdateListener(mLauncher.getHotseat(), accessibilityEnabled));
        animator.addUpdateListener(
                new AlphaUpdateListener(mPageIndicator, accessibilityEnabled));
        return animator;
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:26,代碼來源:Workspace.java

示例5: snapChild

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void snapChild(final View animView, final float targetLeft, float velocity) {
    final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
    AnimatorUpdateListener updateListener = new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            onTranslationUpdate(animView, (float) animation.getAnimatedValue(), canBeDismissed);
        }
    };

    Animator anim = getViewTranslationAnimator(animView, targetLeft, updateListener);
    if (anim == null) {
        return;
    }
    int duration = SNAP_ANIM_LEN;
    anim.setDuration(duration);
    anim.addListener(new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator animator) {
            mSnappingChild = false;
            updateSwipeProgressFromOffset(animView, canBeDismissed);
            mCallback.onChildSnappedBack(animView, targetLeft);
        }
    });
    prepareSnapBackAnimation(animView, anim);
    mSnappingChild = true;
    anim.start();
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:26,代碼來源:SwipeHelper.java

示例6: animateShadeOpen

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
void animateShadeOpen() {
    this.phone.performHapticFeedback(3, 2);
    updateText(this.explanation, R.string.oob_pullout_shade_all_the_way, 0, null);
    final float dimIncrement = this.dimValue / ((float) this.shadeHeight);
    float currentHeight = (float) this.shade.getHeight();
    ValueAnimator va = ValueAnimator.ofInt(new int[]{(int) currentHeight, this.shadeHeight});
    va.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer height = (Integer) animation.getAnimatedValue();
            LayoutParams layoutParams = OOBTutorialActivity.this.shade.getLayoutParams();
            layoutParams.height = height.intValue();
            OOBTutorialActivity.this.shade.setLayoutParams(layoutParams);
            OOBTutorialActivity.this.dim.setAlpha(height.floatValue() * dimIncrement);
            OOBTutorialActivity.this.shade.requestLayout();
        }
    });
    va.start();
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:19,代碼來源:OOBTutorialActivity.java

示例7: animateShadeClose

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
void animateShadeClose() {
    this.phone.performHapticFeedback(3, 2);
    updateText(this.explanation, R.string.oob_pullout_shade_all_the_way, 0, null);
    final float dimIncrement = this.dimValue / ((float) this.shadeHeight);
    float currentHeight = (float) this.shade.getHeight();
    ValueAnimator va = ValueAnimator.ofInt(new int[]{(int) currentHeight, 0});
    va.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer height = (Integer) animation.getAnimatedValue();
            LayoutParams layoutParams = OOBTutorialActivity.this.shade.getLayoutParams();
            layoutParams.height = height.intValue();
            OOBTutorialActivity.this.shade.setLayoutParams(layoutParams);
            OOBTutorialActivity.this.dim.setAlpha(height.floatValue() * dimIncrement);
            OOBTutorialActivity.this.shade.requestLayout();
        }
    });
    va.start();
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:19,代碼來源:OOBTutorialActivity.java

示例8: onLoadingFinish

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
@Override
public AnimatorUpdateListener onLoadingFinish(int footerHeight, Interpolator interpolator, int duration) {
    if (mScrollableView != null) {
        if (mScrollableView instanceof RecyclerView) ((RecyclerView) mScrollableView).smoothScrollBy(0, footerHeight, interpolator);
        else if (mScrollableView instanceof ScrollView) ((ScrollView) mScrollableView).smoothScrollBy(0, footerHeight);
        else if (mScrollableView instanceof AbsListView) ((AbsListView) mScrollableView).smoothScrollBy(footerHeight, duration);
        else {
            try {
                Method method = mScrollableView.getClass().getDeclaredMethod("smoothScrollBy", Integer.class, Integer.class);
                method.invoke(mScrollableView, 0, footerHeight);
            } catch (Exception e) {
                int scrollX = mScrollableView.getScrollX();
                int scrollY = mScrollableView.getScrollY();
                return animation -> mScrollableView.scrollTo(scrollX, scrollY + (int) animation.getAnimatedValue());
            }
        }
        return null;
    }
    return null;
}
 
開發者ID:Brave-wan,項目名稱:SmartRefresh,代碼行數:21,代碼來源:RefreshContentWrapper.java

示例9: onLayoutChange

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
        int oldLeft, int oldTop, int oldRight, int oldBottom) {
    if (mSheetAnimator != null) mSheetAnimator.cancel();

    mRequestView.removeOnLayoutChangeListener(this);
    mContainerHeightDifference = (bottom - top) - (oldBottom - oldTop);

    ValueAnimator containerAnimator = ValueAnimator.ofFloat(1f, 0f);
    containerAnimator.addUpdateListener(new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float alpha = (Float) animation.getAnimatedValue();
            update(alpha);
        }
    });

    mSheetAnimator = containerAnimator;
    mSheetAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
    mSheetAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    mSheetAnimator.addListener(this);
    mSheetAnimator.start();
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:24,代碼來源:PaymentRequestUI.java

示例10: doTabPageIndicatorAnimator

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void doTabPageIndicatorAnimator(int start, int end) {
    this.mTabPIValueAnimator = ValueAnimator.ofInt(new int[]{start, end});
    this.mTabPIValueAnimator.addUpdateListener(new AnimatorUpdateListener(this) {
        final /* synthetic */ MyDownloadActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void onAnimationUpdate(ValueAnimator animation) {
            int value = ((Integer) animation.getAnimatedValue()).intValue();
            LayoutParams layoutParams = this.this$0.mIndicator.getLayoutParams();
            layoutParams.height = value;
            this.this$0.mIndicator.setLayoutParams(layoutParams);
        }
    });
    this.mTabPIValueAnimator.start();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:MyDownloadActivity.java

示例11: smoothScrollTo

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
    ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
    ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);

    yTranslate.addUpdateListener(new AnimatorUpdateListener()
    {
        @Override
        public void onAnimationUpdate(ValueAnimator animation)
        {
            if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
        }
    });

    AnimatorSet animators = new AnimatorSet();
    animators.setDuration(240L);
    animators.playTogether(xTranslate, yTranslate);
    if (listener != null) animators.addListener(listener);
    animators.start();
}
 
開發者ID:kfrozen,項目名稱:HeaderCollapsibleLayout,代碼行數:21,代碼來源:HeaderCollapsibleLayout.java

示例12: startCheckedAnim

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void startCheckedAnim() {
    ValueAnimator animator = new ValueAnimator();
    final float hookMaxValue = (this.mHookSize + this.mEndLeftHookOffset) - this
            .mBaseLeftHookOffset;
    final float circleMaxFraction = this.mHookSize / hookMaxValue;
    final float circleMaxValue = 360.0f / circleMaxFraction;
    animator.setFloatValues(new float[]{0.0f, 1.0f});
    animator.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            float fraction = animation.getAnimatedFraction();
            AnimCheckBox.this.mHookOffset = hookMaxValue * fraction;
            if (fraction <= circleMaxFraction) {
                AnimCheckBox.this.mSweepAngle = (float) ((int) ((circleMaxFraction -
                        fraction) * circleMaxValue));
            } else {
                AnimCheckBox.this.mSweepAngle = 0.0f;
            }
            AnimCheckBox.this.mInnerCircleAlpha = (int) (255.0f * fraction);
            AnimCheckBox.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(500).start();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:25,代碼來源:AnimCheckBox.java

示例13: startUnCheckedAnim

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
private void startUnCheckedAnim() {
    ValueAnimator animator = new ValueAnimator();
    final float hookMaxValue = (this.mHookSize + this.mEndLeftHookOffset) - this
            .mBaseLeftHookOffset;
    final float circleMinFraction = (this.mEndLeftHookOffset - this.mBaseLeftHookOffset) /
            hookMaxValue;
    final float circleMaxValue = 360.0f / (1.0f - circleMinFraction);
    animator.setFloatValues(new float[]{0.0f, 1.0f});
    animator.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            float circleFraction = animation.getAnimatedFraction();
            float fraction = 1.0f - circleFraction;
            AnimCheckBox.this.mHookOffset = hookMaxValue * fraction;
            if (circleFraction >= circleMinFraction) {
                AnimCheckBox.this.mSweepAngle = (float) ((int) ((circleFraction -
                        circleMinFraction) * circleMaxValue));
            } else {
                AnimCheckBox.this.mSweepAngle = 0.0f;
            }
            AnimCheckBox.this.mInnerCircleAlpha = (int) (255.0f * fraction);
            AnimCheckBox.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(500).start();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:27,代碼來源:AnimCheckBox.java

示例14: animateFilterTo

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
    float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
    mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);

    if (mFilterAnimator != null) {
        mFilterAnimator.cancel();
    }
    mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
            oldFilter, targetFilter);
    mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
    mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
            invalidate();
        }
    });
    mFilterAnimator.start();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:22,代碼來源:DragView.java

示例15: prepareStateChange

import android.animation.ValueAnimator.AnimatorUpdateListener; //導入依賴的package包/類
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
    int finalAlpha = getAlphaForState(toState);
    if (targetAnim == null) {
        mBgPaint.setAlpha(finalAlpha);
        invalidate();
    } else {
        ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
        anim.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                invalidate();
            }
        });
        targetAnim.play(anim);
    }
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:18,代碼來源:QsbBlockerView.java


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