MCPcopy Create free account
hub / github.com/wyouflf/xUtils3 / prepare

Method prepare

xutils/src/main/java/org/xutils/image/ImageLoader.java:371–398  ·  view source on GitHub ↗
(File rawData)

Source from the content-addressed store, hash-verified

369 }
370
371 @Override
372 public Drawable prepare(File rawData) throws Throwable {
373 if (!validView4Callback(true)) return null;
374
375 if (!rawData.exists()) {
376 throw new FileNotFoundException(rawData.getAbsolutePath());
377 }
378
379 try {
380 Drawable result = null;
381 if (prepareCallback != null) {
382 result = prepareCallback.prepare(rawData);
383 }
384 if (result == null) {
385 result = ImageDecoder.decodeFileWithLock(rawData, options, this);
386 }
387 if (result != null) {
388 if (result instanceof ReusableDrawable) {
389 ((ReusableDrawable) result).setMemCacheKey(key);
390 MEM_CACHE.put(key, result);
391 }
392 }
393 return result;
394 } catch (IOException ex) {
395 IOUtil.deleteFileOrDir(rawData);
396 throw ex;
397 }
398 }
399
400 private boolean hasCache = false;
401

Callers

nothing calls this directly

Calls 6

validView4CallbackMethod · 0.95
decodeFileWithLockMethod · 0.95
deleteFileOrDirMethod · 0.95
prepareMethod · 0.65
setMemCacheKeyMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected