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:
parent
95b3afd148
commit
65239e4034
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue