Skip to content

Commit

Permalink
Convert ImageLoader.invoke to a top level function. (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite authored Nov 28, 2021
1 parent bc59628 commit 599e86e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
7 changes: 1 addition & 6 deletions coil-base/api/coil-base.api
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public final class coil/EventListener$Factory$Companion {
}

public abstract interface class coil/ImageLoader {
public static final field Companion Lcoil/ImageLoader$Companion;
public static fun create (Landroid/content/Context;)Lcoil/ImageLoader;
public abstract fun enqueue (Lcoil/request/ImageRequest;)Lcoil/request/Disposable;
public abstract fun execute (Lcoil/request/ImageRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getComponents ()Lcoil/ComponentRegistry;
Expand Down Expand Up @@ -125,11 +123,8 @@ public final class coil/ImageLoader$Builder {
public final fun transitionFactory (Lcoil/transition/Transition$Factory;)Lcoil/ImageLoader$Builder;
}

public final class coil/ImageLoader$Companion {
public final fun create (Landroid/content/Context;)Lcoil/ImageLoader;
}

public final class coil/ImageLoaders {
public static final fun create (Landroid/content/Context;)Lcoil/ImageLoader;
public static final fun executeBlocking (Lcoil/ImageLoader;Lcoil/request/ImageRequest;)Lcoil/request/ImageResult;
}

Expand Down
7 changes: 0 additions & 7 deletions coil-base/src/main/java/coil/ImageLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,4 @@ interface ImageLoader {
)
fun transition(transition: Transition): Builder = unsupported()
}

companion object {
/** Create a new [ImageLoader] without configuration. */
@JvmStatic
@JvmName("create")
operator fun invoke(context: Context) = Builder(context).build()
}
}
9 changes: 9 additions & 0 deletions coil-base/src/main/java/coil/ImageLoaders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@

package coil

import android.content.Context
import androidx.annotation.WorkerThread
import coil.request.ImageRequest
import coil.request.ImageResult
import kotlinx.coroutines.runBlocking

/**
* Create a new [ImageLoader] without configuration.
*/
@JvmName("create")
fun ImageLoader(context: Context): ImageLoader {
return ImageLoader.Builder(context).build()
}

/**
* Execute the [request] and block the current thread until it completes.
*
Expand Down

0 comments on commit 599e86e

Please sign in to comment.