Originally, the listeners that trigger editing mode and the URL bar's context menu were attached to the BrowserToolbar itself. As this doesn't work properly in conjunction with wrapping the URL TextView into a ScrollView, the listeners were moved onto the TextView itself.
Bug 1389164 reduced the height of the TextView in order to better support lightweight themes with the new toolbar design, which in conjunction with the changes to support the ScrollView has the unfortunate side effect of also reducing the URL bar's hit target area.
Therefore, we increase it back to its old levels by using a TouchDelegate on the ScrollView. Because Android's ScrollView implementation doesn't support TouchDelegates, we have to add the missing bits of logic back in from the default View implementation.
MozReview-Commit-ID: 1nTrrNGvBza
Our previous iteration of a more efficient fadingEdge implementation in FadedMultiColorTextView works by blending the text with a chosen colour. By choosing the same colour as the parent view onto which the TextView is placed, it was thus possible to achieve the impression of fading.
With our new URL bar design this is no longer possible quite as easily, since the image used for a lightweight theme will now be displayed behind the URL itself as well. Since the implementation would have also needed more work to make it compatible with scrolling text or being placed in a ScrollView anyway, the fading effect is now achieved directly via the ScrollView instead.
Android's built-in fadingEdge implementation calls Canvas.saveLayer (with CLIP_TO_LAYER_SAVE_FLAG omitted!) during a View's onDraw in order to fade out the contents of its children while preserving the background provided by its parents. This saveLayer call is rather expensive and is quite noticeable on a GPU profile even today.
Therefore, we implement a more efficient variety of fadingEdges that paints over its children's content in onDrawForeground. To avoid any background content from being faded out, the whole view then has to be placed on a separate layer, however this is still much more efficient than calling Canvas.saveLayer and doesn't show up noticeably in a GPU profile.
Prior to Marshmallow, onDrawForeground is not available, so we have to override draw instead in order to be able to paint over the content drawn by the ScrollView's descendants. This means that e.g. scrollbars would be faded out as well, but as we don't intend on showing a scrollbar within the context of this bug, it is an acceptable compromise.
MozReview-Commit-ID: DCDPt6ogs0h
This is more or less a straight copy of our TouchDelegateWithReset class adapted to using HoverEvents instead of TouchEvents.
MozReview-Commit-ID: KtQvf1is5xK
* DrawableWrapper - a class similiar to DrawableWrapper in Android v23.
* ShiftDrawable - provide shif-animation for its child drawable
* AnimatedProgressBar - ProgressBar.setProgress(int, boolean) involved
since API v24. This is an implementation for animation.
MozReview-Commit-ID: HjLAXXQdZKO
We are going to involve new implementation for page loading indicator by
ProgressBar. Add ThemedProgressBar for Private Mode.
MozReview-Commit-ID: 4Bj9mJtlHPM
Add a DoorHanger API that doesn't rely on browser.js/NativeWindow, so we
can use doorhangers for custom tabs and PWA. The API falls back to the
old NativeWindow implementation when dealing with the brower.js window.
MozReview-Commit-ID: 6GksKbLaNAp
* DrawableWrapper - a class similiar to DrawableWrapper in Android v23.
* ShiftDrawable - provide shif-animation for its child drawable
* AnimatedProgressBar - ProgressBar.setProgress(int, boolean) involved
since API v24. This is an implementation for animation.
MozReview-Commit-ID: HjLAXXQdZKO
We are going to involve new implementation for page loading indicator by
ProgressBar. Add ThemedProgressBar for Private Mode.
MozReview-Commit-ID: 4Bj9mJtlHPM
This change is unrelated to this bug.
According to my IDE warning:
```
This custom view should extend android.support.v7.widget.AppCompatImageView
instead.
In order to support features such as tinting, the appcompat library will
automatically load special appcompat replacements for the builtin widgets.
However, this does not work for your custom views.
Instead of extending the android.widget classes directly, you should instead
extend one of the delegate classes in android.support.v7.widget.AppCompat.
```
Seems reasonable and I don't see any documentation telling me not to. :)
MozReview-Commit-ID: H60bYGVgTIT
I verified this fixed the issue by:
- Attaching a debugger and checking against the STR call order (comment 3).
- Ensuring the favicons in the SearchEngineRow looked correct
MozReview-Commit-ID: GJeh3FLim36
onSizeChanged should only be called when the size actually changes. However,
I did notice weird behavior in the debugger where `formatImage` appeared to be
called twice from onSizeChanged, however, I was unable to reproduce this
behavior with log statements.
MozReview-Commit-ID: A5amGqTxv55
These are already present in View.getHeight/Width and:
1) Having duplicated values can lead to bugs
2) Having them around makes it harder to see what's important in this code.
MozReview-Commit-ID: 7IvipoJXmF7
This means we'll at least see a sensible exception, instead of an NPE when
no anchor is set. That makes it easier to debug cases where no anchor was
set (see e.g. the main commit from this bug).
MozReview-Commit-ID: CzsZaHvnZ6y
When a non-restartless add-on is (un)installed or updated, we show a doorhanger prompting the user to restart. Currently, the doorhanger's title is using the default logic for choosing its title, that is using the base domain of the tab the doorhanger is being displayed on.
By chance, when the doorhanger is triggered from about:addons there is no domain to display, so the doorhanger is just displaying the restart notification. If however an add-on is automatically updated while the user is browsing, then the restart prompt will show the domain of the currently open tab in conjunction with the restart message. This can be confusing for the user, as it looks like it was in fact the current page that triggered the restart prompt.
Therefore, we change this behaviour and just show a generic "Add-ons" as title for this case.
MozReview-Commit-ID: 3pMwSiLul99
To create new interface ActionModePresenter, a presenter could to
operate action-mode.
For pre-marshmallow Android version, we use ActionBar to provide UI
action for text-selection. Therefore BrowserApp will implement this
presenter for text-selection.
MozReview-Commit-ID: GdLB3ke2pYe
This patch affects all grided tabs panel layouts: tablets, phones in landscape
mode, and phones in portrait mode with the "Compact tabs" setting on.
MozReview-Commit-ID: 5cqVJA57ARu
In order to allow for a background which merges into a favicon, we
need to allow for solid (non faded) colours. It is simplest to do this
by letting the colour generator (i.e. either the colour extractor,
or the favicon generator) fade the dominant colour as it wishes.
That also means the colour generator can in future choose to
not fade the colour if appropriate.
MozReview-Commit-ID: LsI8PlZsaGn
Convert "Doorhanger:Add" and "Doorhanger:Remove" to bundle events. UI
events are used because the listener performs UI operations. As part of
the refactoring, DoorHangerConfig was refactored to use GeckoBundle, and
due to that change, a lot of other doorhanger-related classes also had
to be refactored to use GeckoBundle.