本文整理了Java中android.os.Handler.postAtTime()
方法的一些代码示例,展示了Handler.postAtTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler.postAtTime()
方法的具体详情如下:
包路径:android.os.Handler
类名称:Handler
方法名:postAtTime
暂无
代码示例来源:origin: yanzhenjie/NoHttp
public boolean postAtTime(Runnable r, long uptimeMillis) {
return mHandler.postAtTime(r, uptimeMillis);
}
代码示例来源:origin: yanzhenjie/NoHttp
public boolean postAtTime(Runnable r, Object token, long uptimeMillis) {
return mHandler.postAtTime(r, token, uptimeMillis);
}
代码示例来源:origin: rockerhieu/emojicon
@Override
public void run() {
if (downView == null) {
return;
}
handler.removeCallbacksAndMessages(downView);
handler.postAtTime(this, downView, SystemClock.uptimeMillis() + normalInterval);
clickListener.onClick(downView);
}
};
代码示例来源:origin: redsolution/xabber-android
@Override
public void run() {
if (downView == null) {
return;
}
handler.removeCallbacksAndMessages(downView);
handler.postAtTime(this, downView, SystemClock.uptimeMillis() + normalInterval);
clickListener.onClick(downView);
}
};
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void postFrameCallbackDelayed(final FrameCallback callback, long delayMillis) {
handler.postAtTime(new Runnable() {
@Override public void run() {
callback.doFrame(getFrameTimeNanos());
}
}, callback, SystemClock.uptimeMillis() + delayMillis);
}
代码示例来源:origin: androidannotations/androidannotations
/**
* Store a new task in the map for providing cancellation. This method is used
* by AndroidAnnotations and not intended to be called by clients.
*
* @param id
* the identifier of the task
* @param task
* the task itself
* @param delay
* the delay or zero to run immediately
*/
public static void runTask(String id, Runnable task, long delay) {
if ("".equals(id)) {
HANDLER.postDelayed(task, delay);
return;
}
long time = SystemClock.uptimeMillis() + delay;
HANDLER.postAtTime(task, nextToken(id), time);
}
代码示例来源:origin: seven332/EhViewer
@Override
public void run() {
onTimeChanged();
long now = SystemClock.uptimeMillis();
long next = now + (1000 - now % 1000);
getHandler().postAtTime(mTicker, next);
}
};
代码示例来源:origin: rey5137/material
@Override
public void run() {
long curTime = SystemClock.uptimeMillis();
float progress = Math.min(1f, (float)(curTime - mStartTime) / mAnimDuration);
float value = mInterpolator.getInterpolation(progress);
mIcon.setAlpha(Math.round(255 * value));
mPrevIcon.setAlpha(Math.round(255 * (1f - value)));
if(progress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
private void update(){
long curTime = SystemClock.uptimeMillis();
float progress = Math.min(1f, (float)(curTime - mStartTime) / mAnimDuration);
float value = mInterpolator.getInterpolation(progress);
mThumbPosition = mChecked ? (mStartPosition * (1 - value) + value) : (mStartPosition * (1 - value));
if(progress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
private void update(){
long curTime = SystemClock.uptimeMillis();
mAnimProgress = Math.min(1f, (float)(curTime - mStartTime) / mAnimDuration);
if(mAnimProgress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
private void update(){
long curTime = SystemClock.uptimeMillis();
mAnimProgress = Math.min(1f, (float)(curTime - mStartTime) / mAnimDuration);
if(mAnimProgress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
@Override
public void run() {
long curTime = SystemClock.uptimeMillis();
float progress = Math.min(1f, (float)(curTime - mStartTime) / mTransformAnimationDuration);
float value = mInterpolator.getInterpolation(progress);
mThumbFillPercent = mAlwaysFillThumb ? 1 : ((mFillPercent - mStartFillPercent) * value + mStartFillPercent);
if(progress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
@Override
public void run() {
long curTime = SystemClock.uptimeMillis();
float progress = Math.min(1f, (float)(curTime - mStartTime) / mTransformAnimationDuration);
float value = mInterpolator.getInterpolation(progress);
mThumbCurrentRadius = (mRadius - mStartRadius) * value + mStartRadius;
if(progress == 1f)
stopAnimation();
if(mRunning) {
if(getHandler() != null)
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
else
stopAnimation();
}
invalidate();
}
代码示例来源:origin: rey5137/material
private void startAnimation() {
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
}
invalidate();
}
代码示例来源:origin: rey5137/material
private void startAnimation() {
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
}
else
mThumbPosition = mChecked ? 1f : 0f;
invalidate();
}
代码示例来源:origin: rey5137/material
private void startAnimation() {
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
}
invalidate();
}
代码示例来源:origin: rey5137/material
public boolean startAnimation(int fillPercent) {
if(mThumbFillPercent == fillPercent)
return false;
mFillPercent = fillPercent;
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
invalidate();
return true;
}
else {
mThumbFillPercent = mAlwaysFillThumb ? 1 : mFillPercent;
invalidate();
return false;
}
}
代码示例来源:origin: rey5137/material
public boolean startAnimation(float position) {
if(mThumbPosition == position)
return false;
mPosition = position;
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
invalidate();
return true;
}
else {
mThumbPosition = position;
invalidate();
return false;
}
}
代码示例来源:origin: rey5137/material
public boolean startAnimation(int radius) {
if(mThumbCurrentRadius == radius)
return false;
mRadius = radius;
if(getHandler() != null){
resetAnimation();
mRunning = true;
getHandler().postAtTime(this, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION);
invalidate();
return true;
}
else {
mThumbCurrentRadius = mRadius;
invalidate();
return false;
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldRemoveTaggedCallback() throws Exception {
ShadowLooper.pauseMainLooper();
Handler handler = new Handler();
final int[] count = new int[1];
Runnable r = new Runnable() {
@Override
public void run() {
count[0]++;
}
};
String tag1 = "tag1", tag2 = "tag2";
handler.postAtTime(r, tag1, 100);
handler.postAtTime(r, tag2, 105);
handler.removeCallbacks(r, tag2);
ShadowLooper.unPauseMainLooper();
assertThat(count[0]).named("run count").isEqualTo(1);
// This assertion proves that it was the first runnable that ran,
// which proves that the correctly tagged runnable was removed.
assertThat(shadowOf(handler.getLooper()).getScheduler().getCurrentTime()).named("currentTime").isEqualTo(100);
}
内容来源于网络,如有侵权,请联系作者删除!