[cr149][Android] Changes for top toolbar controls visibility

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/3be4aa262c2e4e73d091abf55f1ad055b9d7eddf

commit 3be4aa262c2e4e73d091abf55f1ad055b9d7eddf
Author: Calder Kitagawa <ckitagawa@chromium.org>
Date:   Fri Apr 17 11:02:08 2026 -0700

    [Clank IA] Update control visibility

    Toggle visibility of tab switcher, app menu and optional button using
    toolbar variations.

    Still to be done:
    - Move optional button location
    - Update URL & StatusView location

    Bug: 497898172
    Change-Id: Ied5f17595f38be55f28210682820d8e55825046e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7762379
    Reviewed-by: Sky Malice <skym@chromium.org>
    Reviewed-by: Dan Polanco <polardz@google.com>
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1616699}
This commit is contained in:
Artem Samoilenko
2026-05-22 16:25:13 -04:00
committed by Max Karolinskiy
parent 8af75b3a89
commit 3fda3ea37a
@@ -1742,11 +1742,29 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
maybeHideTopTabSwitcherButton();
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
maybeHideRewardsLayout(MeasureSpec.getSize(widthMeasureSpec));
}
/**
* Re-enforces GONE on the top toolbar's tab switcher button when Brave's tab switcher lives on
* the bottom toolbar. ToolbarPhone.updateButtonVisibility() (and related upstream paths) calls
* setHasSpaceToShow(true) on the tab switcher coordinator, which forces the button VISIBLE and
* overrides the GONE state set in onBottomControlsVisibilityChanged.
*/
private void maybeHideTopTabSwitcherButton() {
if (!isTabSwitcherOnBottomControls()) {
return;
}
View toggleTabStackButton = findViewById(R.id.tab_switcher_button);
if (toggleTabStackButton != null && toggleTabStackButton.getVisibility() != GONE) {
toggleTabStackButton.setVisibility(GONE);
}
}
/**
* Updates the rewards layout visibility on tablet. The layout is shown only when all of the
* following are true: the current tab is not incognito, the toolbar width is at least the