aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/iitems
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-04-17 19:03:47 -0700
committerAllan Wang <me@allanwang.ca>2021-04-17 19:03:47 -0700
commita56dbf0f61e80225f0d86af43ea0f1d6efa5e66a (patch)
tree38dc6437ba4b669991dc61c92c87e27939e9a608 /app/src/main/kotlin/com/pitchedapps/frost/iitems
parente1ae3536102a5bb83a3c73c3731eb4af56b96914 (diff)
downloadfrost-a56dbf0f61e80225f0d86af43ea0f1d6efa5e66a.tar.gz
frost-a56dbf0f61e80225f0d86af43ea0f1d6efa5e66a.tar.bz2
frost-a56dbf0f61e80225f0d86af43ea0f1d6efa5e66a.zip
Injection checkpoint
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/iitems')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt35
1 files changed, 22 insertions, 13 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
index f7f71fcb..f0fb1a28 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
@@ -40,19 +40,25 @@ import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.isIndependent
import com.pitchedapps.frost.utils.launchWebOverlay
-import org.koin.core.component.KoinComponent
-import org.koin.core.component.inject
/**
* Created by Allan Wang on 27/12/17.
*/
-class NotificationIItem(val notification: FrostNotif, val cookie: String) :
- KauIItem<NotificationIItem.ViewHolder>(
- R.layout.iitem_notification, ::ViewHolder
- ) {
+class NotificationIItem(
+ val notification: FrostNotif,
+ val cookie: String,
+ private val themeProvider: ThemeProvider
+) : KauIItem<NotificationIItem.ViewHolder>(
+ R.layout.iitem_notification, { ViewHolder(it, themeProvider) }
+) {
companion object {
- fun bindEvents(adapter: ItemAdapter<NotificationIItem>, fbCookie: FbCookie, prefs: Prefs) {
+ fun bindEvents(
+ adapter: ItemAdapter<NotificationIItem>,
+ fbCookie: FbCookie,
+ prefs: Prefs,
+ themeProvider: ThemeProvider
+ ) {
adapter.fastAdapter?.apply {
selectExtension {
isSelectable = false
@@ -62,7 +68,11 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
if (notif.unread) {
adapter.set(
position,
- NotificationIItem(notif.copy(unread = false), item.cookie)
+ NotificationIItem(
+ notif.copy(unread = false),
+ item.cookie,
+ themeProvider
+ )
)
}
// TODO temp fix. If url is dependent, we cannot load it directly
@@ -101,11 +111,10 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
}
}
- class ViewHolder(itemView: View) :
- FastAdapter.ViewHolder<NotificationIItem>(itemView),
- KoinComponent {
-
- private val themeProvider: ThemeProvider by inject()
+ class ViewHolder(
+ itemView: View,
+ private val themeProvider: ThemeProvider
+ ) : FastAdapter.ViewHolder<NotificationIItem>(itemView) {
private val frame: ViewGroup by bindView(R.id.item_frame)
private val avatar: ImageView by bindView(R.id.item_avatar)