From 8c872caf78d1495344722af5a30def073aa5f06d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 8 Jul 2019 10:30:45 +0200 Subject: [PATCH] Inject IconLoader and BitmapLoader --- .../im/vector/riotx/features/notifications/BitmapLoader.kt | 5 ++++- .../im/vector/riotx/features/notifications/IconLoader.kt | 5 ++++- .../features/notifications/NotificationDrawerManager.kt | 6 ++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/BitmapLoader.kt b/vector/src/main/java/im/vector/riotx/features/notifications/BitmapLoader.kt index 02bf03bf..51a025e5 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/BitmapLoader.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/BitmapLoader.kt @@ -22,8 +22,11 @@ import androidx.annotation.WorkerThread import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import timber.log.Timber +import javax.inject.Inject +import javax.inject.Singleton -class BitmapLoader(val context: Context) { +@Singleton +class BitmapLoader @Inject constructor(val context: Context) { /** * Avatar Url -> Icon diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/IconLoader.kt b/vector/src/main/java/im/vector/riotx/features/notifications/IconLoader.kt index 6523ebc0..ef175ca6 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/IconLoader.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/IconLoader.kt @@ -24,8 +24,11 @@ import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.request.RequestOptions import timber.log.Timber +import javax.inject.Inject +import javax.inject.Singleton -class IconLoader(val context: Context) { +@Singleton +class IconLoader @Inject constructor(val context: Context) { /** * Avatar Url -> Icon diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt index 2870b8ba..508f60dc 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationDrawerManager.kt @@ -45,6 +45,8 @@ import javax.inject.Singleton @Singleton class NotificationDrawerManager @Inject constructor(private val context: Context, private val activeSessionHolder: ActiveSessionHolder, + private val iconLoader: IconLoader, + private val bitmapLoader: BitmapLoader, private val outdatedDetector: OutdatedEventDetector?) { private val handlerThread: HandlerThread = HandlerThread("NotificationDrawerManager", Thread.MIN_PRIORITY) @@ -64,10 +66,6 @@ class NotificationDrawerManager @Inject constructor(private val context: Context private var currentRoomId: String? = null - private var iconLoader = IconLoader(context) - - private var bitmapLoader = BitmapLoader(context) - /** Should be called as soon as a new event is ready to be displayed. The notification corresponding to this event will not be displayed until