本文整理汇总了Java中android.os.MessageQueue.IdleHandler类的典型用法代码示例。如果您正苦于以下问题:Java IdleHandler类的具体用法?Java IdleHandler怎么用?Java IdleHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdleHandler类属于android.os.MessageQueue包,在下文中一共展示了IdleHandler类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: load_afterResourceIsGcedFromActive_returnsFromMemoryCache
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
@Test
public void load_afterResourceIsGcedFromActive_returnsFromMemoryCache() {
when(harness.resource.getResource()).thenReturn(mock(Resource.class));
when(harness.resource.isCacheable()).thenReturn(true);
harness.cache = new LruResourceCache(100);
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
harness.getEngine().onEngineJobComplete(harness.cacheKey, harness.resource);
return null;
}
}).when(harness.job).start(any(DecodeJob.class));
harness.doLoad();
ArgumentCaptor<IdleHandler> captor = ArgumentCaptor.forClass(IdleHandler.class);
verify(GlideShadowLooper.queue).addIdleHandler(captor.capture());
captor.getValue().queueIdle();
harness.doLoad();
verify(harness.cb).onResourceReady(any(Resource.class), eq(DataSource.MEMORY_CACHE));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:EngineTest.java
示例2: showToast
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
private void showToast(final FutureResult<Toast> waitingForToast) {
this.mainHandler.post(new Runnable() {
public void run() {
final Toast toast = new Toast(AndroidHeapDumper.this.context);
toast.setGravity(16, 0, 0);
toast.setDuration(1);
toast.setView(LayoutInflater.from(AndroidHeapDumper.this.context).inflate(R
.layout.__leak_canary_heap_dump_toast, null));
toast.show();
Looper.myQueue().addIdleHandler(new IdleHandler() {
public boolean queueIdle() {
waitingForToast.set(toast);
return false;
}
});
}
});
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:AndroidHeapDumper.java
示例3: queueUpdatePreference
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
private void queueUpdatePreference ()
{
if (!queuedUpdate)
{
Looper.myQueue ().addIdleHandler (new IdleHandler ()
{
public boolean queueIdle ()
{
updatePreference ();
queuedUpdate = false;
/* Remove the handler */
return false;
}
});
queuedUpdate = true;
}
}
开发者ID:bpeel,项目名称:prevo,代码行数:19,代码来源:PreferenceActivity.java
示例4: executeDelayedAfterIdleUnsafe
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
private void executeDelayedAfterIdleUnsafe(final Runnable runnable) {
Looper.myQueue().addIdleHandler(new IdleHandler() {
public boolean queueIdle() {
AndroidWatchExecutor.this.backgroundHandler.postDelayed(runnable, 5000);
return false;
}
});
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:AndroidWatchExecutor.java
示例5: onLoadResult
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
public void onLoadResult(File patchDirectory, int loadCode, long cost) {
super.onLoadResult(patchDirectory, loadCode, cost);
switch (loadCode) {
case 0:
SampleTinkerReport.onLoaded(cost);
break;
}
Looper.getMainLooper();
Looper.myQueue().addIdleHandler(new IdleHandler() {
public boolean queueIdle() {
UpgradePatchRetry.getInstance(SampleLoadReporter.this.context).onPatchRetryLoad();
return false;
}
});
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:SampleLoadReporter.java
示例6: scheduleIdleTasks
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
public static void scheduleIdleTasks() {
Looper.myQueue().addIdleHandler(new IdleHandler() {
@Override
public boolean queueIdle() {
TaggedRunnable taggedRunnable = Coordinator.mIdleTasks
.poll();
if (taggedRunnable == null) {
return false;
}
Coordinator.postTask(taggedRunnable);
return !Coordinator.mIdleTasks.isEmpty();
}
});
}
开发者ID:bunnyblue,项目名称:ACDD,代码行数:16,代码来源:Coordinator.java
示例7: registerIdleTransitionCallback
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
@Override
public void registerIdleTransitionCallback(ResourceCallback resourceCallback) {
this.resourceCallback = resourceCallback;
// on main thread here.
queueInterrogator = new QueueInterrogator(monitoredLooper);
// must load idle handlers from monitored looper thread.
IdleHandler idleHandler = new ResourceCallbackIdleHandler(resourceCallback, queueInterrogator,
monitoredHandler);
checkState(monitoredHandler.postAtFrontOfQueue(new Initializer(idleHandler)),
"Monitored looper exiting.");
}
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:14,代码来源:LooperIdlingResource.java
示例8: Initializer
import android.os.MessageQueue.IdleHandler; //导入依赖的package包/类
Initializer(IdleHandler myIdleHandler) {
this.myIdleHandler = checkNotNull(myIdleHandler);
}
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:4,代码来源:LooperIdlingResource.java
注:本文中的android.os.MessageQueue.IdleHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论