android-components / mozilla.components.concept.toolbar / Toolbar

# Toolbar

`interface Toolbar` (source)

Interface to be implemented by components that provide browser toolbar functionality.

### Types

Action | `interface Action` Generic interface for actions to be added to the toolbar.
ActionButton | `open class ActionButton : Action` An action button to be added to the toolbar.
ActionImage | `open class ActionImage : Action` An action that just shows a static, non-clickable image.
ActionSpace | `open class ActionSpace : Action` An "empty" action with a desired width to be used as "placeholder".
ActionToggleButton | `open class ActionToggleButton : Action` An action button with two states, selected and unselected. When the button is pressed, the state changes automatically.
OnEditListener | `interface OnEditListener` Listener to be invoked when the user edits the URL.

### Properties

url | `abstract var url: String` Sets/Gets the URL to be displayed on the toolbar.

### Functions

addBrowserAction | `abstract fun addBrowserAction(action: Action): Unit` Adds an action to be displayed on the right side of the toolbar in display mode.
addNavigationAction | `abstract fun addNavigationAction(action: Action): Unit` Adds an action to be displayed on the far left side of the URL in display mode.
addPageAction | `abstract fun addPageAction(action: Action): Unit` Adds an action to be displayed on the right side of the URL in display mode.
asView | `open fun asView(): View` Casts this toolbar to an Android View object.
displayMode | `abstract fun displayMode(): Unit` Switches to URL displaying mode (from editing mode) if supported by the toolbar implementation.
displayProgress | `abstract fun displayProgress(progress: Int): Unit` Displays the given loading progress. Expects values in the range 0,100.
editMode | `abstract fun editMode(): Unit` Switches to URL editing mode (from displaying mode) if supported by the toolbar implementation.
onBackPressed | `abstract fun onBackPressed(): Boolean` Should be called by an activity when the user pressed the back key of the device.
setOnEditListener | `abstract fun setOnEditListener(listener: OnEditListener): Unit` Registers the given listener to be invoked when the user edits the URL.
setOnUrlCommitListener | `abstract fun setOnUrlCommitListener(listener: (String) -> Unit): Unit` Registers the given function to be invoked when the user selected a new URL i.e. is done editing.
setSearchTerms | `abstract fun setSearchTerms(searchTerms: String): Unit` Displays the currently used search terms as part of this Toolbar.

### Inheritors

BrowserToolbar | `class BrowserToolbar : ViewGroup, Toolbar` A customizable toolbar for browsers.