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
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceAction type definitions for WebExtension actions. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal IntegerBackground color for the badge for this Action.final StringBadge text for this action.final IntegerText color for the badge for this Action.final BooleanWhether this action is enabled and should be visible.final ImageIcon for this Action.final StringTitle of this Action. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclick()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
truewhen the extension callspageAction.showandfalsewhen 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()Create a default Action for testing purposes.
-
-
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.Actionwhere allnullvalues 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.
-