aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-04-17 20:06:36 -0700
committerAllan Wang <me@allanwang.ca>2021-04-17 20:06:36 -0700
commit6abaf596e4db5a36057f6a8acf31b72f57a12e18 (patch)
tree1b2d52fe2f6a4d1d73fe23c0061a697c9d664eab /app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
parent795182bab71e70c28e7d07550bca0d2e35b70c60 (diff)
downloadfrost-6abaf596e4db5a36057f6a8acf31b72f57a12e18.tar.gz
frost-6abaf596e4db5a36057f6a8acf31b72f57a12e18.tar.bz2
frost-6abaf596e4db5a36057f6a8acf31b72f57a12e18.zip
Remove koin dependency in production
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
index 2e88141d..f3c81578 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
@@ -32,7 +32,7 @@ import com.pitchedapps.frost.prefs.Prefs
/**
* Created by Allan Wang on 2017-07-07.
*/
-fun Context.showWebContextMenu(wc: WebContext, fbCookie: FbCookie) {
+fun Context.showWebContextMenu(wc: WebContext, fbCookie: FbCookie, prefs: Prefs) {
if (wc.isEmpty) return
var title = wc.url ?: string(R.string.menu)
title =
@@ -45,7 +45,7 @@ fun Context.showWebContextMenu(wc: WebContext, fbCookie: FbCookie) {
materialDialog {
title(text = title)
listItems(items = menuItems.map { string(it.textId) }) { _, position, _ ->
- menuItems[position].onClick(this@showWebContextMenu, wc, fbCookie)
+ menuItems[position].onClick(this@showWebContextMenu, wc, fbCookie, prefs)
}
onDismiss {
// showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled
@@ -67,16 +67,16 @@ class WebContext(val unformattedUrl: String?, val text: String?) {
enum class WebContextType(
val textId: Int,
val constraint: (wc: WebContext) -> Boolean,
- val onClick: (c: Context, wc: WebContext, fc: FbCookie) -> Unit
+ val onClick: (c: Context, wc: WebContext, fc: FbCookie, prefs: Prefs) -> Unit
) {
OPEN_LINK(
R.string.open_link,
{ it.hasUrl },
- { c, wc, fc -> c.launchWebOverlay(wc.url!!, fc, Prefs.get()) }
+ { c, wc, fc, prefs -> c.launchWebOverlay(wc.url!!, fc, prefs) }
),
- COPY_LINK(R.string.copy_link, { it.hasUrl }, { c, wc, _ -> c.copyToClipboard(wc.url) }),
- COPY_TEXT(R.string.copy_text, { it.hasText }, { c, wc, _ -> c.copyToClipboard(wc.text) }),
- SHARE_LINK(R.string.share_link, { it.hasUrl }, { c, wc, _ -> c.shareText(wc.url) })
+ COPY_LINK(R.string.copy_link, { it.hasUrl }, { c, wc, _, _ -> c.copyToClipboard(wc.url) }),
+ COPY_TEXT(R.string.copy_text, { it.hasText }, { c, wc, _, _ -> c.copyToClipboard(wc.text) }),
+ SHARE_LINK(R.string.share_link, { it.hasUrl }, { c, wc, _, _ -> c.shareText(wc.url) })
;
companion object {