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

ContextMenuFeature

class ContextMenuFeature : LifecycleAwareFeature (source)

Feature for displaying a context menu after long-pressing web content.

This feature will subscribe to the currently selected Session and display the context menu based on Session.Observer.onLongPress events. Once the context menu is closed or the user selects an item from the context menu the related HitResult will be consumed.

Constructors

Name Summary
<init> ContextMenuFeature(fragmentManager: FragmentManager, store: BrowserStore, candidates: List<ContextMenuCandidate>, engineView: EngineView, useCases: ContextMenuUseCases, tabId: String? = null)
Feature for displaying a context menu after long-pressing web content.

Functions

Name Summary
start fun start(): Unit
Start observing the selected session and when needed show a context menu.
stop fun stop(): Unit
Stop observing the selected session and do not show any context menus anymore.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.