android-components / mozilla.components.browser.menu.item / BrowserMenuCompoundButton

BrowserMenuCompoundButton

abstract class BrowserMenuCompoundButton : BrowserMenuItem (source)

A browser menu compound button. A basic sub-class would only have to provide a layout resource to satisfy BrowserMenuItem.getLayoutResource which contains a View that inherits from CompoundButton.

Parameters

label - The visible label of this menu item.

initialState - The initial value the checkbox should have.

listener - Callback to be invoked when this menu item is checked.

Constructors

Name Summary
<init> BrowserMenuCompoundButton(label: String, initialState: () -> Boolean = { false }, listener: (Boolean) -> Unit)
A browser menu compound button. A basic sub-class would only have to provide a layout resource to satisfy BrowserMenuItem.getLayoutResource which contains a View that inherits from CompoundButton.

Properties

Name Summary
label val label: String
The visible label of this menu item.
visible open var visible: () -> Boolean
Lambda expression that returns true if this item should be shown in the menu. Returns false if this item should be hidden.

Inherited Properties

Name Summary
interactiveCount open val interactiveCount: () -> Int
Lambda expression that returns the number of interactive elements in this menu item. For example, a simple item will have 1, divider will have 0, and a composite item, like a tool bar, will have several.

Functions

Name Summary
asCandidate open fun asCandidate(context: <ERROR CLASS>): CompoundMenuCandidate
Converts the menu item into a menu candidate.
bind open fun bind(menu: BrowserMenu, view: <ERROR CLASS>): Unit
Called by the browser menu to display the data of this item using the passed view.

Inherited Functions

Name Summary
getLayoutResource abstract fun getLayoutResource(): Int
Returns the layout resource ID of the layout to be inflated for showing a menu item of this type.
invalidate open fun invalidate(view: <ERROR CLASS>): Unit
Called by the browser menu to update the displayed data of this item using the passed view.

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.

Inheritors

Name Summary
BrowserMenuCheckbox class BrowserMenuCheckbox : BrowserMenuCompoundButton
A simple browser menu checkbox.
BrowserMenuHighlightableSwitch class BrowserMenuHighlightableSwitch : BrowserMenuCompoundButton, HighlightableMenuItem
A browser menu switch that can show a highlighted icon.
BrowserMenuImageSwitch class BrowserMenuImageSwitch : BrowserMenuCompoundButton
A simple browser menu switch.
BrowserMenuSwitch class BrowserMenuSwitch : BrowserMenuCompoundButton
A simple browser menu switch.