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


Java LogTime.getLogTime方法代码示例

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


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

示例1: loadData

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
@Override
public void loadData(Priority priority, DataCallback<? super InputStream> callback) {
  long startTime = LogTime.getLogTime();
  final InputStream result;
  try {
    result = loadDataWithRedirects(glideUrl.toURL(), 0 /*redirects*/, null /*lastUrl*/,
        glideUrl.getHeaders());
  } catch (IOException e) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
      Log.d(TAG, "Failed to load data for url", e);
    }
    callback.onLoadFailed(e);
    return;
  }

  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    Log.v(TAG, "Finished http url fetcher fetch in " + LogTime.getElapsedMillis(startTime)
        + " ms and loaded " + result);
  }
  callback.onDataReady(result);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:HttpUrlFetcher.java

示例2: runGenerators

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
private void runGenerators() {
  currentThread = Thread.currentThread();
  startFetchTime = LogTime.getLogTime();
  boolean isStarted = false;
  while (!isCancelled && currentGenerator != null
      && !(isStarted = currentGenerator.startNext())) {
    stage = getNextStage(stage);
    currentGenerator = getNextGenerator();

    if (stage == Stage.SOURCE) {
      reschedule();
      return;
    }
  }
  // We've run out of stages and generators, give up.
  if ((stage == Stage.FINISHED || isCancelled) && !isStarted) {
    notifyFailed();
  }

  // Otherwise a generator started a new load and we expect to be called back in
  // onDataFetcherReady.
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:DecodeJob.java

示例3: decodeFromData

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
private <Data> Resource<R> decodeFromData(DataFetcher<?> fetcher, Data data,
    DataSource dataSource) throws GlideException {
  try {
    if (data == null) {
      return null;
    }
    long startTime = LogTime.getLogTime();
    Resource<R> result = decodeFromFetcher(data, dataSource);
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
      logWithTimeAndKey("Decoded result " + result, startTime);
    }
    return result;
  } finally {
    fetcher.cleanup();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:DecodeJob.java

示例4: cacheData

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
private void cacheData(Object dataToCache) {
  long startTime = LogTime.getLogTime();
  try {
    Encoder<Object> encoder = helper.getSourceEncoder(dataToCache);
    DataCacheWriter<Object> writer =
        new DataCacheWriter<>(encoder, dataToCache, helper.getOptions());
    originalKey = new DataCacheKey(loadData.sourceKey, helper.getSignature());
    helper.getDiskCache().put(originalKey, writer);
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
      Log.v(TAG, "Finished encoding source to cache"
          + ", key: " + originalKey
          + ", data: " + dataToCache
          + ", encoder: " + encoder
          + ", duration: " + LogTime.getElapsedMillis(startTime));
    }
  } finally {
    loadData.fetcher.cleanup();
  }

  sourceCacheGenerator =
      new DataCacheGenerator(Collections.singletonList(loadData.sourceKey), helper, this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:SourceGenerator.java

示例5: begin

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
@Override
public void begin() {
  stateVerifier.throwIfRecycled();
  startTime = LogTime.getLogTime();
  if (model == null) {
    if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
      width = overrideWidth;
      height = overrideHeight;
    }
    // Only log at more verbose log levels if the user has set a fallback drawable, because
    // fallback Drawables indicate the user expects null models occasionally.
    int logLevel = getFallbackDrawable() == null ? Log.WARN : Log.DEBUG;
    onLoadFailed(new GlideException("Received null model"), logLevel);
    return;
  }

  status = Status.WAITING_FOR_SIZE;
  if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
    onSizeReady(overrideWidth, overrideHeight);
  } else {
    target.getSize(this);
  }

  if ((status == Status.RUNNING || status == Status.WAITING_FOR_SIZE)
      && canNotifyStatusChanged()) {
    target.onLoadStarted(getPlaceholderDrawable());
  }
  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    logV("finished run method in " + LogTime.getElapsedMillis(startTime));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:SingleRequest.java

示例6: decode

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
private GifDrawableResource decode(ByteBuffer byteBuffer, int width, int height,
    GifHeaderParser parser) {
  long startTime = LogTime.getLogTime();
  final GifHeader header = parser.parseHeader();
  if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
    // If we couldn't decode the GIF, we will end up with a frame count of 0.
    return null;
  }


  int sampleSize = getSampleSize(header, width, height);
  GifDecoder gifDecoder = gifDecoderFactory.build(provider, header, byteBuffer, sampleSize);
  gifDecoder.advance();
  Bitmap firstFrame = gifDecoder.getNextFrame();
  if (firstFrame == null) {
    return null;
  }

  Transformation<Bitmap> unitTransformation = UnitTransformation.get();

  GifDrawable gifDrawable =
      new GifDrawable(context, gifDecoder, bitmapPool, unitTransformation, width, height,
          firstFrame);

  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    Log.v(TAG, "Decoded GIF from stream in " + LogTime.getElapsedMillis(startTime));
  }

  return new GifDrawableResource(gifDrawable);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:ByteBufferGifDecoder.java

示例7: decode

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
private GifDrawableResource decode(
    ByteBuffer byteBuffer, int width, int height, GifHeaderParser parser, Options options) {
  long startTime = LogTime.getLogTime();
  final GifHeader header = parser.parseHeader();
  if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
    // If we couldn't decode the GIF, we will end up with a frame count of 0.
    return null;
  }

  Bitmap.Config config = options.get(GifOptions.DECODE_FORMAT) == DecodeFormat.PREFER_RGB_565
      ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888;

  int sampleSize = getSampleSize(header, width, height);
  GifDecoder gifDecoder = gifDecoderFactory.build(provider, header, byteBuffer, sampleSize);
  gifDecoder.setDefaultBitmapConfig(config);
  gifDecoder.advance();
  Bitmap firstFrame = gifDecoder.getNextFrame();
  if (firstFrame == null) {
    return null;
  }

  Transformation<Bitmap> unitTransformation = UnitTransformation.get();

  GifDrawable gifDrawable =
      new GifDrawable(context, gifDecoder, unitTransformation, width, height, firstFrame);

  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    Log.v(TAG, "Decoded GIF from stream in " + LogTime.getElapsedMillis(startTime));
  }

  return new GifDrawableResource(gifDrawable);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:ByteBufferGifDecoder.java

