android-components / mozilla.components.feature.contextmenu / ContextMenuCandidate

ContextMenuCandidate

data class ContextMenuCandidate (source)

A candidate for an item to be displayed in the context menu.

Types

Name Summary
SnackbarDelegate interface SnackbarDelegate
Delegate to display a snackbar.

Constructors

Name Summary
<init> ContextMenuCandidate(id: String, label: String, showFor: (SessionState, HitResult) -> Boolean, action: (SessionState, HitResult) -> Unit)
A candidate for an item to be displayed in the context menu.

Properties

Name Summary
action val action: (SessionState, HitResult) -> Unit
The action to be invoked once the user selects this item.
id val id: String
A unique ID that will be used to uniquely identify the candidate that the user selected.
label val label: String
The label that will be displayed in the context menu
showFor val showFor: (SessionState, HitResult) -> Boolean
If this lambda returns true for a given SessionState and HitResult then it will be displayed in the context menu.

Companion Object Functions

Name Summary
createCopyImageLocationCandidate fun createCopyImageLocationCandidate(context: <ERROR CLASS>, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): ContextMenuCandidate
Context Menu item: “Copy Image Location”.
createCopyLinkCandidate fun createCopyLinkCandidate(context: <ERROR CLASS>, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): ContextMenuCandidate
Context Menu item: “Copy Link”.
createOpenImageInNewTabCandidate fun createOpenImageInNewTabCandidate(context: <ERROR CLASS>, tabsUseCases: TabsUseCases, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): ContextMenuCandidate
Context Menu item: “Open Image in New Tab”.
createOpenInNewTabCandidate fun createOpenInNewTabCandidate(context: <ERROR CLASS>, tabsUseCases: TabsUseCases, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): ContextMenuCandidate
Context Menu item: “Open Link in New Tab”.
createOpenInPrivateTabCandidate fun createOpenInPrivateTabCandidate(context: <ERROR CLASS>, tabsUseCases: TabsUseCases, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): ContextMenuCandidate
Context Menu item: “Open Link in Private Tab”.
createSaveImageCandidate fun createSaveImageCandidate(context: <ERROR CLASS>, contextMenuUseCases: ContextMenuUseCases): ContextMenuCandidate
Context Menu item: “Save image”.
createShareLinkCandidate fun createShareLinkCandidate(context: <ERROR CLASS>): ContextMenuCandidate
Context Menu item: “Share Link”.
defaultCandidates fun defaultCandidates(context: <ERROR CLASS>, tabsUseCases: TabsUseCases, contextMenuUseCases: ContextMenuUseCases, snackBarParentView: <ERROR CLASS>, snackbarDelegate: SnackbarDelegate = DefaultSnackbarDelegate()): List<ContextMenuCandidate>
Returns the default list of context menu candidates.