当前位置: 首页>>代码示例>>Java>>正文


Java TimeAnimator类代码示例

本文整理汇总了Java中android.animation.TimeAnimator的典型用法代码示例。如果您正苦于以下问题:Java TimeAnimator类的具体用法?Java TimeAnimator怎么用?Java TimeAnimator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TimeAnimator类属于android.animation包,在下文中一共展示了TimeAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
public void onTimeUpdate(TimeAnimator timeAnimator, long totalTime, long deltaTime) {
    if (!this.mStarted.booleanValue()) {
        this.mStarted = Boolean.valueOf(true);
        if (this.mAnimationListener != null) {
            this.mAnimationListener.onAnimationStart(null);
        }
    }
    if (timeAnimator.isRunning()) {
        if (isReallyClose().booleanValue()) {
            stepFast();
        } else {
            step();
        }
        if (isFinished().booleanValue() && this.mAnimationListener != null) {
            this.mAnimationListener.onAnimationEnd(null);
        }
    }
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:19,代码来源:SpringTranslateTimeListener.java

示例2: init

import android.animation.TimeAnimator; //导入依赖的package包/类
void init() {
    this.handler = new Handler(Looper.getMainLooper());
    this.mAnimationCallback = new TimeListener() {
        public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
            PanelView.this.animationTick(deltaTime);
        }
    };
    this.mStopAnimator = new Runnable() {
        public void run() {
            if (PanelView.this.mTimeAnimator != null && PanelView.this.mTimeAnimator.isStarted()) {
                PanelView.this.LOG("Stop Animator : stopping", new Object[0]);
                PanelView.this.mTimeAnimator.end();
                PanelView.this.mRubberbanding = false;
                PanelView.this.mClosing = false;
            }
        }
    };
    this.mTimeAnimator = new TimeAnimator();
    this.mTimeAnimator.setTimeListener(this.mAnimationCallback);
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:21,代码来源:PanelView.java

示例3: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTimeMs, long deltaTimeMs) {
    // Cap progress bar animation frame time so that it doesn't jump too much even when
    // the animation is janky.
    float progress = mAnimationLogic.updateProgress(mTargetProgress,
            Math.min(deltaTimeMs, PROGRESS_FRAME_TIME_CAP_MS) * 0.001f, getWidth());
    progress = Math.max(progress, 0);
    ToolbarProgressBar.super.setProgress(progress);

    if (mAnimatingView != null) {
        int width = Math.abs(
                getDrawable().getBounds().right - getDrawable().getBounds().left);
        mAnimatingView.update(progress * width);
    }

    if (getProgress() == mTargetProgress) {
        if (!mIsStarted) postOnAnimationDelayed(mHideRunnable, mHidingDelayMs);
        mProgressAnimator.end();
        return;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:ToolbarProgressBar.java

示例4: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTimeMs, long deltaTimeMs) {
    // Cap progress bar animation frame time so that it doesn't jump too much even when
    // the animation is janky.
    ToolbarProgressBar.super.setProgress(mAnimationLogic.updateProgress(
            mTargetProgress,
            Math.max(deltaTimeMs, PROGRESS_FRAME_TIME_CAP_MS) * 0.001f,
            getWidth()));

    if (getProgress() == mTargetProgress) {
        if (mTargetProgress == 1.0f && !mIsStarted) {
            postOnAnimationDelayed(mHideRunnable, mHidingDelayMs);
        }
        mProgressAnimator.end();
        return;
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:18,代码来源:ToolbarProgressBar.java

示例5: createJBRunnable

import android.animation.TimeAnimator; //导入依赖的package包/类
private Runnable createJBRunnable() {
    // On JB, we rely on TimeAnimator to send events tied with vsync.
    return new Runnable() {
        @Override
        public void run() {
            mTimeAnimator = new TimeAnimator();
            mTimeAnimator.setTimeListener(new TimeListener() {
                @Override
                public void onTimeUpdate(TimeAnimator animation, long totalTime,
                        long deltaTime) {
                    if (!sendEvent(mDownTime + totalTime)) {
                        mTimeAnimator.end();
                    }
                }
            });
            mTimeAnimator.start();
        }
    };
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:20,代码来源:GenericTouchGesture.java

示例6: createJBRunnable

import android.animation.TimeAnimator; //导入依赖的package包/类
private Runnable createJBRunnable() {
    // On JB, we rely on TimeAnimator to send events tied with vsync.
    return new Runnable() {
        @Override
        public void run() {
            mTimeAnimator = new TimeAnimator();
            mTimeAnimator.setTimeListener(new TimeListener() {
                @Override
                public void onTimeUpdate(TimeAnimator animation, long totalTime,
                        long deltaTime) {
                    if (!sendEvent(mStartTime + totalTime)) {
                        mTimeAnimator.end();
                    }
                }
            });
            mTimeAnimator.start();
        }
    };
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:20,代码来源:GenericTouchGesture.java

示例7: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
    if (mFrameTimesCount == mFrameTimesMs.length) {
        mAnimator.end();
        cleanUp();
        Log.w(TAG, "Animation frame time recording reached the maximum number. It's either"
                + "the animation took too long or recording end is not called.");
        return;
    }

    // deltaTime is 0 for the first frame.
    if (deltaTime > 0) {
        mFrameTimesMs[mFrameTimesCount++] = deltaTime;
    }
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:16,代码来源:AnimationFrameTimeHistogram.java

示例8: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
public void onTimeUpdate(TimeAnimator timeAnimator, long totalTime, long deltaTime) {
    if (!timeAnimator.isRunning()) {
        return;
    }
    if (((float) totalTime) > this.mDuration) {
        timeAnimator.cancel();
        if (this.mAnimationListener != null) {
            this.mAnimationListener.onAnimationEnd(null);
            return;
        }
        return;
    }
    step((float) totalTime);
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:15,代码来源:LinearTranslateTimeListener.java

示例9: AppMenuDragHelper

import android.animation.TimeAnimator; //导入依赖的package包/类
AppMenuDragHelper(Activity activity, AppMenu appMenu, int itemRowHeight) {
    mActivity = activity;
    mAppMenu = appMenu;
    mItemRowHeight = itemRowHeight;
    Resources res = mActivity.getResources();
    mAutoScrollFullVelocity = res.getDimensionPixelSize(R.dimen.auto_scroll_full_velocity);
    // If user is dragging and the popup ListView is too big to display at once,
    // mDragScrolling animator scrolls mPopup.getListView() automatically depending on
    // the user's touch position.
    mDragScrolling.setTimeListener(new TimeAnimator.TimeListener() {
        @Override
        public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
            ListPopupWindow popup = mAppMenu.getPopup();
            if (popup == null || popup.getListView() == null) return;

            // We keep both mDragScrollOffset and mDragScrollOffsetRounded because
            // the actual scrolling is by the rounded value but at the same time we also
            // want to keep the precise scroll value in float.
            mDragScrollOffset += (deltaTime * 0.001f) * mDragScrollingVelocity;
            int diff = Math.round(mDragScrollOffset - mDragScrollOffsetRounded);
            mDragScrollOffsetRounded += diff;
            popup.getListView().smoothScrollBy(diff, 0);

            // Force touch move event to highlight items correctly for the scrolled position.
            if (!Float.isNaN(mLastTouchX) && !Float.isNaN(mLastTouchY)) {
                menuItemAction(Math.round(mLastTouchX), Math.round(mLastTouchY),
                        ITEM_ACTION_HIGHLIGHT);
            }
        }
    });

    // We use medium timeout, the average of tap and long press timeouts. This is consistent
    // with ListPopupWindow#ForwardingListener implementation.
    mTapTimeout =
            (ViewConfiguration.getTapTimeout() + ViewConfiguration.getLongPressTimeout()) / 2;
    mScaledTouchSlop = ViewConfiguration.get(activity).getScaledTouchSlop();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:38,代码来源:AppMenuDragHelper.java

示例10: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
/**
 * Every TimeAnimator frame, nudge each bouncing view along.
 */
public void onTimeUpdate(TimeAnimator animation, long elapsed, long dt_ms) {
    final float dt = dt_ms / 1000f; // seconds
    for (int i = 0; i < getChildCount(); i++) {
        final View view = getChildAt(i);
        final PointF v = (PointF) view.getTag();

        // step view for velocity * time
        view.setX(view.getX() + v.x * dt);
        view.setY(view.getY() + v.y * dt);

        // handle reflections
        final float l = view.getX();
        final float t = view.getY();
        final float r = l + view.getWidth();
        final float b = t + view.getHeight();
        boolean flipX = false, flipY = false;
        if (r > mWidth) {
            view.setX(view.getX() - 2 * (r - mWidth));
            flipX = true;
        } else if (l < 0) {
            view.setX(-l);
            flipX = true;
        }
        if (b > mHeight) {
            view.setY(view.getY() - 2 * (b - mHeight));
            flipY = true;
        } else if (t < 0) {
            view.setY(-t);
            flipY = true;
        }
        if (flipX) v.x *= -1;
        if (flipY) v.y *= -1;
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:38,代码来源:XDripDreamService.java

示例11: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
public void onTimeUpdate(TimeAnimator animation, long elapsed, long dt_ms) {
    final float dt = dt_ms / 1000f; // seconds
    for (int i=0; i<getChildCount(); i++) {
        final View view = getChildAt(i);
        final PointF v = (PointF) view.getTag();

        // step view for velocity * time
        view.setX(view.getX() + v.x * dt);
        view.setY(view.getY() + v.y * dt);

        // handle reflections
        final float l = view.getX();
        final float t = view.getY();
        final float r = l + view.getWidth();
        final float b = t + view.getHeight();
        boolean flipX = false, flipY = false;
        if (r > mWidth) {
            view.setX(view.getX() - 2 * (r - mWidth));
            flipX = true;
        } else if (l < 0) {
            view.setX(-l);
            flipX = true;
        }
        if (b > mHeight) {
            view.setY(view.getY() - 2 * (b - mHeight));
            flipY = true;
        } else if (t < 0) {
            view.setY(-t);
            flipY = true;
        }
        if (flipX) v.x *= -1;
        if (flipY) v.y *= -1;
    }
}
 
开发者ID:googlesamples,项目名称:androidtv-daydream,代码行数:35,代码来源:Bouncer.java

示例12: init

import android.animation.TimeAnimator; //导入依赖的package包/类
private void init(Context context) {
    animator = new TimeAnimator();
    animator.setTimeListener(this);

    paint = new Paint();
    paint.setColor(Color.WHITE);

    density = getResources().getDisplayMetrics().density;

    path = new Path();
    pathMeasure = new PathMeasure();
    position = new PointF();
    velocity = new PointF();
}
 
开发者ID:justasm,项目名称:Bugstick,代码行数:15,代码来源:BugView.java

示例13: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
@Override
public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
    float fraction;
    if (totalTime >= mDuration) {
        fraction = 1;
        mAnimator.end();
    } else {
        fraction = (float) (totalTime / (double) mDuration);
    }
    if (mInterpolator != null) {
        fraction = mInterpolator.getInterpolation(fraction);
    }
    setFocusLevel(mFocusLevelStart + fraction * mFocusLevelDelta);
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:15,代码来源:FocusHighlightHelper.java

示例14: SystemClockManager

import android.animation.TimeAnimator; //导入依赖的package包/类
public SystemClockManager(SystemClockListener listener, long resolution) {
	mListener = listener;
	mResolution = resolution;

	mAnimator = new TimeAnimator();
	mAnimator.setTimeListener(this);
}
 
开发者ID:dgmltn,项目名称:android-MorphClock,代码行数:8,代码来源:SystemClockManager.java

示例15: onTimeUpdate

import android.animation.TimeAnimator; //导入依赖的package包/类
@Override
public void onTimeUpdate(TimeAnimator timeAnimator, long l, long l2) {
	long now = l / mResolution;
	if (now != mLast) {
		mLast = now;
		mListener.onTimeChanged(System.currentTimeMillis());
	}
}
 
开发者ID:dgmltn,项目名称:android-MorphClock,代码行数:9,代码来源:SystemClockManager.java


注:本文中的android.animation.TimeAnimator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。