Closed Bug 2078300 Opened 1 month ago Closed 1 month ago

[customizable-menu] Handle user interactions in the menu items providers which configures menu items

Categories

(Firefox for Android :: Menu, task)

All
Android
task

Tracking

()

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: petru, Assigned: petru)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][android-core])

Attachments

(2 external files)

Based on:

  • recent work review suggesting to split the menu items interactions handling
  • how big the current MenuMiddleware already is
  • needing to reuse most of the menu items shown in the browser's menu also on home and custom tabs

We should look into refactoring out the current menu items interactions handling from a single place to many.
The most direct split seems to be one to the current *MenuItemProviders which already configure the details of a menu item plus the action dispatched for user interactions. Same providers - one for each menu item - could also handle the user interaction ensuring complete and fully encapsulated menu item UX.

BrowserMenuBuilder used its resolver to build an item's provider both when
combining the items into the menu and, for items expanding to others, again on
every menu update. With the resolver building a new provider on each call, every
update created another "More" provider, starting another collector that ran for
as long as the menu was shown, and used it in place of the one the menu was
built from.

The providers of a menu are now built once by MenuItemsRegistry, together with
the configuration they are for, so that BrowserMenuBuilder and anything else
needing them work with the same instances. This also prepares for letting the
providers handle what happens when their items are clicked.

Moved all the menu items interactions handling from MenuMiddleware to
each of the menu item providers configuring the details of what menu
items to show and what event to be dispatched for the user interaction.
Now they will also handle said event dispatched for user interaction.

MenuMiddleware is left only keeping the menu up to date and passing
events to the menu item providers also knowing how to handle the events.

Pushed by plingurar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e2900f23ee8c https://hg.mozilla.org/integration/autoland/rev/0dc62f7b8063 Build each menu item provider only once r=android-reviewers,giorga https://github.com/mozilla-firefox/firefox/commit/393785436885 https://hg.mozilla.org/integration/autoland/rev/067cb14deb3a Let each menu item provider also handle the interactions with its items r=android-reviewers,giorga
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 159 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: