← Back to Pull requests

Use Material buttons on Android, and require a Material 3 theme #4914

Closed
unknown closed this pull request without merging on Dec 02, 2026 07:58 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 22:41 UTC
Author

Refs #2250.

This is the first step in moving Toga's Android backend to Material 3, one widget at a time. It converts Button, and makes the Material library and a Material 3 theme requirements of toga-android. Converting the rest of the widgets will continue under #2250.

Changes

  • On Android, Button is now a com.google.android.material.button.MaterialButton, so it follows the app's Material theme. A background color is applied as a background tint, and TRANSPARENT resets the tint to the theme's default. Widget.set_background_filter() was only used by Button, so it has been removed.

  • toga-android now requires the Material package (com.google.android.material:material:1.12.0 or later) and a Material 3 base theme, such as Theme.Material3.DayNight. If the app's theme is a Material 2 theme (for example Theme.MaterialComponents.Light.DarkActionBar), the app issues a FutureWarning when it starts. There is no Material 2 support code; this is intended to land as part of a major version change. If the Material package is missing, creating a Button raises a RuntimeError, as OptionContainer already does.

  • The testbed's Android base_theme is now Theme.Material3.DayNight.

  • The Android platform docs and the Button docs describe the new requirements.
  • Dependencies

    This PR depends on beeware/briefcase#3168 and beeware/briefcase-android-gradle-template#137, which are both still in review. Together, they give new Briefcase projects a Theme.Material3.DayNight base theme, the Material dependency, and day/night colors. Toga doesn't need them to work: an app that sets a Material 3 base_theme and declares the Material dependency in build_gradle_dependencies works with this PR today, as the testbed does.

    Testing

    Backends exercised: Android, with the full testbed on an API 31 emulator (beePhone, as in CI), using Theme.Material3.DayNight: 514 passed, 99 skipped, 56 xfailed, 6 xpassed, with 100.0% coverage. The core test suite passes with 100% coverage, and pre-commit run --all-files passes.

    The Material 2 warning branch is marked # pragma: no cover, because the testbed can only run with one theme.

    PR Checklist:


    <!--- Go over all the following points, and put an x in all the boxes that apply. -->
  • I will abide by the BeeWare Code of Conduct

  • I have read and have followed the [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) file

  • This PR was generated or assisted using an AI tool

  • <!-- update or delete the next line to reflect your usage -->
    Assisted-by: Claude Code (Claude Opus 5.5)

    Diff: 323 lines (+242 / -81) across 4 files Reviewer: kattni Review duration: 1997m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 323 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.346
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4914"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.0% (MEDIUM) · Higher = larger blast radius
    42.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%
    Repository