示例8: begin

import com.bumptech.glide.util.LogTime; //导入方法依赖的package包/类
@Override
public void begin() {
  assertNotCallingCallbacks();
  stateVerifier.throwIfRecycled();
  startTime = LogTime.getLogTime();
  if (model == null) {
    if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
      width = overrideWidth;
      height = overrideHeight;
    }
    // Only log at more verbose log levels if the user has set a fallback drawable, because
    // fallback Drawables indicate the user expects null models occasionally.
    int logLevel = getFallbackDrawable() == null ? Log.WARN : Log.DEBUG;
    onLoadFailed(new GlideException("Received null model"), logLevel);
    return;
  }

  if (status == Status.RUNNING) {
    throw new IllegalArgumentException("Cannot restart a running request");
  }

  // If we're restarted after we're complete (usually via something like a notifyDataSetChanged
  // that starts an identical request into the same Target or View), we can simply use the
  // resource and size we retrieved the last time around and skip obtaining a new size, starting a
  // new load etc. This does mean that users who want to restart a load because they expect that
  // the view size has changed will need to explicitly clear the View or Target before starting
  // the new load.
  if (status == Status.COMPLETE) {
    onResourceReady(resource, DataSource.MEMORY_CACHE);
    return;
  }

  // Restarts for requests that are neither complete nor running can be treated as new requests
  // and can run again from the beginning.

  status = Status.WAITING_FOR_SIZE;
  if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
    onSizeReady(overrideWidth, overrideHeight);
  } else {
    target.getSize(this);
  }

  if ((status == Status.RUNNING || status == Status.WAITING_FOR_SIZE)
      && canNotifyStatusChanged()) {
    target.onLoadStarted(getPlaceholderDrawable());
  }
  if (IS_VERBOSE_LOGGABLE) {
    logV("finished run method in " + LogTime.getElapsedMillis(startTime));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:SingleRequest.java


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