aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/iitems
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-29 19:29:09 -0800
committerAllan Wang <me@allanwang.ca>2020-02-29 19:29:09 -0800
commitc5d38e5122bcb452b1e61ea6526434cf62e9da8c (patch)
tree3b31b15cd40fc81738592b8cb8af15fe23450d65 /app/src/main/kotlin/com/pitchedapps/frost/iitems
parenta93cdf52cc3b7eff1e2d4cf436b8f8dbc3cf14a2 (diff)
downloadfrost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.tar.gz
frost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.tar.bz2
frost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.zip
Update koin usage
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/iitems')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt4
2 files changed, 8 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
index 1262c078..5257be5e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
@@ -44,20 +44,20 @@ interface ClickableIItemContract {
val url: String?
- fun click(context: Context, fbCookie: FbCookie) {
+ fun click(context: Context, fbCookie: FbCookie, prefs: Prefs) {
val url = url ?: return
- context.launchWebOverlay(url, fbCookie)
+ context.launchWebOverlay(url, fbCookie, prefs)
}
companion object {
- fun bindEvents(adapter: IAdapter<GenericItem>, fbCookie: FbCookie) {
+ fun bindEvents(adapter: IAdapter<GenericItem>, fbCookie: FbCookie, prefs: Prefs) {
adapter.fastAdapter?.apply {
selectExtension {
isSelectable = false
}
onClickListener = { v, _, item, _ ->
if (item is ClickableIItemContract) {
- item.click(v!!.context, fbCookie)
+ item.click(v!!.context, fbCookie, prefs)
true
} else
false
@@ -76,7 +76,8 @@ open class HeaderIItem(
itemId: Int = R.layout.iitem_header
) : KauIItem<HeaderIItem.ViewHolder>(R.layout.iitem_header, ::ViewHolder, itemId) {
- class ViewHolder(itemView: View) : FastAdapter.ViewHolder<HeaderIItem>(itemView), KoinComponent {
+ class ViewHolder(itemView: View) : FastAdapter.ViewHolder<HeaderIItem>(itemView),
+ KoinComponent {
private val prefs: Prefs by inject()
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 8624fff0..9d3b59eb 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
@@ -51,7 +51,7 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
) {
companion object {
- fun bindEvents(adapter: ItemAdapter<NotificationIItem>, fbCookie: FbCookie) {
+ fun bindEvents(adapter: ItemAdapter<NotificationIItem>, fbCookie: FbCookie, prefs: Prefs) {
adapter.fastAdapter?.apply {
selectExtension {
isSelectable = false
@@ -65,7 +65,7 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
)
}
// TODO temp fix. If url is dependent, we cannot load it directly
- v!!.context.launchWebOverlay(if (notif.url.isIndependent) notif.url else FbItem.NOTIFICATIONS.url, fbCookie)
+ v!!.context.launchWebOverlay(if (notif.url.isIndependent) notif.url else FbItem.NOTIFICATIONS.url, fbCookie, prefs)
true
}
}