private long getFreeMemoryCacheBytes() { return memoryCache.getMaxSize() - memoryCache.getCurrentSize(); }
@VisibleForTesting PreFillQueue generateAllocationOrder(PreFillType... preFillSizes) { final long maxSize = memoryCache.getMaxSize() - memoryCache.getCurrentSize() + bitmapPool.getMaxSize(); int totalWeight = 0; for (PreFillType size : preFillSizes) { totalWeight += size.getWeight(); } final float bytesPerWeight = maxSize / (float) totalWeight; Map<PreFillType, Integer> attributeToCount = new HashMap<>(); for (PreFillType size : preFillSizes) { int bytesForSize = Math.round(bytesPerWeight * size.getWeight()); int bytesPerBitmap = getSizeInBytes(size); int bitmapsForSize = bytesForSize / bytesPerBitmap; attributeToCount.put(size, bitmapsForSize); } return new PreFillQueue(attributeToCount); }
private int getFreeMemoryCacheBytes() { return memoryCache.getMaxSize() - memoryCache.getCurrentSize(); }
private void refresh() { final BitmapPool pool = glide.getBitmapPool(); final String total = getSizeString(pool.getMaxSize()); final String memCacheCurrent = getSizeString(memoryCache.getCurrentSize()); final String memCacheMax = getSizeString(memoryCache.getMaxSize()); poolSizeLabel.setText(total); memCacheCurrentLabel.setText(memCacheCurrent); memCacheMaxLabel.setText(memCacheMax); }
PreFillQueue generateAllocationOrder(PreFillType[] preFillSizes) { final int maxSize = memoryCache.getMaxSize() - memoryCache.getCurrentSize() + bitmapPool.getMaxSize(); int totalWeight = 0; for (PreFillType size : preFillSizes) { totalWeight += size.getWeight(); } final float bytesPerWeight = maxSize / (float) totalWeight; Map<PreFillType, Integer> attributeToCount = new HashMap<PreFillType, Integer>(); for (PreFillType size : preFillSizes) { int bytesForSize = Math.round(bytesPerWeight * size.getWeight()); int bytesPerBitmap = getSizeInBytes(size); int bitmapsForSize = bytesForSize / bytesPerBitmap; attributeToCount.put(size, bitmapsForSize); } return new PreFillQueue(attributeToCount); }
private int getFreeMemoryCacheBytes() { return memoryCache.getMaxSize() - memoryCache.getCurrentSize(); }
PreFillQueue generateAllocationOrder(PreFillType... preFillSizes) { final int maxSize = memoryCache.getMaxSize() - memoryCache.getCurrentSize() + bitmapPool.getMaxSize(); int totalWeight = 0; for (PreFillType size : preFillSizes) { totalWeight += size.getWeight(); } final float bytesPerWeight = maxSize / (float) totalWeight; Map<PreFillType, Integer> attributeToCount = new HashMap<>(); for (PreFillType size : preFillSizes) { int bytesForSize = Math.round(bytesPerWeight * size.getWeight()); int bytesPerBitmap = getSizeInBytes(size); int bitmapsForSize = bytesForSize / bytesPerBitmap; attributeToCount.put(size, bitmapsForSize); } return new PreFillQueue(attributeToCount); }