Java Code Examples for android.animation.ValueAnimator#isRunning()

The following examples show how to use android.animation.ValueAnimator#isRunning() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MovieTimer.java    From PhotoMovie with Apache License 2.0 6 votes vote down vote up
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    if (mPaused || !animation.isRunning()) {
        return;
    }

    long curTime = animation.getCurrentPlayTime();

    if (curTime >= mPhotoMovie.getDuration()) {
        mAnimator.removeUpdateListener(this);
        mAnimator.removeListener(this);
        mAnimator.end();
        if (mMovieListener != null) {
            mMovieListener.onMovieEnd();
        }
        mAnimator.addUpdateListener(this);
        mAnimator.addListener(this);
        if(mLoop){
            mAnimator.start();
        }
    }else{
        if (mMovieListener != null) {
            mMovieListener.onMovieUpdate((int) curTime);
        }
    }
}
 
Example 2
Source File: Indicator.java    From XKnife-Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isRunning() {
    for (ValueAnimator animator : mAnimators) {
        return animator.isRunning();
    }
    return false;
}
 
Example 3
Source File: Indicator.java    From LRecyclerView with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isRunning() {
    for (ValueAnimator animator : mAnimators) {
        return animator.isRunning();
    }
    return false;
}
 
Example 4
Source File: AnimationUtils.java    From RxTools-master with Apache License 2.0 4 votes vote down vote up
public static boolean isRunning(ValueAnimator animator) {
    return animator != null && animator.isRunning();
}
 
Example 5
Source File: NumberView.java    From NumberAnimation with MIT License 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    // super.onDraw(canvas);
    // allocations per draw cycle.
    int paddingLeft = getPaddingLeft();
    int paddingTop = getPaddingTop();
    int paddingRight = getPaddingRight();
    int paddingBottom = getPaddingBottom();

    int contentWidth = getWidth() - paddingLeft - paddingRight;
    int contentHeight = getHeight() - paddingTop - paddingBottom;

    Log.e(".......", "paddingTop = " + paddingTop
            + ",paddingBottom = " + paddingBottom
            + ",contentHeight = " + contentHeight
            + ",mTextSize = " + mTextSize
            + ",mTextHeight = " + mTextHeight
            + ",getHeight() = " + getHeight());
    float startX = paddingLeft + (contentWidth - mTextWidth) / 2;
    startX -= mExtraSpace * (startNumber.size() - 1) / 2;
    float startY = paddingTop + (contentHeight + mTextHeight) / 2;

    // progress : 0f ~ 1f
    // dy : 0 ~ (mTextHeight * mNumberString.length()-1)

    for (int i = 0; i < startNumber.size(); i++) {
        float progress = 1;
        if (i < animatorList.size()) {
            progress = (float) animatorList.get(i).getAnimatedValue();
        }
        int dy = (int) ((mTextSize * 5) * progress);
        startY = mTextSize - mTextHeight / 2 - dy;
        Integer num = startNumber.get(i);
        for (int j = 0; j < 6; j++) {
            String c = "" + calcNum(num, -j);
            canvas.drawText(c,
                    startX,
                    startY,
                    mTextPaint);
            startY += mTextSize;

        }
        startX += mCharWidth + mExtraSpace;
    }

    boolean end = true;
    for (ValueAnimator valueAnimator : animatorList) {
        if (valueAnimator.isRunning()) {
            end = false;
        }
    }
    if (!end) {
        invalidate();
    }
}