relying on the glide caches (persisted and in memory) instead of our own

- this effectively halves the amount of image memory used by notifications
This commit is contained in:
Adam Brown 2022-02-21 12:04:02 +00:00
parent 95b3afd148
commit 65239e4034
2 changed files with 2 additions and 17 deletions

View File

@ -28,11 +28,6 @@ import javax.inject.Singleton
@Singleton
class BitmapLoader @Inject constructor(private val context: Context) {
/**
* Avatar Url -> Bitmap
*/
private val cache = HashMap<String, Bitmap?>()
/**
* Get icon of a room.
* If already in cache, use it, else load it and call BitmapLoaderListener.onBitmapsLoaded() when ready
@ -42,10 +37,7 @@ class BitmapLoader @Inject constructor(private val context: Context) {
if (path == null) {
return null
}
return cache.getOrPut(path) {
loadRoomBitmap(path)
}
return loadRoomBitmap(path)
}
@WorkerThread

View File

@ -30,11 +30,6 @@ import javax.inject.Singleton
@Singleton
class IconLoader @Inject constructor(private val context: Context) {
/**
* Avatar Url -> IconCompat
*/
private val cache = HashMap<String, IconCompat?>()
/**
* Get icon of a user.
* If already in cache, use it, else load it and call IconLoaderListener.onIconsLoaded() when ready
@ -46,9 +41,7 @@ class IconLoader @Inject constructor(private val context: Context) {
return null
}
return cache.getOrPut(path) {
loadUserIcon(path)
}
return loadUserIcon(path)
}
@WorkerThread