beeware / toga

A Python native, OS native GUI toolkit.
https://toga.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
4.35k stars 672 forks source link

Add OptionContainer for Android #2346

Closed mhsmith closed 9 months ago

mhsmith commented 10 months ago

What is the problem or limitation you are having?

Android is now the only one of the main 5 platforms which doesn't support OptionContainer.

Describe the solution you'd like

Last time I looked into this, the recommended API was BottomNavigationView.

It requires an additional Gradle library, as shown here. This should be added to the Briefcase template, and the Toga code should be written such that if the library is missing, it doesn't crash unless the app actually tries to use the widget.

Like iOS, it has a limit of 5 items. Unlike iOS, I don't think it has any built-in overflow mechanism. For the initial implementation, we agreed we can just accept the limit and document it.

freakboy3742 commented 10 months ago

Instead of hard coding in the Android template, would it be worth taking this opportunity to convert the list of library requirements that are in the template into a pyproject.toml configuration item (analogous to system_runtime_requires on linux)? In this case, Material seems like a reasonably common library (as are the others already there), but providing the option to remove libraries (or include other ones) would seem like a worthwhile related change.

mhsmith commented 10 months ago

Makes sense, but since existing apps may automatically update their Toga version on a briefcase update -r without updating anything else, the Toga code should still protect itself against a missing library as noted above.