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


Java ResourceCallback.onResourceReady方法代码示例

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


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

示例1: addCallback

import com.bumptech.glide.request.ResourceCallback; //导入方法依赖的package包/类
public void addCallback(ResourceCallback cb) {
  Util.assertMainThread();
  stateVerifier.throwIfRecycled();
  if (hasResource) {
    cb.onResourceReady(engineResource, dataSource);
  } else if (hasLoadFailed) {
    cb.onLoadFailed(exception);
  } else {
    cbs.add(cb);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:EngineJob.java

示例2: handleResultOnMainThread

import com.bumptech.glide.request.ResourceCallback; //导入方法依赖的package包/类
@Synthetic
void handleResultOnMainThread() {
  stateVerifier.throwIfRecycled();
  if (isCancelled) {
    resource.recycle();
    release(false /*isRemovedFromQueue*/);
    return;
  } else if (cbs.isEmpty()) {
    throw new IllegalStateException("Received a resource without any callbacks to notify");
  } else if (hasResource) {
    throw new IllegalStateException("Already have resource");
  }
  engineResource = engineResourceFactory.build(resource, isCacheable);
  hasResource = true;

  // Hold on to resource for duration of request so we don't recycle it in the middle of
  // notifying if it synchronously released by one of the callbacks.
  engineResource.acquire();
  listener.onEngineJobComplete(key, engineResource);

  for (ResourceCallback cb : cbs) {
    if (!isInIgnoredCallbacks(cb)) {
      engineResource.acquire();
      cb.onResourceReady(engineResource, dataSource);
    }
  }
  // Our request is complete, so we can release the resource.
  engineResource.release();

  release(false /*isRemovedFromQueue*/);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:EngineJob.java

示例3: addCallback

import com.bumptech.glide.request.ResourceCallback; //导入方法依赖的package包/类
void addCallback(ResourceCallback cb) {
  Util.assertMainThread();
  stateVerifier.throwIfRecycled();
  if (hasResource) {
    cb.onResourceReady(engineResource, dataSource);
  } else if (hasLoadFailed) {
    cb.onLoadFailed(exception);
  } else {
    cbs.add(cb);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:EngineJob.java

示例4: handleResultOnMainThread

import com.bumptech.glide.request.ResourceCallback; //导入方法依赖的package包/类
@Synthetic
void handleResultOnMainThread() {
  stateVerifier.throwIfRecycled();
  if (isCancelled) {
    resource.recycle();
    release(false /*isRemovedFromQueue*/);
    return;
  } else if (cbs.isEmpty()) {
    throw new IllegalStateException("Received a resource without any callbacks to notify");
  } else if (hasResource) {
    throw new IllegalStateException("Already have resource");
  }
  engineResource = engineResourceFactory.build(resource, isCacheable);
  hasResource = true;

  // Hold on to resource for duration of request so we don't recycle it in the middle of
  // notifying if it synchronously released by one of the callbacks.
  engineResource.acquire();
  listener.onEngineJobComplete(key, engineResource);

  int size = cbs.size();
  for (int i = 0; i < size; i++) {
    ResourceCallback cb = cbs.get(i);
    if (!isInIgnoredCallbacks(cb)) {
      engineResource.acquire();
      cb.onResourceReady(engineResource, dataSource);
    }
  }
  // Our request is complete, so we can release the resource.
  engineResource.release();

  release(false /*isRemovedFromQueue*/);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:EngineJob.java

示例5: load

import com.bumptech.glide.request.ResourceCallback; //导入方法依赖的package包/类
/**
 *
 * @param id A unique id for the model, dimensions, cache decoder, decoder, and encoder
 * @param cacheDecoder
 * @param fetcher
 * @param decoder
 * @param encoder
 * @param transcoder
 * @param priority
 * @param <T> The type of data the resource will be decoded from.
 * @param <Z> The type of the resource that will be decoded.
 * @param <R> The type of the resource that will be transcoded from the decoded resource.
 */
public <T, Z, R> LoadStatus load(String id, int width, int height, ResourceDecoder<InputStream, Z> cacheDecoder,
        DataFetcher<T> fetcher, ResourceDecoder<T, Z> decoder,  Transformation<Z> transformation,
        ResourceEncoder<Z> encoder, ResourceTranscoder<Z, R> transcoder, Priority priority,
        boolean isMemoryCacheable, ResourceCallback cb) {

    Key key = keyFactory.buildKey(id, width, height, cacheDecoder, decoder, transformation, encoder, transcoder);

    Resource cached = cache.get(key);
    if (cached != null) {
        cached.acquire(1);
        cb.onResourceReady(cached);
        return null;
    }

    ResourceRunner current = runners.get(key);
    if (current != null) {
        EngineJob job = current.getJob();
        job.addCallback(cb);
        return new LoadStatus(cb, job);
    }

    ResourceRunner<Z, R> runner = factory.build(key, width, height, cacheDecoder, fetcher, decoder, transformation,
            encoder, transcoder, priority, isMemoryCacheable, this);
    runner.getJob().addCallback(cb);
    runners.put(key, runner);
    runner.queue();
    return new LoadStatus(cb, runner.getJob());
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:42,代码来源:Engine.java


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