From 914060e00a9a766017560276a2dd9a42dc9b2874 Mon Sep 17 00:00:00 2001 From: Sam Judd Date: Thu, 8 Feb 2018 07:02:09 -0800 Subject: [PATCH] Make GlideBuilder.build package private. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It shouldn’t have been made visible and can’t safely be used directly outside of the library. Fixes #2885 --- .../java/com/bumptech/glide/GlideBuilder.java | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/bumptech/glide/GlideBuilder.java b/library/src/main/java/com/bumptech/glide/GlideBuilder.java index 2a336aa824..431eddae83 100644 --- a/library/src/main/java/com/bumptech/glide/GlideBuilder.java +++ b/library/src/main/java/com/bumptech/glide/GlideBuilder.java @@ -30,8 +30,6 @@ /** * A builder class for setting default structural classes for Glide to use. */ -// Public API. -@SuppressWarnings({"unused", "WeakerAccess"}) public final class GlideBuilder { private final Map, TransitionOptions> defaultTransitionOptions = new ArrayMap<>(); private Engine engine; @@ -83,6 +81,8 @@ public GlideBuilder setArrayPool(@Nullable ArrayPool arrayPool) { * @param memoryCache The cache to use. * @return This builder. */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setMemoryCache(@Nullable MemoryCache memoryCache) { this.memoryCache = memoryCache; @@ -99,6 +99,8 @@ public GlideBuilder setMemoryCache(@Nullable MemoryCache memoryCache) { * use {@link #setDiskCache(com.bumptech.glide.load.engine.cache.DiskCache.Factory)} instead. * Scheduled to be removed in Glide 4.0. */ + // Public API. + @SuppressWarnings("unused") @Deprecated public GlideBuilder setDiskCache(final DiskCache diskCache) { return setDiskCache(new DiskCache.Factory() { @@ -117,6 +119,8 @@ public DiskCache build() { * @param diskCacheFactory The disk cache factory to use. * @return This builder. */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setDiskCache(@Nullable DiskCache.Factory diskCacheFactory) { this.diskCacheFactory = diskCacheFactory; @@ -160,6 +164,8 @@ public GlideBuilder setResizeExecutor(@Nullable GlideExecutor service) { * @see #setDiskCacheExecutor(GlideExecutor) * @see GlideExecutor */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setSourceExecutor(@Nullable GlideExecutor service) { this.sourceExecutor = service; @@ -181,6 +187,8 @@ public GlideBuilder setSourceExecutor(@Nullable GlideExecutor service) { * @see #setSourceExecutor(GlideExecutor) * @see GlideExecutor */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setDiskCacheExecutor(@Nullable GlideExecutor service) { this.diskCacheExecutor = service; @@ -199,6 +207,8 @@ public GlideBuilder setDiskCacheExecutor(@Nullable GlideExecutor service) { * @param service The {@link GlideExecutor} to use. * @return This builder. */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setAnimationExecutor(@Nullable GlideExecutor service) { this.animationExecutor = service; @@ -237,6 +247,8 @@ public GlideBuilder setDefaultRequestOptions(@Nullable RequestOptions requestOpt * {@link android.graphics.drawable.BitmapDrawable}s, the transition you registered for * {@link android.graphics.drawable.BitmapDrawable}s will be used. */ + // Public API. + @SuppressWarnings("unused") @NonNull public GlideBuilder setDefaultTransitionOptions( @NonNull Class clazz, @Nullable TransitionOptions options) { @@ -257,6 +269,8 @@ public GlideBuilder setDefaultTransitionOptions( * * @deprecated Use {@link #setDefaultRequestOptions(RequestOptions)} instead. */ + // Public API. + @SuppressWarnings("unused") @Deprecated public GlideBuilder setDecodeFormat(DecodeFormat decodeFormat) { defaultRequestOptions = defaultRequestOptions.apply(new RequestOptions().format(decodeFormat)); @@ -272,6 +286,8 @@ public GlideBuilder setDecodeFormat(DecodeFormat decodeFormat) { * @param builder The builder to use (will not be modified). * @return This builder. */ + // Public API. + @SuppressWarnings("unused") @NonNull public GlideBuilder setMemorySizeCalculator(@NonNull MemorySizeCalculator.Builder builder) { return setMemorySizeCalculator(builder.build()); @@ -287,6 +303,8 @@ public GlideBuilder setMemorySizeCalculator(@NonNull MemorySizeCalculator.Builde * @param calculator The calculator to use. * @return This builder. */ + // Public API. + @SuppressWarnings("WeakerAccess") @NonNull public GlideBuilder setMemorySizeCalculator(@Nullable MemorySizeCalculator calculator) { this.memorySizeCalculator = calculator; @@ -301,6 +319,8 @@ public GlideBuilder setMemorySizeCalculator(@Nullable MemorySizeCalculator calcu * @param factory The factory to use * @return This builder. */ + // Public API. + @SuppressWarnings("unused") @NonNull public GlideBuilder setConnectivityMonitorFactory(@Nullable ConnectivityMonitorFactory factory) { this.connectivityMonitorFactory = factory; @@ -332,6 +352,8 @@ public GlideBuilder setConnectivityMonitorFactory(@Nullable ConnectivityMonitorF * @param logLevel The log level to use from {@link Log}. * @return This builder. */ + // Public API. + @SuppressWarnings("unused") @NonNull public GlideBuilder setLogLevel(int logLevel) { if (logLevel < Log.VERBOSE || logLevel > Log.ERROR) { @@ -385,6 +407,8 @@ public GlideBuilder setLogLevel(int logLevel) { * * @return This builder. */ + // Public API. + @SuppressWarnings("unused") @NonNull public GlideBuilder setIsActiveResourceRetentionAllowed( boolean isActiveResourceRetentionAllowed) { @@ -403,7 +427,7 @@ GlideBuilder setEngine(Engine engine) { } @NonNull - public Glide build(@NonNull Context context) { + Glide build(@NonNull Context context) { if (sourceExecutor == null) { sourceExecutor = GlideExecutor.newSourceExecutor(); }