Skip to content

Use Material activity indicators on Android - #4920

Merged
freakboy3742 merged 11 commits into
beeware:mainfrom
kattni:android-material-activityindicator
Dec 4, 2026
Merged

freakboy3742 merged 11 commits into
beeware:mainfrom
kattni:android-material-activityindicator

Conversation

@kattni

@kattni kattni commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Refs #2250.

On Android, ActivityIndicator is now a Material CircularProgressIndicator, so it follows the app's Material 3 theme. It uses the theme's default size (48dp).

  • The intrinsic size was set in native pixels, so on high-density screens the layout gave the indicator more space than it drew in. It's now converted to CSS pixels.
  • The converted size isn't rounded, because the native indicator always draws at its measured size, and rounding up left a gap next to it. This uses the existing rounding=None path in scale_round(), so its # pragma: no cover is removed.

Verified with the full Android testbed on an API 31 emulator (beePhone): 514 passed, 99 skipped, 56 xfailed, 6 xpassed, with 100.0% coverage.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Claude Code (Claude Opus 5.5)

kattni and others added 11 commits November 30, 2026 17:26
Android buttons are now MaterialButtons, so they follow the app's
Material theme. Background colours are applied as a tint.

The Android backend now requires the Material library, and warns at
startup when the app uses a Material 2 theme.
The testbed now uses Theme.Material3.DayNight, the theme Toga's Android
backend requires.
Material 3 is now a requirement of the Android backend as a whole, so the
Button docs don't need to repeat it.
The examples, and the Positron FastAPI bootstrap, used the Material 2
Theme.MaterialComponents.Light.DarkActionBar theme. They now use
Theme.Material3.DayNight, as the testbed does.
A Material button has 24dp of padding at each side, so the fixed 68px width
Toga gave icon buttons cut off the right side of the icon. Measure icon
buttons natively, like text buttons, so the size includes the icon and its
padding, and remove the gap Material leaves between an icon and the text,
which put the icon off center.
Android activity indicators are now CircularProgressIndicators, so they
follow the app's Material 3 theme.

The intrinsic size was set in native pixels rather than CSS pixels, so
on high-density screens the layout gave the indicator more space than
it drew in. It's now converted, and not rounded, because the native
indicator always draws at its measured size, and rounding up would
leave a gap next to it.

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 Looks great - thanks!

@freakboy3742
freakboy3742 merged commit 94d1f57 into beeware:main Dec 4, 2026
161 of 164 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants