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


Java SystemClock.uptimeMillis方法代码示例

本文整理汇总了Java中android.os.SystemClock.uptimeMillis方法的典型用法代码示例。如果您正苦于以下问题:Java SystemClock.uptimeMillis方法的具体用法?Java SystemClock.uptimeMillis怎么用?Java SystemClock.uptimeMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.SystemClock的用法示例。


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

示例1: doWork

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void doWork() {
    final long invalidationDelay = mGifDrawable.mNativeInfoHandle.renderFrame(mGifDrawable.mBuffer);
    if (invalidationDelay >= 0) {
        mGifDrawable.mNextFrameRenderTime = SystemClock.uptimeMillis() + invalidationDelay;
        if (mGifDrawable.isVisible()) {
            if (mGifDrawable.mIsRunning && !mGifDrawable.mIsRenderingTriggeredOnDraw) {
                mGifDrawable.mExecutor.schedule(this, invalidationDelay, TimeUnit.MILLISECONDS);
            }
        }
        if (!mGifDrawable.mListeners.isEmpty() && mGifDrawable.getCurrentFrameIndex() == mGifDrawable.mNativeInfoHandle.frameCount - 1) {
            mGifDrawable.scheduleSelf(mNotifyListenersTask, mGifDrawable.mNextFrameRenderTime);
        }
    } else {
        mGifDrawable.mNextFrameRenderTime = Long.MIN_VALUE;
        mGifDrawable.mIsRunning = false;
    }
    if (mGifDrawable.isVisible() && !mGifDrawable.mInvalidationHandler.hasMessages(0)) {
        mGifDrawable.mInvalidationHandler.sendEmptyMessageAtTime(0, 0);
    }
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:22,代码来源:RenderTask.java

示例2: onLongPress

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
        public void onLongPress(MotionEvent e) {
            if (callback != null) {
                callback.onLongClick(e.getX(), e.getY());
            }
            long downTime = SystemClock.uptimeMillis();
            long eventTime = SystemClock.uptimeMillis() + 100;
            float x = 0.0f;
            float y = 0.0f;
            int metaState = 0;
            MotionEvent event = MotionEvent.obtain(
                    downTime,
                    eventTime,
                    MotionEvent.ACTION_CANCEL,
                    x,
                    y,
                    metaState
            );
            view.dispatchTouchEvent(event);
//            onUpEvent(e);
        }
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:22,代码来源:TouchManager.java

示例3: onRestoreInstanceState

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void onRestoreInstanceState(Parcelable state) {
    if (!(state instanceof ProgressSavedState)) {
        super.onRestoreInstanceState(state);
        return;
    }

    ProgressSavedState ss = (ProgressSavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    this.mCurrentProgress = ss.mCurrentProgress;
    this.mTargetProgress = ss.mTargetProgress;
    this.mSpinSpeed = ss.mSpinSpeed;
    this.mProgressWidth = ss.mProgressWidth;
    this.mProgressColor = ss.mProgressColor;
    this.mProgressBackgroundColor = ss.mProgressBackgroundColor;
    this.mShouldProgressIndeterminate = ss.mShouldProgressIndeterminate;
    this.mShouldSetProgress = ss.mShouldSetProgress;
    this.mProgress = ss.mProgress;
    this.mAnimateProgress = ss.mAnimateProgress;
    this.mShowProgressBackground = ss.mShowProgressBackground;

    this.mLastTimeAnimated = SystemClock.uptimeMillis();
}
 
开发者ID:OlayinkaPeter,项目名称:Toodoo,代码行数:25,代码来源:FloatingActionButton.java

示例4: loadNextFrame

import android.os.SystemClock; //导入方法依赖的package包/类
private void loadNextFrame() {
  if (!isRunning || isLoadPending) {
    return;
  }
  if (startFromFirstFrame) {
    gifDecoder.resetFrameIndex();
    startFromFirstFrame = false;
  }
  isLoadPending = true;
  // Get the delay before incrementing the pointer because the delay indicates the amount of time
  // we want to spend on the current frame.
  int delay = gifDecoder.getNextDelay();
  long targetTime = SystemClock.uptimeMillis() + delay;

  gifDecoder.advance();
  next = new DelayTarget(handler, gifDecoder.getCurrentFrameIndex(), targetTime);
  requestBuilder.clone().apply(signatureOf(new FrameSignature())).load(gifDecoder).into(next);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:GifFrameLoader.java

示例5: onDrawFrame

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
    gl.glClearColor(1.f, 0.f, 0.f, 1.f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glLoadIdentity();
    gl.glTranslatef(0.f, 0.f, -50.f);

    long time = SystemClock.uptimeMillis() % 4000L;
    float angle = 0.090f * ((int) time);
    gl.glRotatef(angle, 0.f, 0.f, 1.f);

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glColor4f(1.f, 1.f, 1.f, 1.f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);

    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
 
开发者ID:PacktPublishing,项目名称:Building-Android-UIs-with-Custom-Views,代码行数:20,代码来源:GLDrawerES1.java

示例6: beginFakeDrag

import android.os.SystemClock; //导入方法依赖的package包/类
/**
 * Start a fake drag of the pager.
 *
 * @return true if the fake drag began successfully, false if it could not be started.
 */
public boolean beginFakeDrag() {
    if (mIsBeingDragged) {
        return false;
    }
    mFakeDragging = true;
    setScrollState(SCROLL_STATE_DRAGGING);
    if (isHorizontal()) {
        mInitialMotionX = mLastMotionX = 0;
    } else {
        mInitialMotionY = mLastMotionY = 0;
    }
    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    } else {
        mVelocityTracker.clear();
    }
    final long time = SystemClock.uptimeMillis();
    final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);
    mVelocityTracker.addMovement(ev);
    ev.recycle();
    mFakeDragBeginTime = time;
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:DirectionalViewpager.java

示例7: run

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void run() {
    long elapsed = SystemClock.uptimeMillis() - start;
    if (elapsed > duration) {
        isAnimationStarted = false;
        handler.removeCallbacks(runnable);
        chart.setChartRotation((int) targetRotation, false);
        animationListener.onAnimationFinished();
        return;
    }
    float scale = Math.min(interpolator.getInterpolation((float) elapsed / duration), 1);
    float rotation = startRotation + (targetRotation - startRotation) * scale;
    rotation = (rotation % 360 + 360) % 360;
    chart.setChartRotation((int) rotation, false);
    handler.postDelayed(this, 16);
}
 
开发者ID:huashengzzz,项目名称:SmartChart,代码行数:17,代码来源:PieChartRotationAnimatorV8.java

示例8: run

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void run() {

    long currentTime = SystemClock.uptimeMillis();
    long diff = currentTime - mStartTime;
    if (diff < mDuration) {
        float interpolation = mInterpolator.getInterpolation((float) diff / (float) mDuration);
        scheduleSelf(mUpdater, currentTime + FRAME_DURATION);
        updateAnimation(interpolation);
    } else {
        unscheduleSelf(mUpdater);
        mRunning = false;
        updateAnimation(1f);
        notifyFinishedToListener();
    }
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:17,代码来源:MarkerDrawable.java

示例9: waitForIdle

import android.os.SystemClock; //导入方法依赖的package包/类
private void waitForIdle() {
    // Wait until the either we're stopped or the other threads are done.
    // This way we don't start loading all apps until the workspace has settled
    // down.
    synchronized (LoaderTask.this) {
        final long workspaceWaitTime = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;

        mHandler.postIdle(new Runnable() {
                public void run() {
                    synchronized (LoaderTask.this) {
                        mLoadAndBindStepFinished = true;
                        if (DEBUG_LOADERS) {
                            Log.d(TAG, "done with previous binding step");
                        }
                        LoaderTask.this.notify();
                    }
                }
            });

        while (!mStopped && !mLoadAndBindStepFinished) {
            try {
                // Just in case mFlushingWorkerThread changes but we aren't woken up,
                // wait no longer than 1sec at a time
                this.wait(1000);
            } catch (InterruptedException ex) {
                // Ignore
            }
        }
        if (DEBUG_LOADERS) {
            Log.d(TAG, "waited "
                    + (SystemClock.uptimeMillis()-workspaceWaitTime)
                    + "ms for previous step to finish binding");
        }
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:36,代码来源:LauncherModel.java

示例10: run

import android.os.SystemClock; //导入方法依赖的package包/类
@Override
public void run() {

    long currentTime = SystemClock.uptimeMillis();
    long diff = currentTime - mStartTime;
    if (diff < mDuration) {
        float interpolation = mInterpolator.getInterpolation((float) diff / (float) mDuration);
        scheduleSelf(mUpdater, currentTime + FRAME_DURATION);
        updateAnimation(interpolation);
    } else {
        unscheduleSelf(mUpdater);
        mRunning = false;
        updateAnimation(1f);
    }
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:16,代码来源:AlmostRippleDrawable.java

示例11: flingWheel

import android.os.SystemClock; //导入方法依赖的package包/类
private void flingWheel() {
    mIsDraggingWheel = false;

    mVelocityTracker.computeCurrentVelocity(1);

    //torque = r X F
    mForceVector.set(mVelocityTracker.getXVelocity(), mVelocityTracker.getYVelocity());
    setRadiusVector(mLastWheelTouchX, mLastWheelTouchY);
    float torque = mForceVector.crossProduct(mRadiusVector);

    //dw/dt = torque / I = torque / mr^2
    float wheelRadiusSquared = mWheelBounds.getRadius() * mWheelBounds.getRadius();
    float angularAccel = torque / wheelRadiusSquared;

    //estimate an angular velocity based on the strength of the angular acceleration
    float angularVel = angularAccel * ANGULAR_VEL_COEFFICIENT;

    //clamp the angular velocity
    if (angularVel > MAX_ANGULAR_VEL) angularVel = MAX_ANGULAR_VEL;
    else if (angularVel < -MAX_ANGULAR_VEL) angularVel = -MAX_ANGULAR_VEL;
    mAngularVelocity = angularVel;

    mLastUpdateTime = SystemClock.uptimeMillis();
    mRequiresUpdate = true;

    invalidate();
}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:28,代码来源:WheelView.java

示例12: dispatchOnCancelled

import android.os.SystemClock; //导入方法依赖的package包/类
void dispatchOnCancelled(LoadTask task, D data) {
    onCanceled(data);
    if (this.mCancellingTask == task) {
        rollbackContentChanged();
        this.mLastLoadCompleteTime = SystemClock.uptimeMillis();
        this.mCancellingTask = null;
        executePendingTask();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:AsyncTaskLoader.java

示例13: onVisibilityChanged

import android.os.SystemClock; //导入方法依赖的package包/类
@Override protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
  super.onVisibilityChanged(changedView, visibility);

  if (visibility == VISIBLE) {
    lastTimeAnimated = SystemClock.uptimeMillis();
  }
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:8,代码来源:ProgressWheel.java

示例14: onVisibilityChanged

import android.os.SystemClock; //导入方法依赖的package包/类
@Override protected void onVisibilityChanged(View changedView, int visibility) {
  super.onVisibilityChanged(changedView, visibility);

  if (visibility == VISIBLE) {
    lastTimeAnimated = SystemClock.uptimeMillis();
  }
}
 
开发者ID:superdevzhao,项目名称:materialprogress,代码行数:8,代码来源:ProgressWheel.java

示例15: setProgress

import android.os.SystemClock; //导入方法依赖的package包/类
public synchronized void setProgress(int progress, boolean animate) {
    if (mProgressIndeterminate) return;

    mProgress = progress;
    mAnimateProgress = animate;

    if (!mButtonPositionSaved) {
        mShouldSetProgress = true;
        return;
    }

    mProgressBarEnabled = true;
    mShouldUpdateButtonPosition = true;
    setupProgressBounds();
    saveButtonOriginalPosition();
    updateBackground();

    if (progress < 0) {
        progress = 0;
    } else if (progress > mProgressMax) {
        progress = mProgressMax;
    }

    if (progress == mTargetProgress) {
        return;
    }

    mTargetProgress = mProgressMax > 0 ? (progress / (float) mProgressMax) * 360 : 0;
    mLastTimeAnimated = SystemClock.uptimeMillis();

    if (!animate) {
        mCurrentProgress = mTargetProgress;
    }

    invalidate();
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:37,代码来源:FloatingActionButton.java


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