Files
tubestation/mobile/android/android-components/components/browser/toolbar
Mugurell 70e4282ec9 [components] For https://github.com/mozilla-mobile/android-components/issues/2930 - Different BrowserToolbar behaviors depending on gestures
We'll now have a more in-depth understanding of user's gestures based on which
we can trigger different BrowserToolbar behaviors depending on if the user is
scrolling or zooming.

The ConstraintLayout parent will still inform us about when the scroll begins
and when the scroll ends but then actually incrementally updating the toolbar's
translation will be done in response to GestureDetector callbacks.
This also allows us to easily differentiate between horizontal and vertical
scrolls and only react for the latter.

If the user's gestures as inferred as zoom gestures (multi-finger scale or
quick-scale) the toolbar should not be animated.
This scenario is though affected by the fact that normally scroll gestures have
a much higher sensitivity (a 1 pixel movement is enough for a gesture to be
considered a scroll gesture) and so it is possible that even in the case of a
desired zoom gesture the scroll callbacks will be fired first.
When the gesture is identified as a zoom gesture we will immediately snap the
toolbar up/down but there might be a minor visual glitch because of this.
In an effort to reduce such races between scroll and zoom gestures I've lowered
the sensitivity of the ScaleDetector, this having the other effect that
multi-finger scrolls must now be more precise. Pinching while zooming will now
more often mean a zoom gesture and not animate the toolbar.
2020-05-12 13:34:17 +03:00
..

Android Components > Browser > Toolbar

A customizable toolbar for browsers.

Usage

Setting up the dependency

Use Gradle to download the library from maven.mozilla.org (Setup repository):

implementation "org.mozilla.components:browser-toolbar:{latest-version}"

Facts

This component emits the following Facts:

Action Item Extras Description
CLICK menu menuExtras The user opened the overflow menu.
COMMIT toolbar commitExtras The user has edited the URL.

menuExtras are additional extras set on the BrowserMenuBuilder passed to the BrowserToolbar (see browser-menu).

commitExtras

Key Type Value
autocomplete Boolean Whether the URL was autocompleted
source String? Which autocomplete list was used

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/