Search in sources :

Example 6 with Options

use of com.bumptech.glide.load.Options in project glide by bumptech.

the class HttpGlideUrlLoaderTest method testReturnsValidFetcher.

@Test
public void testReturnsValidFetcher() {
    DataFetcher<InputStream> result = Preconditions.checkNotNull(loader.buildLoadData(model, 100, 100, new Options())).fetcher;
    assertThat(result).isInstanceOf(HttpUrlFetcher.class);
}
Also used : Options(com.bumptech.glide.load.Options) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 7 with Options

use of com.bumptech.glide.load.Options in project glide by bumptech.

the class ByteArrayLoaderTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    loader = new ByteArrayLoader<>(converter);
    options = new Options();
}
Also used : Options(com.bumptech.glide.load.Options) Before(org.junit.Before)

Example 8 with Options

use of com.bumptech.glide.load.Options in project glide by bumptech.

the class ResourceLoaderTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    options = new Options();
    loader = new ResourceLoader<>(RuntimeEnvironment.application.getResources(), uriLoader);
}
Also used : Options(com.bumptech.glide.load.Options) Before(org.junit.Before)

Example 9 with Options

use of com.bumptech.glide.load.Options in project glide by bumptech.

the class EngineKeyTest method updateDiskCacheKey_throwsException.

@Test
public void updateDiskCacheKey_throwsException() throws NoSuchAlgorithmException {
    // If this test fails, update testEqualsAndHashcode to use KeyTester including regression tests.
    EngineKey key = new EngineKey("id", new ObjectKey("signature"), 100, 100, Collections.<Class<?>, Transformation<?>>emptyMap(), Object.class, Object.class, new Options());
    expectedException.expect(UnsupportedOperationException.class);
    key.updateDiskCacheKey(MessageDigest.getInstance("SHA-1"));
}
Also used : Options(com.bumptech.glide.load.Options) ObjectKey(com.bumptech.glide.signature.ObjectKey) Test(org.junit.Test)

Example 10 with Options

use of com.bumptech.glide.load.Options in project glide by bumptech.

the class DecodeJob method getOptionsWithHardwareConfig.

@NonNull
private Options getOptionsWithHardwareConfig(DataSource dataSource) {
    Options options = this.options;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
        return options;
    }
    if (options.get(Downsampler.ALLOW_HARDWARE_CONFIG) != null) {
        return options;
    }
    if (dataSource == DataSource.RESOURCE_DISK_CACHE || decodeHelper.isScaleOnlyOrNoTransform()) {
        options = new Options();
        options.putAll(this.options);
        options.set(Downsampler.ALLOW_HARDWARE_CONFIG, true);
    }
    return options;
}
Also used : Options(com.bumptech.glide.load.Options) NonNull(android.support.annotation.NonNull)

Aggregations

Options (com.bumptech.glide.load.Options)33 Before (org.junit.Before)14 Test (org.junit.Test)10 Bitmap (android.graphics.Bitmap)4 Uri (android.net.Uri)3 NonNull (android.support.annotation.NonNull)3 ImageHeaderParser (com.bumptech.glide.load.ImageHeaderParser)3 ObjectKey (com.bumptech.glide.signature.ObjectKey)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 CheckResult (android.support.annotation.CheckResult)2 CacheKeyUpdater (com.bumptech.glide.load.Option.CacheKeyUpdater)2 LruArrayPool (com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool)2 DefaultImageHeaderParser (com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser)2 ByteBuffer (java.nio.ByteBuffer)2 MessageDigest (java.security.MessageDigest)2 Application (android.app.Application)1 AssetManager (android.content.res.AssetManager)1 BitmapFactory (android.graphics.BitmapFactory)1