class BrowserToolbar : ViewGroup, Toolbar
(source)
A customizable toolbar for browsers.
The toolbar can switch between two modes: display and edit. The display mode displays the current URL and controls for navigation. In edit mode the current URL can be edited. Those two modes are implemented by the DisplayToolbar and EditToolbar classes.
+----------------+
| BrowserToolbar |
+--------+-------+
+
+-------+-------+
| |
+---------v------+ +-------v--------+ | DisplayToolbar | | EditToolbar | +----------------+ +----------------+
class Button : ActionButton
An action button to be added to the toolbar. |
|
class ToggleButton : ActionToggleButton
An action button with two states, selected and unselected. When the button is pressed, the state changes automatically. |
BrowserToolbar(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
A customizable toolbar for browsers. |
var browserActionMargin: Int
Gets/Sets the margin to be used between browser actions. |
|
var displaySiteSecurityIcon: Boolean
Set/Get whether a site security icon (usually a lock or globe icon) should be next to the URL. |
|
var hint: String
Sets the text to be displayed when the URL of the toolbar is empty. |
|
var hintColor: Int
Sets the colour of the text to be displayed when the URL of the toolbar is empty. |
|
var onUrlClicked: () -> Boolean
Sets a lambda that will be invoked whenever the URL in display mode was clicked. Only if this lambda returns true the toolbar will switch to editing mode. Return false to not switch to editing mode and handle the click manually. |
|
var textColor: Int
Sets the colour of the text for the URL/search term displayed in the toolbar. |
|
var textSize: Float
Sets the size of the text for the URL/search term displayed in the toolbar. |
|
var typeface: Typeface
Sets the typeface of the text for the URL/search term displayed in the toolbar. |
|
var url: String
Sets/Gets the URL to be displayed on the toolbar. |
|
var urlBoxMargin: Int
Gets/Sets horizontal margin of the URL box (surrounding URL and page actions) in display mode. |
|
var urlBoxView: View?
Gets/Sets a custom view that will be drawn as behind the URL and page actions in display mode. |
fun addBrowserAction(action: Action): Unit
Adds an action to be displayed on the right side of the toolbar (outside of the URL bounding box) in display mode. |
|
fun addNavigationAction(: Action): Unit
Adds an action to be display on the far left side of the toolbar. This area is usually used on larger devices for navigation actions like "back" and "forward". |
|
fun addPageAction(action: Action): Unit
Adds an action to be displayed on the right side of the URL in display mode. |
|
fun displayMode(): Unit
Switches to URL displaying mode. |
|
fun displayProgress(progress: Int): Unit
Displays the given loading progress. Expects values in the range 0,100. |
|
fun editMode(): Unit
Switches to URL editing mode. |
|
fun invalidateActions(): Unit
Declare that the actions (navigation actions, browser actions, page actions) have changed and should be updated if needed. |
|
fun onBackPressed(): Boolean
Should be called by an activity when the user pressed the back key of the device. |
|
fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit |
|
fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit |
|
fun setAutocompleteFilter(filter: (String, InlineAutocompleteEditText?) -> Unit): Unit
Sets autocomplete filter to be used in edit mode. |
|
fun setMenuBuilder(: BrowserMenuBuilder): Unit
Sets a BrowserMenuBuilder that will be used to create a menu when the menu button is clicked. The menu button will only be visible if a builder has been set. |
|
fun setOnEditFocusChangeListener(listener: (Boolean) -> Unit): Unit
Sets a listener to be invoked when focus of the URL input view (in edit mode) changed. |
|
fun setOnEditListener(listener: OnEditListener): Unit
Registers the given listener to be invoked when the user edits the URL. |
|
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. |
|
fun setSearchTerms(searchTerms: String): Unit
Displays the currently used search terms as part of this Toolbar. |
|
fun setUrlTextPadding(left: Int = displayToolbar.urlView.paddingLeft, top: Int = displayToolbar.urlView.paddingTop, right: Int = displayToolbar.urlView.paddingRight, bottom: Int = displayToolbar.urlView.paddingBottom): Unit
Sets the padding to be applied to the URL text (in display mode). |
open fun asView(): View
Casts this toolbar to an Android View object. |
val View.isLTR: Boolean
Is the horizontal layout direction of this view from Left to Right? |
|
val View.isRTL: Boolean
Is the horizontal layout direction of this view from Right to Left? |
fun ViewGroup.forEach(action: (View) -> Unit): Unit
Performs the given action on each View in this ViewGroup. |
|
fun View.hideKeyboard(): Unit
Hides the soft input window. |
|
fun View.isGone(): Boolean
Returns true if this view's visibility is set to View.GONE. |
|
fun View.isInvisible(): Boolean
Returns true if this view's visibility is set to View.INVISIBLE. |
|
fun View.isVisible(): Boolean
Returns true if this view's visibility is set to View.VISIBLE. |
|
fun View.setPadding(padding: Padding): Unit
Set a padding using Padding object. |
|
fun View.showKeyboard(flags: Int = InputMethodManager.SHOW_IMPLICIT): Unit
Tries to focus this view and show the soft input window for it. |