Search in sources :

Example 1 with BitmapPoolAdapter

use of com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter in project glide by bumptech.

the class FitCenterTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    bitmapWidth = 100;
    bitmapHeight = 100;
    Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
    when(resource.get()).thenReturn(bitmap);
    pool = new BitmapPoolAdapter();
    fitCenter = new FitCenter(pool);
}
Also used : Bitmap(android.graphics.Bitmap) BitmapPoolAdapter(com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter) Before(org.junit.Before)

Example 2 with BitmapPoolAdapter

use of com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter in project glide by bumptech.

the class GlideBuilder method createGlide.

Glide createGlide(Context context) {
    if (sourceExecutor == null) {
        sourceExecutor = GlideExecutor.newSourceExecutor();
    }
    if (diskCacheExecutor == null) {
        diskCacheExecutor = GlideExecutor.newDiskCacheExecutor();
    }
    if (memorySizeCalculator == null) {
        memorySizeCalculator = new MemorySizeCalculator.Builder(context).build();
    }
    if (connectivityMonitorFactory == null) {
        connectivityMonitorFactory = new DefaultConnectivityMonitorFactory();
    }
    if (bitmapPool == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            int size = memorySizeCalculator.getBitmapPoolSize();
            bitmapPool = new LruBitmapPool(size);
        } else {
            bitmapPool = new BitmapPoolAdapter();
        }
    }
    if (arrayPool == null) {
        arrayPool = new LruArrayPool(memorySizeCalculator.getArrayPoolSizeInBytes());
    }
    if (memoryCache == null) {
        memoryCache = new LruResourceCache(memorySizeCalculator.getMemoryCacheSize());
    }
    if (diskCacheFactory == null) {
        diskCacheFactory = new InternalCacheDiskCacheFactory(context);
    }
    if (engine == null) {
        engine = new Engine(memoryCache, diskCacheFactory, diskCacheExecutor, sourceExecutor, GlideExecutor.newUnlimitedSourceExecutor());
    }
    return new Glide(context, engine, memoryCache, bitmapPool, arrayPool, connectivityMonitorFactory, logLevel, defaultRequestOptions.lock());
}
Also used : LruArrayPool(com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool) DefaultConnectivityMonitorFactory(com.bumptech.glide.manager.DefaultConnectivityMonitorFactory) LruBitmapPool(com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool) LruResourceCache(com.bumptech.glide.load.engine.cache.LruResourceCache) BitmapPoolAdapter(com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter) InternalCacheDiskCacheFactory(com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory) Engine(com.bumptech.glide.load.engine.Engine)

Example 3 with BitmapPoolAdapter

use of com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter in project glide by bumptech.

the class CenterInsideTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    bitmapWidth = 100;
    bitmapHeight = 100;
    Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
    when(resource.get()).thenReturn(bitmap);
    pool = new BitmapPoolAdapter();
    centerInside = new CenterInside(pool);
}
Also used : Bitmap(android.graphics.Bitmap) BitmapPoolAdapter(com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter) Before(org.junit.Before)

Aggregations

BitmapPoolAdapter (com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter)3 Bitmap (android.graphics.Bitmap)2 Before (org.junit.Before)2 Engine (com.bumptech.glide.load.engine.Engine)1 LruArrayPool (com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool)1 LruBitmapPool (com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool)1 InternalCacheDiskCacheFactory (com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory)1 LruResourceCache (com.bumptech.glide.load.engine.cache.LruResourceCache)1 DefaultConnectivityMonitorFactory (com.bumptech.glide.manager.DefaultConnectivityMonitorFactory)1