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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarTablet.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarTablet.java
index e2751bf67b045c558010ea0d2f57e2c3b7db2077..53023c144a5df7af2a727cf6dfa1b44dfd5d43d2 100644
index e2751bf67b045c558010ea0d2f57e2c3b7db2077..d34673607845e18f4d779a9fc65010784f2710c3 100644
--- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarTablet.java
+++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarTablet.java
@@ -306,6 +306,7 @@ public class ToolbarTablet extends ToolbarLayout implements OnClickListener {
@@ -195,6 +195,7 @@ public class ToolbarTablet extends ToolbarLayout implements OnClickListener {
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.

}

@Override
@@ -306,6 +307,7 @@ public class ToolbarTablet extends ToolbarLayout implements OnClickListener {
mLocationBar.getTabletCoordinator().tintBackground(textBoxColor);
mLocationBar.updateVisualsForState();
setToolbarHairlineColor(color);
Expand Down
Loading