Skip to content

Commit

Permalink
Make GlideBuilder.build package private.
Browse files Browse the repository at this point in the history
It shouldn’t have been made visible and can’t 
safely be used directly outside of the library.

Fixes #2885
  • Loading branch information
sjudd committed Feb 8, 2018
1 parent 17c1c3d commit 914060e
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions library/src/main/java/com/bumptech/glide/GlideBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Class<?>, TransitionOptions<?, ?>> defaultTransitionOptions = new ArrayMap<>();
private Engine engine;
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 <T> GlideBuilder setDefaultTransitionOptions(
@NonNull Class<T> clazz, @Nullable TransitionOptions<?, T> options) {
Expand All @@ -257,6 +269,8 @@ public <T> 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));
Expand All @@ -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());
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -385,6 +407,8 @@ public GlideBuilder setLogLevel(int logLevel) {
*
* @return This builder.
*/
// Public API.
@SuppressWarnings("unused")
@NonNull
public GlideBuilder setIsActiveResourceRetentionAllowed(
boolean isActiveResourceRetentionAllowed) {
Expand All @@ -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();
}
Expand Down

0 comments on commit 914060e

Please sign in to comment.