Created
October 18, 2019 19:25
-
-
Save veena14cs/0d18a3fad554b4ff17bcf2ff434a159d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GlideImageLoader @Inject constructor() : ImageLoader { | |
override fun load(context: Context, path: String, target: SimpleTarget<Bitmap>) { | |
Glide.with(context) | |
.asBitmap() | |
.load(path) | |
.into(target) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ImageLoader { | |
fun load(context: Context, path: String, target: SimpleTarget<Bitmap>) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
abstract class ImageLoaderModule { | |
@Binds | |
abstract fun bindImageLoader(glideImageLoader: GlideImageLoader): ImageLoader | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UrlImageParser private constructor( | |
..) | |
@Inject | |
lateinit var imageLoader:ImageLoader | |
override fun getDrawable(urlString: String): Drawable { | |
... | |
imageLoader.load( | |
context, | |
gcsPrefix + gcsResource + imageDownloadUrlTemplate, | |
target | |
) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment