Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using Target for image loading #10

Open
github-actions bot opened this issue Nov 29, 2023 · 0 comments
Open

Consider using Target for image loading #10

github-actions bot opened this issue Nov 29, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

// TODO Consider using Target for image loading


}

class GlideImageLoader(private val context: Context) : ImageLoader {
    // TODO Consider using Target for image loading
    override suspend fun loadImage(url: String, callback: (Drawable) -> Unit) {
        try {
            callback(withContext(Dispatchers.IO) {
                Glide.with(context)
                    //.clearOnStop()
                    .load(url)
                    .placeholder(android.R.drawable.stat_sys_download)
                    .error(android.R.drawable.stat_notify_error)
                    //.fallback(android.R.drawable.stat_notify_sync)
                    .submit()
                    .get()
            })
        } catch (e: Exception) { // TODO Memory leak here, resources not released on 404
            when (e) {
                is IOException, is CancellationException, is ExecutionException -> {
                    throw ImageLoadingException("Error loading image using Glide", e)

@github-actions github-actions bot added the todo label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants