android-components / mozilla.components.browser.toolbar.edit / EditToolbar

EditToolbar

class EditToolbar (source)

Sub-component of the browser toolbar responsible for allowing the user to edit the URL (“edit mode”).

Structure: +——+—————————+———+——+ | icon | url | actions | exit | +——+—————————+———+——+

  • icon: Optional icon that will be shown in front of the URL.
  • url: Editable URL of the currently displayed website
  • actions: Optional action icons injected by other components (e.g. barcode scanner)
  • exit: Button that switches back to display mode or invoke an app-defined callback.

Types

Name Summary
Colors data class Colors
Data class holding the customizable colors in “edit mode”.

Properties

Name Summary
colors var colors: Colors
Customizable colors in “edit mode”.
hint var hint: String
Sets the text to be displayed when the URL of the toolbar is empty.
textSize var textSize: Float
Sets the size of the text for the URL/search term displayed in the toolbar.
typeface var typeface: <ERROR CLASS>
Sets the typeface of the text for the URL/search term displayed in the toolbar.

Functions

Name Summary
focus fun focus(): Unit
Focuses the url input field and shows the virtual keyboard if needed.
setIcon fun setIcon(icon: <ERROR CLASS>, contentDescription: String): Unit
Sets an icon that will be drawn in front of the URL.
setOnEditFocusChangeListener fun setOnEditFocusChangeListener(listener: (Boolean) -> Unit): Unit
Sets a listener to be invoked when focus of the URL input view (in edit mode) changed.
setUrlBackground fun setUrlBackground(background: <ERROR CLASS>?): Unit
Sets the background that will be drawn behind the URL, icon and edit actions.

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.