Skip to content

[cr137][Android] Fix tablet toolbar click event handling #29087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025

Conversation

samartnik
Copy link
Contributor

This regression happened here ac28907

Only onLongClick part was supposed to be removed.

Resolves brave/brave-browser#46110

This regression happened here ac28907

Only `onLongClick` part was supposed to be removed.
@samartnik samartnik self-assigned this May 15, 2025
@samartnik samartnik requested a review from a team as a code owner May 15, 2025 18:37
@samartnik samartnik added CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-ios Do not run CI builds for iOS CI/skip-windows-x64 Do not run CI builds for Windows x64 CI/skip-macos-arm64 Do not run CI builds for macOS arm64 labels May 15, 2025
forward();
RecordUserAction.record("MobileToolbarForward");
}
+ BraveToolbarLayout.class.cast(this).onClickImpl(v);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we subclass ToolbarTablet?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we definitely need to start creating unit tests for these overrides so this kind of thing doesn't happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one in particular is just a revert of the change that wasn't meant to be done during rebase.
Tests would be great, but we don't run them on tablets so this issue probably wouldn't be caught. Robolectric tests would help, but we don't have them running in Brave at the moment.
As for subclassing ToolbarTablet and ToolbarPhone, we can do it, but then we will have to patch (or likely copy over) corresponding xml files, which is also not great, so we have to choose between 2 not great options.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do this pretty cleanly if we change the name of the original class to ToolbarLayoutChromiumImpl and then rename our subclass to to ToolbarLayout so it properly inflates as our class instead of theirs?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we have some robolectric tests, but if not we need to start adding them because we need more tests on android.

Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to fix the regression, but we need to follow up to fix this properly by subclassing ToolbarTablet instead of overriding the behavior by changing the superclass

@samartnik samartnik merged commit 72c836a into master May 16, 2025
19 checks passed
@samartnik samartnik deleted the android_toolbar_tablet_click_regression branch May 16, 2025 13:02
@github-actions github-actions bot added this to the 1.80.x - Nightly milestone May 16, 2025
mkarolin pushed a commit that referenced this pull request May 16, 2025
…ression

[cr137][Android] Fix tablet toolbar click event handling
@brave-builds
Copy link
Collaborator

Released in v1.80.75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-ios Do not run CI builds for iOS CI/skip-macos-arm64 Do not run CI builds for macOS arm64 CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows-x64 Do not run CI builds for Windows x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cr137] Brave Shields and Brave Rewards UI can't be opened/viewed on a Tablet
3 participants