Package org.mozilla.geckoview
Interface GeckoSession.SelectionActionDelegate
- All Known Implementing Classes:
BasicSelectionActionDelegate
- Enclosing class:
- GeckoSession
public static interface GeckoSession.SelectionActionDelegate
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Represents attributes of a clipboard permission.static class
Represents attributes of a selection. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Collapse the current selection to its end position.static final String
Collapse the current selection to its start position.static final String
Copy the selected content onto the clipboard.static final String
Copy onto the clipboard then delete the selected content.static final String
Delete the selected content.static final String
Hide selection actions and causeonHideAction(org.mozilla.geckoview.GeckoSession, int)
to be called.static final String
Replace the selected content with the clipboard content.static final String
Replace the selected content with the clipboard content as plain text.static final String
Select the entire content of the document or editor.static final String
Clear the current selection.static final int
The selection is collapsed at a single position.static final int
The selection is inside editable content such as an input element or contentEditable node.static final int
The selection is inside a password field.static final int
Actions are no longer available due to the user actively scrolling the page.static final int
Actions are no longer available due to the user actively changing the selection.static final int
Actions are no longer available due to the user moving the selection out of view.static final int
Actions are no longer available due to the user clearing the selection.static final int
Permission for reading clipboard data. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
Dismiss requesting clipboard permission popup or model.default void
onHideAction
(GeckoSession session, int reason) Previous actions are no longer available due to the user interacting with the page.default void
onShowActionRequest
(GeckoSession session, GeckoSession.SelectionActionDelegate.Selection selection) Selection actions are available.default GeckoResult<AllowOrDeny>
onShowClipboardPermissionRequest
(GeckoSession session, GeckoSession.SelectionActionDelegate.ClipboardPermission permission) Request clipboard permission.
-
Field Details
-
FLAG_IS_COLLAPSED
static final int FLAG_IS_COLLAPSEDThe selection is collapsed at a single position.- See Also:
-
FLAG_IS_EDITABLE
static final int FLAG_IS_EDITABLEThe selection is inside editable content such as an input element or contentEditable node.- See Also:
-
FLAG_IS_PASSWORD
static final int FLAG_IS_PASSWORDThe selection is inside a password field.- See Also:
-
ACTION_HIDE
Hide selection actions and causeonHideAction(org.mozilla.geckoview.GeckoSession, int)
to be called.- See Also:
-
ACTION_CUT
Copy onto the clipboard then delete the selected content. Selection must be editable.- See Also:
-
ACTION_COPY
Copy the selected content onto the clipboard.- See Also:
-
ACTION_DELETE
Delete the selected content. Selection must be editable.- See Also:
-
ACTION_PASTE
Replace the selected content with the clipboard content. Selection must be editable.- See Also:
-
ACTION_PASTE_AS_PLAIN_TEXT
Replace the selected content with the clipboard content as plain text. Selection must be editable.- See Also:
-
ACTION_SELECT_ALL
Select the entire content of the document or editor.- See Also:
-
ACTION_UNSELECT
Clear the current selection. Selection must not be editable.- See Also:
-
ACTION_COLLAPSE_TO_START
Collapse the current selection to its start position. Selection must be editable.- See Also:
-
ACTION_COLLAPSE_TO_END
Collapse the current selection to its end position. Selection must be editable.- See Also:
-
HIDE_REASON_NO_SELECTION
static final int HIDE_REASON_NO_SELECTIONActions are no longer available due to the user clearing the selection.- See Also:
-
HIDE_REASON_INVISIBLE_SELECTION
static final int HIDE_REASON_INVISIBLE_SELECTIONActions are no longer available due to the user moving the selection out of view. Previous actions are still available after a callback with this reason.- See Also:
-
HIDE_REASON_ACTIVE_SELECTION
static final int HIDE_REASON_ACTIVE_SELECTIONActions are no longer available due to the user actively changing the selection.onShowActionRequest(org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.GeckoSession.SelectionActionDelegate.Selection)
may be called again once the user has set a selection, if the new selection has available actions.- See Also:
-
HIDE_REASON_ACTIVE_SCROLL
static final int HIDE_REASON_ACTIVE_SCROLLActions are no longer available due to the user actively scrolling the page.onShowActionRequest(org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.GeckoSession.SelectionActionDelegate.Selection)
may be called again once the user has stopped scrolling the page, if the selection is still visible. Until then, previous actions are still available after a callback with this reason.- See Also:
-
PERMISSION_CLIPBOARD_READ
static final int PERMISSION_CLIPBOARD_READPermission for reading clipboard data. See: Clipboard.readText()- See Also:
-
-
Method Details
-
onShowActionRequest
@UiThread default void onShowActionRequest(@NonNull GeckoSession session, @NonNull GeckoSession.SelectionActionDelegate.Selection selection) Selection actions are available. Selection actions become available when the user selects some content in the document or editor. Inside an editor, selection actions can also become available when the user explicitly requests editor action UI, for example by tapping on the caret handle.In response to this callback, applications typically display a toolbar containing the selection actions. To perform a certain action, check if the action is available with
GeckoSession.SelectionActionDelegate.Selection.isActionAvailable(java.lang.String)
then either use the relevant helper method orGeckoSession.SelectionActionDelegate.Selection.execute(java.lang.String)
Once an
onHideAction(org.mozilla.geckoview.GeckoSession, int)
call (with particular reasons) or anotheronShowActionRequest(org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.GeckoSession.SelectionActionDelegate.Selection)
call is received, the previous Selection object is no longer usable.- Parameters:
session
- The GeckoSession that initiated the callback.selection
- Current selection attributes and Callback object for performing built-in actions. May be used multiple times to perform multiple actions at once.
-
onHideAction
Previous actions are no longer available due to the user interacting with the page. Applications typically hide the action toolbar in response.- Parameters:
session
- The GeckoSession that initiated the callback.reason
- The reason that actions are no longer available, as one of theHIDE_REASON_*
constants.
-
onShowClipboardPermissionRequest
@UiThread @Nullable default GeckoResult<AllowOrDeny> onShowClipboardPermissionRequest(@NonNull GeckoSession session, @NonNull GeckoSession.SelectionActionDelegate.ClipboardPermission permission) Request clipboard permission.- Parameters:
session
- The GeckoSession that initiated the callback.permission
- AnGeckoSession.SelectionActionDelegate.ClipboardPermission
describing the permission being requested.- Returns:
- A
GeckoResult
withAllowOrDeny
, determining the response to the permission request for this site.
-
onDismissClipboardPermissionRequest
Dismiss requesting clipboard permission popup or model.- Parameters:
session
- The GeckoSession that initiated the callback.
-