aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
diff options
context:
space:
mode:
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.kt17
1 files changed, 9 insertions, 8 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 61e2c11f..46c87c96 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
@@ -25,12 +25,13 @@ import com.afollestad.materialdialogs.callbacks.onDismiss
import com.afollestad.materialdialogs.list.listItems
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.MainActivity
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.formattedFbUrl
/**
* Created by Allan Wang on 2017-07-07.
*/
-fun Context.showWebContextMenu(wc: WebContext) {
+fun Context.showWebContextMenu(wc: WebContext, fbCookie: FbCookie) {
if (wc.isEmpty) return
var title = wc.url ?: string(R.string.menu)
title =
@@ -43,7 +44,7 @@ fun Context.showWebContextMenu(wc: WebContext) {
materialDialog {
title(text = title)
listItems(items = menuItems.map { string(it.textId) }) { _, position, _ ->
- menuItems[position].onClick(this@showWebContextMenu, wc)
+ menuItems[position].onClick(this@showWebContextMenu, wc, fbCookie)
}
onDismiss {
// showing the dialog interrupts the touch down event, so we must ensure that the viewpager's swipe is enabled
@@ -65,16 +66,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) -> Unit
+ val onClick: (c: Context, wc: WebContext, fc: FbCookie) -> Unit
) {
OPEN_LINK(
R.string.open_link,
{ it.hasUrl },
- { c, wc -> c.launchWebOverlay(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) }),
- DEBUG_LINK(R.string.debug_link, { it.hasUrl }, { c, wc ->
+ { c, wc , fc -> c.launchWebOverlay(wc.url!!, fc) }),
+ COPY_LINK(R.string.copy_link, { it.hasUrl }, { c, wc , fc-> c.copyToClipboard(wc.url) }),
+ COPY_TEXT(R.string.copy_text, { it.hasText }, { c, wc , fc-> c.copyToClipboard(wc.text) }),
+ SHARE_LINK(R.string.share_link, { it.hasUrl }, { c, wc, fc -> c.shareText(wc.url) }),
+ DEBUG_LINK(R.string.debug_link, { it.hasUrl }, { c, wc, fc ->
c.materialDialog {
title(R.string.debug_link)
message(R.string.debug_link_desc)