@AnyThread public static class WebExtension.Action extends Object
Action
which applies to all WebExtension tabs or a tab-specific override. To
reconstruct the full Action
object, you can use
withDefault(org.mozilla.geckoview.WebExtension.Action)
.
Tab specific overrides can be obtained by registering a delegate using
WebExtension.SessionController.setActionDelegate(org.mozilla.geckoview.WebExtension, org.mozilla.geckoview.WebExtension.ActionDelegate)
, while default values
can be obtained by registering a delegate using
WebExtension.setActionDelegate(org.mozilla.geckoview.WebExtension.ActionDelegate)
.
Modifier and Type | Field and Description |
---|---|
Integer |
badgeBackgroundColor
Background color for the badge for this Action.
|
String |
badgeText
Badge text for this action.
|
Integer |
badgeTextColor
Text color for the badge for this Action.
|
Boolean |
enabled
Whether this action is enabled and should be visible.
|
Image |
icon
Icon for this Action.
|
String |
title
Title of this Action.
|
Modifier | Constructor and Description |
---|---|
protected |
Action() |
Modifier and Type | Method and Description |
---|---|
void |
click()
Notifies the extension that the user has clicked on this Action.
|
String |
toString() |
WebExtension.Action |
withDefault(WebExtension.Action defaultValue)
Merges values from this Action with the default Action.
|
@Nullable public final String title
@Nullable public final Image icon
@Nullable public final Boolean enabled
true
when the extension calls
pageAction.show
and false
when the extension
calls pageAction.hide
.
See also:
pageAction/show,
browserAction/enabled@Nullable public final String badgeText
@Nullable public final Integer badgeBackgroundColor
View.setBackgroundColor(int)
and similar
methods.
See also:
browserAction/getBadgeBackgroundColor@Nullable public final Integer badgeTextColor
TextView.setTextColor(int)
and similar
methods.
See also:
browserAction/getBadgeTextColor@NonNull public WebExtension.Action withDefault(@NonNull WebExtension.Action defaultValue)
defaultValue
- the default Action as received from
WebExtension.ActionDelegate.onBrowserAction(org.mozilla.geckoview.WebExtension, org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.WebExtension.Action)
or WebExtension.ActionDelegate.onPageAction(org.mozilla.geckoview.WebExtension, org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.WebExtension.Action)
.WebExtension.Action
where all null
values from
this instance are replaced with values from
defaultValue
.IllegalArgumentException
- if defaultValue is not of the same
type, e.g. if this Action is a Page Action and default
value is a Browser Action.@UiThread public void click()