Skip to content

Instantly share code, notes, and snippets.

@vincent-paing
Last active August 21, 2019 09:24
Show Gist options
  • Save vincent-paing/18961f355df243e7242ce8cba6f4b938 to your computer and use it in GitHub Desktop.
Save vincent-paing/18961f355df243e7242ce8cba6f4b938 to your computer and use it in GitHub Desktop.
class FakeImageLoader : ImageLoader {
val requestSet = mutableSetOf<Request>()
override fun load(request: LoadRequest): RequestDisposable {
// Always call onStart before onSuccess.
requestSet.add(request)
request.target?.onStart(drawable)
request.target?.onSuccess(drawable)
return disposable
}
override suspend fun get(request: GetRequest): Drawable {
requestSet.add(request)
return drawable
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment