Junior — Middle+
Creating a simple image uploader
livecode
Task condition
It is required to develop a small library capable of fetching images from a specified URL and displaying them in an ImageView object. When multiple requests for the same image occur simultaneously, the network request should only be performed once, and the result should be reused.
// Fragment
fun onCreateView(...) {
...
val imageView: ImageView ...
val url: Uri = ...
// Usage example
}
// Library implementation
// Utilities:
@WorkerThread
fun loadBytes(url: Uri): ByteArray
fun createBitmap(byteArray: ByteArray): Bitmap