Class WebExtension.Action
- Enclosing class:
- WebExtension
Instances of this class may represent the default 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)
.
See also
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal Integer
Background color for the badge for this Action.final String
Badge text for this action.final Integer
Text color for the badge for this Action.final Boolean
Whether this action is enabled and should be visible.final Image
Icon for this Action.final String
Title of this Action. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
click()
Notifies the extension that the user has clicked on this Action.toString()
withDefault
(WebExtension.Action defaultValue) Merges values from this Action with the default Action.
-
Field Details
-
title
Title of this Action.See also: pageAction/getTitle, browserAction/getTitle
-
icon
Icon for this Action.See also: pageAction/setIcon, browserAction/setIcon
-
enabled
Whether this action is enabled and should be visible.Note: for page action, this is
true
when the extension callspageAction.show
andfalse
when the extension callspageAction.hide
.See also: pageAction/show, browserAction/enabled
-
badgeText
Badge text for this action.See also: browserAction/getBadgeText
-
badgeBackgroundColor
Background color for the badge for this Action.This method will return an Android color int that can be used in
View.setBackgroundColor(int)
and similar methods.See also: browserAction/getBadgeBackgroundColor
-
badgeTextColor
Text color for the badge for this Action.This method will return an Android color int that can be used in
TextView.setTextColor(int)
and similar methods.See also: browserAction/getBadgeTextColor
-
-
Constructor Details
-
Action
protected Action()
-
-
Method Details
-
toString
-
withDefault
Merges values from this Action with the default Action.- Parameters:
defaultValue
- the default Action as received fromWebExtension.ActionDelegate.onBrowserAction(org.mozilla.geckoview.WebExtension, org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.WebExtension.Action)
orWebExtension.ActionDelegate.onPageAction(org.mozilla.geckoview.WebExtension, org.mozilla.geckoview.GeckoSession, org.mozilla.geckoview.WebExtension.Action)
.- Returns:
- an
WebExtension.Action
where allnull
values from this instance are replaced with values fromdefaultValue
. - Throws:
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.
-
click
@UiThread public void click()Notifies the extension that the user has clicked on this Action.
-