[Android] Implemented material3 support for ActivityIndicator#33481
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Material Design 3 support for ActivityIndicator on Android. When Material3 is enabled via the RuntimeFeature.IsMaterial3Enabled feature flag, the framework will use a new MaterialActivityIndicator control that inherits from Google's CircularProgressIndicator instead of the standard Android ProgressBar.
Changes:
- Introduced
MaterialActivityIndicatorcontrol that wraps Material3'sCircularProgressIndicatorwith custom measurement logic to ensure the indicator remains square - Added
ActivityIndicatorHandler2that creates and arranges the Material3 control - Updated handler registration to conditionally use Material3 handler based on
RuntimeFeature.IsMaterial3Enabledflag on Android
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Core/src/Platform/Android/Material3Controls/MaterialActivityIndicator.cs | New Material3 circular progress indicator control with custom measurement to enforce square dimensions |
| src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs | Added Material3 handler variant (ActivityIndicatorHandler2) with custom PlatformArrange for proper centering and sizing |
| src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs | Conditional handler registration: Material3 handler when feature enabled, standard handler otherwise |
src/Core/src/Platform/Android/Material3Controls/MaterialActivityIndicator.cs
Outdated
Show resolved
Hide resolved
src/Core/src/Platform/Android/Material3Controls/MaterialActivityIndicator.cs
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // TODO: material3 - make it public in .net 11 | ||
| internal partial class ActivityIndicatorHandler2 : ActivityIndicatorHandler |
There was a problem hiding this comment.
The class name "ActivityIndicatorHandler2" is unclear and doesn't convey that this is the Material3 implementation. The "Handler2" suffix is used elsewhere in the codebase (CollectionViewHandler2, CarouselViewHandler2) for iOS/MacCatalyst rewrites, not for Material variants. Consider renaming to "MaterialActivityIndicatorHandler" to better indicate its purpose and align with Material naming conventions seen in compatibility renderers.
| internal partial class ActivityIndicatorHandler2 : ActivityIndicatorHandler | |
| internal partial class MaterialActivityIndicatorHandler : ActivityIndicatorHandler |
| internal partial class ActivityIndicatorHandler2 : ActivityIndicatorHandler | ||
| { | ||
| protected override MaterialActivityIndicator CreatePlatformView() | ||
| { | ||
| return new MaterialActivityIndicator(Context) | ||
| { | ||
| Indeterminate = true | ||
| }; | ||
| } | ||
|
|
||
| public override void PlatformArrange(Rect frame) | ||
| { | ||
| if (Context == null || PlatformView == null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Get the child's desired size (what it measured at) | ||
| var desiredWidth = VirtualView?.DesiredSize.Width ?? frame.Width; | ||
| var desiredHeight = VirtualView?.DesiredSize.Height ?? frame.Height; | ||
|
|
||
| // Constrain to desired size (don't let parent stretch us) | ||
| var constrainedWidth = Math.Min(frame.Width, desiredWidth); | ||
| var constrainedHeight = Math.Min(frame.Height, desiredHeight); | ||
|
|
||
| // Create new frame with constrained size, centered if necessary | ||
| var arrangeFrame = new Rect( | ||
| frame.X + (frame.Width - constrainedWidth) / 2, | ||
| frame.Y + (frame.Height - constrainedHeight) / 2, | ||
| constrainedWidth, | ||
| constrainedHeight); | ||
|
|
||
| base.PlatformArrange(arrangeFrame); | ||
| } | ||
| } |
There was a problem hiding this comment.
The new Material3 ActivityIndicatorHandler2 implementation lacks test coverage. The existing ActivityIndicatorHandlerTests.Android.cs only tests the base ActivityIndicatorHandler and expects a ProgressBar as the platform view. Consider adding tests specifically for Material3 mode that verify MaterialActivityIndicator is created when RuntimeFeature.IsMaterial3Enabled is true, and that the PlatformArrange override correctly centers and constrains the indicator.
🤖 AI Summary📊 Expand Full Review🔍 Pre-Flight — Context & Validation📝 Review Session — Updated ActivityIndicatorhandler ·
|
| Comment | Status |
|---|---|
Padding calculation should use Math.Max(horizontal, vertical) instead of one combined expression |
✅ Resolved (outdated) |
| Misleading comment about "Material2-aligned" sizing | ✅ Resolved (outdated) |
ActivityIndicatorHandler2 naming is confusing - should be MaterialActivityIndicatorHandler |
|
| No test coverage for Material3 mode |
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #33481 | Add MaterialActivityIndicator + ActivityIndicatorHandler2, conditional registration | ⏳ PENDING (Gate) | 3 files (+98/-2) | Original PR |
🚦 Gate — Test Verification
📝 Review Session — Updated ActivityIndicatorhandler · a1ac3b0
Result: ❌ FAILED
Platform: android
Mode: No tests found
Summary
No UI tests exist for issue #33479 (TestFilter: "Issue33479") in either:
src/Controls/tests/TestCases.HostApp/Issues/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/
No device tests for MaterialActivityIndicator or ActivityIndicatorHandler2 were found in:
src/Core/tests/DeviceTests/Handlers/ActivityIndicator/
The existing ActivityIndicatorHandlerTests.Android.cs only tests the base ActivityIndicatorHandler (expects ProgressBar as platform view).
Reason for Failure
Tests are absent — the Gate cannot verify that tests catch the bug/feature before the fix and pass with the fix. Per the Gate workflow, this PR cannot proceed until tests are added.
Recommendation
The PR author should add tests. The write-tests-agent can help create appropriate tests:
- A UI test (
Issue33479.cs) that verifies the ActivityIndicator renders with the Material3 style when Material3 is enabled - Or device tests verifying
MaterialActivityIndicatoris used as the platform view whenIsMaterial3Enabledis true
📋 Report — Final Recommendation
📝 Review Session — Updated ActivityIndicatorhandler · a1ac3b0
⚠️ Final Recommendation: REQUEST CHANGES
Summary
PR #33481 implements Material Design 3 support for ActivityIndicator on Android by adding a new MaterialActivityIndicator control and ActivityIndicatorHandler2 (Material3 handler), with conditional handler registration. The implementation is directionally correct, but the PR lacks test coverage, and there is a naming issue with the handler.
Root Cause (Issue #33479)
When Material3 is enabled, the Android ActivityIndicator still uses the legacy ProgressBar-based ActivityIndicatorHandler. The fix introduces MaterialActivityIndicator (wrapping CircularProgressIndicator from Material3 library) and a new handler that creates it as the platform view.
Gate Result: ❌ FAILED — No Tests
No tests exist for this issue. The Gate cannot verify that tests catch the feature behavior. Gate is required to pass before Phase 3 (Fix exploration) can run.
Required Changes
-
Add tests — The PR has no test coverage for the new Material3 behavior. At minimum:
- A UI test (
Issue33479.cs) forTestCases.HostApp+TestCases.Shared.Teststhat verifies the ActivityIndicator renders with Material3 styling when enabled; OR - Device tests in
ActivityIndicatorHandlerTests.Android.csverifying thatMaterialActivityIndicatoris used as the platform view whenRuntimeFeature.IsMaterial3Enabledis true
- A UI test (
-
Rename
ActivityIndicatorHandler2— TheHandler2suffix is reserved by convention for iOS/MacCatalyst rewrites (e.g.,CollectionViewHandler2,CarouselViewHandler2). For Material3 variants, useMaterialActivityIndicatorHandler. The Copilot reviewer flagged this in an unresolved thread.
Positive Aspects
- Conditional handler registration is clean and follows the pattern used by other Material3 controls
- The
MaterialActivityIndicatormeasurement override (OnMeasure) correctly enforces square dimensions - Internal/TODO markers show appropriate awareness that this will be made public in .NET 11
- The
PlatformArrangeoverride in the handler correctly centers the constrained indicator within its allocated frame - Uses
MauiMaterialContextThemeWrapper.Create(context)for proper Material3 theming
Fix Candidates
Phase 3 (Fix exploration) was skipped because Gate ❌ FAILED. The PR's approach cannot be validated without tests.
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #33481 | MaterialActivityIndicator + ActivityIndicatorHandler2 + conditional registration | ❌ Gate failed (no tests) | 3 files | Missing tests, naming issue |
📋 Expand PR Finalization Review
Title: ✅ Good
Current: [Android] Implemented material3 support for ActivityIndicator
Description: ✅ Good
Description needs updates. See details below.
✨ Suggested PR Description
[!NOTE]
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
This pull request adds Material Design 3 styled ActivityIndicator support on Android. When the Material3 feature flag (RuntimeFeature.IsMaterial3Enabled) is enabled, MAUI now uses a new MaterialActivityIndicatorHandler backed by the MDC CircularProgressIndicator component instead of the legacy ProgressBar-based ActivityIndicatorHandler.
Handler registration (AppHostBuilderExtensions.cs):
- On Android with Material3 enabled: registers
MaterialActivityIndicatorHandlerforActivityIndicator - On Android without Material3 / all other platforms: registers classic
ActivityIndicatorHandler
MaterialActivityIndicatorHandler (ActivityIndicatorHandler.Android.cs):
- Extends
ActivityIndicatorHandler - Creates
MaterialActivityIndicator(MDCCircularProgressIndicator) as the platform view withIndeterminate = true - Overrides
PlatformArrangeto constrain the indicator to its desired size and center it within the layout frame, preventing unwanted stretching from parent layouts
MaterialActivityIndicator (Platform/Android/Material3Controls/MaterialActivityIndicator.cs):
- Extends MDC
CircularProgressIndicator - Uses
MauiMaterialContextThemeWrapperso the indicator picks up the app's Material3 theme - Overrides
OnMeasureto enforce a square aspect ratio based onIndicatorSizeplus padding, following Material3 specs
Both new classes are
internalwith aTODO: material3 - make it public in .net 11comment.
Issues Fixed
Fixes #33479
Material3 Spec Reference: Progress Indicators – Material Design 3
Code Review: ⚠️ Issues Found
Code Review: PR #33481
🔴 Critical Issues
1. ActivityIndicatorHandler2 — Misleading Name
File: src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs
Problem: The Handler2 suffix is used elsewhere in MAUI exclusively for iOS/MacCatalyst handler rewrites (CollectionViewHandler2, CarouselViewHandler2). Using it here for a Material3 variant on Android is inconsistent and confusing. An open (unresolved) review comment also flags this.
Recommendation: Rename to MaterialActivityIndicatorHandler.
// Current:
internal class ActivityIndicatorHandler2 : ActivityIndicatorHandler
// Recommended:
internal partial class MaterialActivityIndicatorHandler : ActivityIndicatorHandlerThe description already uses the name MaterialActivityIndicatorHandler, so this rename would also fix the description accuracy issue.
🟡 Suggestions
2. Missing partial keyword on new handler class
File: src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs
Problem: ActivityIndicatorHandler2 is declared as internal class, not internal partial class. Other handlers in MAUI use partial to allow platform-specific extensions. The review comment's suggestion also includes partial.
Recommendation: Add partial:
internal partial class MaterialActivityIndicatorHandler : ActivityIndicatorHandler3. Missing test coverage for Material3 path
File: (no new test file added)
Problem: The new ActivityIndicatorHandler2 / Material3 code path has no unit or device tests. Existing ActivityIndicatorHandlerTests.Android.cs only tests ActivityIndicatorHandler against ProgressBar. An unresolved review comment also flags this.
Recommendation: Add tests that verify:
- When
RuntimeFeature.IsMaterial3Enabledis true,MaterialActivityIndicatoris created as platform view PlatformArrangecorrectly constrains and centers the indicator within the layout frame- Color mapping still works via the base handler
4. Missing newline at end of files
Files:
src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cssrc/Core/src/Platform/Android/Material3Controls/MaterialActivityIndicator.cs
Both files end with } and no trailing newline (\ No newline at end of file in the diff). Standard .NET/MAUI repo style requires a trailing newline.
5. PlatformArrange fallback values
File: src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs
Code:
var desiredWidth = VirtualView?.DesiredSize.Width ?? frame.Width;
var desiredHeight = VirtualView?.DesiredSize.Height ?? frame.Height;Observation: When VirtualView is null, this falls back to the full frame dimensions, which means the centering math (frame.Width - constrainedWidth) / 2) yields 0 and no centering occurs. This is acceptable behavior (null VirtualView means the handler is disconnecting), but a null guard at the top (already present via if (Context == null || PlatformView == null)) doesn't cover VirtualView == null. Low risk, but worth noting.
✅ Looks Good
MauiMaterialContextThemeWrapper.Create(context)— Consistent with other Material3 controls in the repo (e.g.,MaterialButton,MaterialEntry). Correct approach for ensuring MDC theme resources are applied.Indeterminate = trueinCreatePlatformView— Correct forActivityIndicatorsemantics (always spinning, no determinate value).OnMeasuresquare enforcement — Enforcing a square aspect ratio inMaterialActivityIndicator.OnMeasureis the right approach;CircularProgressIndicatorcan otherwise take non-square dimensions if not constrained.#if ANDROIDguard inAppHostBuilderExtensions.cs— Correct pattern for platform-conditional handler registration.internalvisibility with TODO comment — Appropriate staging approach; keeps the API surface small until Material3 is fully public in .NET 11.
a1ac3b0 to
076180e
Compare
|
Addressed all valid concern. |
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jfversluis
left a comment
There was a problem hiding this comment.
Multi-Model Code Review (Sonnet 4.5 / GPT 5.1 / Gemini 3 Pro)
🟠 Incorrect Measurement Logic in MaterialActivityIndicator.OnMeasure
Severity: High | Found by: Sonnet 4.5
The OnMeasure method uses Math.Max of horizontal and vertical padding, then applies that single value to both dimensions. This produces incorrect sizing when horizontal and vertical padding differ:
csharp // Current code var desiredSize = IndicatorSize + Math.Max(PaddingLeft + PaddingRight, PaddingTop + PaddingBottom);
Example: IndicatorSize=48, horizontal padding=20, vertical padding=10 → both width and height report 68, but height should be 58.
Fix: Calculate each dimension independently:
`csharp
var desiredWidth = IndicatorSize + PaddingLeft + PaddingRight;
var desiredHeight = IndicatorSize + PaddingTop + PaddingBottom;
var width = ResolveSize(desiredWidth, widthMeasureSpec);
var height = ResolveSize(desiredHeight, heightMeasureSpec);
var finalSize = Math.Min(width, height);
SetMeasuredDimension(finalSize, finalSize);
`
This ensures padding is properly accounted for in each dimension before constraining to a square.
@jfversluis, Thanks for the suggestion. After reviewing this carefully, the current Math.Max implementation is intentional and correct because ActivityIndicator is always forced to a square (SetMeasuredDimension(finalSize, finalSize)). Example: Independent calculation: This reduces the horizontal padding below what was requested. |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
…#33481) <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes dotnet#33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
<!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
## What's Coming .NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 66 commits with various improvements, bug fixes, and enhancements. ## Activityindicator - [Android] Implemented material3 support for ActivityIndicator by @Dhivya-SF4094 in #33481 <details> <summary>🔧 Fixes</summary> - [Implement material3 support for ActivityIndicator](#33479) </details> - [iOS] Fix: ActivityIndicator IsRunning ignores IsVisible when set to true by @bhavanesh2001 in #28983 <details> <summary>🔧 Fixes</summary> - [[iOS] [ActivityIndicator] `IsRunning` ignores `IsVisible` when set to `true`](#28968) </details> ## Button - [iOS] Button RTL text and image overlap - fix by @kubaflo in #29041 ## Checkbox - [iOS/MacCatalyst] Fix CheckBox foreground color not resetting when set to null by @Ahamed-Ali in #34284 <details> <summary>🔧 Fixes</summary> - [[iOS] Color of the checkBox control is not properly worked on dynamic scenarios](#34278) </details> ## CollectionView - [iOS] Fix: CollectionView does not clear selection when SelectedItem is set to null by @Tamilarasan-Paranthaman in #30420 <details> <summary>🔧 Fixes</summary> - [CollectionView not being able to remove selected item highlight on iOS](#30363) - [[MAUI] Select items traces are preserved](#26187) </details> - [iOS] CV2 ItemsLayout update by @kubaflo in #28675 <details> <summary>🔧 Fixes</summary> - [CollectionView CollectionViewHandler2 doesnt change ItemsLayout on DataTrigger](#28656) - [iOS CollectionView doesn't respect a change to ItemsLayout when using Items2.CollectionViewHandler2](#31259) </details> - [iOS][CV2] Fix CollectionView renders large empty space at bottom of view by @devanathan-vaithiyanathan in #31215 <details> <summary>🔧 Fixes</summary> - [[iOS] [MacCatalyst] CollectionView renders large empty space at bottom of view](#17799) - [[iOS/Mac] CollectionView2 EmptyView takes up large horizontal space even when the content is small](#33201) </details> - [iOS] Fixed issue where group Header/Footer template was set to all items when IsGrouped was true for an ObservableCollection by @Tamilarasan-Paranthaman in #29144 <details> <summary>🔧 Fixes</summary> - [[iOS] Group Header/Footer Repeated for All Items When IsGrouped is True for ObservableCollection in CollectionView](#29141) </details> - [Android] Fix CollectionView selection crash with HeaderTemplate by @NirmalKumarYuvaraj in #34275 <details> <summary>🔧 Fixes</summary> - [[Bug] [Android] System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index](#34247) </details> ## DateTimePicker - [iOS] Fix TimePicker AM/PM frequently changes when the app is closed and reopened by @devanathan-vaithiyanathan in #31066 <details> <summary>🔧 Fixes</summary> - [[iOS] TimePicker AM/PM frequently changes when the app is closed and reopened](#30837) - [Maui 10 iOS TimePicker Strange Characters in place of AM/PM](#33722) </details> - Android TimePicker ignores 24 hour system setting when using Format Property - fix by @kubaflo in #28797 <details> <summary>🔧 Fixes</summary> - [Android TimePicker ignores 24 hour system setting when using Format Property](#28784) </details> ## Drawing - [iOS, Mac, Windows] GraphicsView: Fix Background/BackgroundColor not updating by @NirmalKumarYuvaraj in #31254 <details> <summary>🔧 Fixes</summary> - [[iOS, Mac, Windows] GraphicsView does not change the Background/BackgroundColor](#31239) </details> - [iOS] GraphicsView DrawString - fix by @kubaflo in #26304 <details> <summary>🔧 Fixes</summary> - [DrawString not rendering in iOS.](#24450) - [GraphicsView DrawString not rendering in iOS](#8486) - [DrawString doesn't work on maccatalyst](#4993) </details> - [Android] - Fix Shadow Rendering For Transparent Fill, Stroke (Lines), and Text on Shapes by @prakashKannanSf3972 in #29528 <details> <summary>🔧 Fixes</summary> - [Ellipse Transparency Not Rendered When Drawing Arc Inside the Ellipse Using GraphicsView on Android](#29394) </details> - Revert "[iOS, Mac, Windows] GraphicsView: Fix Background/BackgroundColor not updating (#31254)" by @Ahamed-Ali via @Copilot in #34508 ## Entry - [iOS 26] Fix Entry MaxLength not enforced due to new multi-range delegate by @kubaflo in #32045 <details> <summary>🔧 Fixes</summary> - [iOS 26 - The MaxLength property value is not respected on an Entry control.](#32016) - [.NET MAUI Entry Maximum Length not working on iOS and macOS](#33316) </details> - [iOS] Fixed Entry with IsPassword toggling loses previously entered text by @SubhikshaSf4851 in #30572 <details> <summary>🔧 Fixes</summary> - [Entry with IsPassword toggling loses previously entered text on iOS when IsPassword is re-enabled](#30085) </details> ## Essentials - Fix for FilePicker PickMultipleAsync nullable reference type by @SuthiYuvaraj in #33163 <details> <summary>🔧 Fixes</summary> - [FilePicker PickMultipleAsync nullable reference type](#33114) </details> - Replace deprecated NetworkReachability with NWPathMonitor on iOS/macOS by @jfversluis via @Copilot in #32354 <details> <summary>🔧 Fixes</summary> - [NetworkReachability is obsolete on iOS/maccatalyst 17.4+](#32312) - [Use NWPathMonitor on iOS for Essentials Connectivity](#2574) </details> ## Essentials Connectivity - Update Android Connectivity implementation to use modern APIs by @jfversluis via @Copilot in #30348 <details> <summary>🔧 Fixes</summary> - [Update the Android Connectivity implementation to user modern APIs](#30347) </details> ## Flyout - [iOS] Fixed Flyout icon not updating when root page changes using InsertPageBefore by @Vignesh-SF3580 in #29924 <details> <summary>🔧 Fixes</summary> - [[iOS] Flyout icon not replaced by back button when root page is changed using InsertPageBefore](#29921) </details> ## Flyoutpage - [iOS] Flyout Items Not Displayed in RightToLeft FlowDirection in Landscape - fix by @kubaflo in #26762 <details> <summary>🔧 Fixes</summary> - [Flyout Items Not Displayed in RightToLeft FlowDirection on iOS in Landscape Orientation and Hamburger Icon Positioned Incorrectly](#26726) </details> ## Image - [Android] Implemented Material3 support for Image by @Dhivya-SF4094 in #33661 <details> <summary>🔧 Fixes</summary> - [Implement Material3 support for Image](#33660) </details> ## Keyboard - [iOS] Fix gap at top of view after rotating device while Entry keyboard is visible by @praveenkumarkarunanithi in #34328 <details> <summary>🔧 Fixes</summary> - [Focusing and entering texts on entry control causes a gap at the top after rotating simulator.](#33407) </details> ## Label - [Android] Support for images inside HTML label by @kubaflo in #21679 <details> <summary>🔧 Fixes</summary> - [Label with HTML TextType does not display images on Android](#21044) </details> - [fix] ContentLabel Moved to a nested class to prevent CS0122 in external source generators by @SubhikshaSf4851 in #34514 <details> <summary>🔧 Fixes</summary> - [[MAUI] Building Maui App with sample content results CS0122 errors.](#34512) </details> ## Layout - Optimize ordering of children in Flex layout by @symbiogenesis in #21961 - [Android] Fix control size properties not available during Loaded event by @Vignesh-SF3580 in #31590 <details> <summary>🔧 Fixes</summary> - [CollectionView on Android does not provide height, width, logical children once loaded, works fine on Windows](#14364) - [Control's Loaded event invokes before calling its measure override method.](#14160) </details> ## Mediapicker - [iOS/Android] MediaPicker: Fix image orientation when RotateImage=true by @michalpobuta in #33892 <details> <summary>🔧 Fixes</summary> - [MediaPicker.PickPhotosAsync does not preserve image orientation](#32650) </details> ## Modal - [Windows] Fix modal page keyboard focus not shifting to newly opened modal by @jfversluis in #34212 <details> <summary>🔧 Fixes</summary> - [Keyboard focus does not shift to a newly opened modal page: Pressing enter clicks the button on the page beneath the modal page](#22938) </details> ## Navigation - [iOS26] Apply view margins in title view by @kubaflo in #32205 <details> <summary>🔧 Fixes</summary> - [NavigationPage TitleView iOS 26](#32200) </details> - [iOS] System.NullReferenceException at NavigationRenderer.SetStatusBarStyle() by @kubaflo in #29564 <details> <summary>🔧 Fixes</summary> - [System.NullReferenceException at NavigationRenderer.SetStatusBarStyle()](#29535) </details> - [iOS 26] Fix back button color not applied for NavigationPage by @Shalini-Ashokan in #34326 <details> <summary>🔧 Fixes</summary> - [[iOS] Color not applied to the Back button text or image on iOS 26](#33966) </details> ## Picker - Fix Picker layout on Mac Catalyst 26+ by @kubaflo in #33146 <details> <summary>🔧 Fixes</summary> - [[MacOS 26] Text on picker options are not centered on macOS 26.1](#33229) </details> ## Progressbar - [Android] Implemented Material3 support for ProgressBar by @SyedAbdulAzeemSF4852 in #33926 <details> <summary>🔧 Fixes</summary> - [Implement Material3 support for Progressbar](#33925) </details> ## RadioButton - [iOS, Mac] Fix for RadioButton TextColor for plain Content not working by @HarishwaranVijayakumar in #31940 <details> <summary>🔧 Fixes</summary> - [RadioButton: TextColor for plain Content not working on iOS](#18011) </details> - [All Platforms] Fix RadioButton warning when ControlTemplate is set with View content by @kubaflo in #33839 <details> <summary>🔧 Fixes</summary> - [Seeking clarification on RadioButton + ControlTemplate + Content documentation](#33829) </details> - Visual state change for disabled RadioButton by @kubaflo in #23471 <details> <summary>🔧 Fixes</summary> - [RadioButton disabled UI issue - iOS](#18668) </details> ## SafeArea - [Android] Fix for TabbedPage BottomNavigation BarBackgroundColor not extending to system navigation bar by @praveenkumarkarunanithi in #33428 <details> <summary>🔧 Fixes</summary> - [[Android] TabbedPage BottomNavigation BarBackgroundColor does not extend to system navigation bar area in Edge-to-Edge mode](#33344) </details> ## ScrollView - [Android] ScrollView: Fix HorizontalScrollBarVisibility not updating immediately at runtime by @SubhikshaSf4851 in #33528 <details> <summary>🔧 Fixes</summary> - [Runtime Scrollbar visibility not updating correctly on Android and macOS platforms.](#33400) </details> - Fixed crash when calling ItemsView.ScrollTo on unloaded CollectionView by @kubaflo in #25444 <details> <summary>🔧 Fixes</summary> - [App crashes when calling ItemsView.ScrollTo on unloaded CollectionView](#23014) </details> ## Shell - [Shell] Update logic for iOS large title display in ShellItemRenderer by @kubaflo in #33246 - [iOS][Shell] Fix navigation lifecycle and back button for More tab (>5 tabs) by @kubaflo in #27932 <details> <summary>🔧 Fixes</summary> - [OnAppearing and OnNavigatedTo does not work when using extended Tabbar (tabbar with more than 5 tabs) on IOS.](#27799) - [Shell.BackButtonBehavior does not work when using extended Tabbar (tabbar with more than 5 tabs)on IOS.](#27800) - [Shell TabBar More button causes ViewModel command binding disconnection on back navigation](#30862) - [Content page onappearing not firing if tabs are on the more tab on IOS](#31166) </details> - [iOS 26] Fix tab bar ghosting when navigating from modal to tabbed Shell content by @SubhikshaSf4851 in #34254 <details> <summary>🔧 Fixes</summary> - [[iOS] Tab bar ghosting issue on iOS 26 (liquid glass)](#34143) </details> - Fix for Shell tab visibility not updating when navigating back multiple pages by @BagavathiPerumal in #34403 <details> <summary>🔧 Fixes</summary> - [Changing Shell Tab Visibility when navigating back multiple pages ignores Shell Tab Visibility](#33351) </details> - [iOS/Mac] Fixed OnBackButtonPressed not firing for Shell Navigation Bar Button by @Dhivya-SF4094 in #34401 <details> <summary>🔧 Fixes</summary> - [[iOS] OnBackButtonPressed not firing for Shell Navigation Bar button](#34190) </details> ## Slider - [iOS] Fix for Slider ThumbImageSource is not centered properly on iOS 26 by @HarishwaranVijayakumar in #34019 <details> <summary>🔧 Fixes</summary> - [[iOS 26] Slider ThumbImageSource is not centered properly](#33967) </details> - [Android] Fix improper rendering of ThumbimageSource in Slider by @NirmalKumarYuvaraj in #34064 <details> <summary>🔧 Fixes</summary> - [[Slider] MAUI Slider thumb image is big on android](#13258) </details> ## Stepper - [iOS] Fix Stepper layout overlap in landscape on iOS 26 by @Vignesh-SF3580 in #34325 <details> <summary>🔧 Fixes</summary> - [[.NET10] D10 - Customize cursor position - Rotating simulator makes the button and label overlap](#34273) </details> ## SwipeView - [iOS] SwipeView: Honor FontImageSource.Color in SwipeItem icon by @kubaflo in #27389 <details> <summary>🔧 Fixes</summary> - [[iOS] SwipeView: SwipeItem.IconImageSource.FontImageSource color value not honored](#27377) </details> ## Switch - [Android] Fix Switch thumb shadow missing when ThumbColor is set by @Shalini-Ashokan in #33960 <details> <summary>🔧 Fixes</summary> - [Android Switch Control Thumb Shadow](#19676) </details> ## Toolbar - [iOS/Mac Catalyst 26] Fix Shell.ForegroundColor not applied to ToolbarItems by @SyedAbdulAzeemSF4852 in #34085 <details> <summary>🔧 Fixes</summary> - [[iOS26] Shell.ForegroundColor is not applied to ToolbarItems](#34083) </details> - [Android] VoiceOver on Toolbar Item by @kubaflo in #29596 <details> <summary>🔧 Fixes</summary> - [VoiceOver on Toolbar Item](#29573) - [SemanticProperties do not work on ToolbarItems](#23623) </details> <details> <summary>🧪 Testing (11)</summary> - [Testing] Additional Feature Matrix Test Cases for CollectionView by @TamilarasanSF4853 in #32432 - [Testing] Feature Matrix UITest Cases for VisualStateManager by @LogishaSelvarajSF4525 in #34146 - [Testing] Feature Matrix UITest Cases for Clip by @TamilarasanSF4853 in #34121 - [Testing] Feature matrix UITest Cases for Map Control by @HarishKumarSF4517 in #31656 - [Testing] Feature matrix UITest Cases for Visual Transform Control by @HarishKumarSF4517 in #32799 - [Testing] Feature Matrix UITest Cases for Shell Pages by @NafeelaNazhir in #33945 - [Testing] Feature Matrix UITest Cases for Triggers by @HarishKumarSF4517 in #34152 - [Testing] Refactoring Feature Matrix UITest Cases for CheckBox Control by @LogishaSelvarajSF4525 in #34283 - Resolve UI test Build Sample failures - Candidate March 16 by @Ahamed-Ali in #34442 - Fix the failures in the Candidate branch- March 16 by @Ahamed-Ali in #34453 <details> <summary>🔧 Fixes</summary> - [March 16th, Candidate](#34437) </details> - Fixed the iOS 18.5 Candidate failures (March 16,2026) by @Ahamed-Ali in #34593 <details> <summary>🔧 Fixes</summary> - [March 16th, Candidate](#34437) </details> </details> <details> <summary>📦 Other (2)</summary> - Fixed candidate test failures caused by PR #33428. by @Ahamed-Ali in #34515 <details> <summary>🔧 Fixes</summary> - [[.NET10] On Android, there's a big space at the top for I, M and N2 & N3](#34509) </details> - Revert "[iOS] Button RTL text and image overlap - fix (#29041)" in b0497af </details> <details> <summary>📝 Issue References</summary> Fixes #2574, Fixes #4993, Fixes #8486, Fixes #13258, Fixes #14160, Fixes #14364, Fixes #17799, Fixes #18011, Fixes #18668, Fixes #19676, Fixes #21044, Fixes #22938, Fixes #23014, Fixes #23623, Fixes #24450, Fixes #26187, Fixes #26726, Fixes #27377, Fixes #27799, Fixes #27800, Fixes #28656, Fixes #28784, Fixes #28968, Fixes #29141, Fixes #29394, Fixes #29535, Fixes #29573, Fixes #29921, Fixes #30085, Fixes #30347, Fixes #30363, Fixes #30837, Fixes #30862, Fixes #31166, Fixes #31239, Fixes #31259, Fixes #32016, Fixes #32200, Fixes #32312, Fixes #32650, Fixes #33114, Fixes #33201, Fixes #33229, Fixes #33316, Fixes #33344, Fixes #33351, Fixes #33400, Fixes #33407, Fixes #33479, Fixes #33660, Fixes #33722, Fixes #33829, Fixes #33925, Fixes #33966, Fixes #33967, Fixes #34083, Fixes #34143, Fixes #34190, Fixes #34247, Fixes #34273, Fixes #34278, Fixes #34437, Fixes #34509, Fixes #34512 </details> **Full Changelog**: main...inflight/candidate
…#33481) <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ### Description of Change This pull request introduces support for a Material Design 3 styled `ActivityIndicator` on Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of a `MaterialActivityIndicatorHandler`, and the addition of a custom `MaterialActivityIndicator` control for Android. **Material3 ActivityIndicator support for Android:** * Added a new `MaterialActivityIndicatorHandler` class that extends `ActivityIndicatorHandler` and creates a `MaterialActivityIndicator` (the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering. * Implemented the `MaterialActivityIndicator` control in `MaterialActivityIndicator.cs`, inheriting from `CircularProgressIndicator` and overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines. **Handler registration logic:** * Updated the `AddControlsHandlers` extension method to conditionally register either `MaterialActivityIndicatorHandler` or the classic `ActivityIndicatorHandler` for `ActivityIndicator`, based on whether Material3 is enabled on Android. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes dotnet#33479 **Material3 Spec** [ActivityIndicator](https://m3.material.io/components/progress-indicators/specs) ### Output Screenshot | Material 2 | Material 3 | |---------|--------| | <video height=600 width=300 src="https://github.com/user-attachments/assets/23d67157-b19f-4b5d-b21d-4e50c45f288f"> | <video height=600 width=300 src="https://github.com/user-attachments/assets/6a5de984-6407-4a5c-b60b-09e9fc16342a"> |
Description of Change
This pull request introduces support for a Material Design 3 styled
ActivityIndicatoron Android, allowing the app to use the new Material component when the Material3 feature is enabled. The main changes involve conditional registration of a new handler, the implementation of aMaterialActivityIndicatorHandler, and the addition of a customMaterialActivityIndicatorcontrol for Android.Material3 ActivityIndicator support for Android:
MaterialActivityIndicatorHandlerclass that extendsActivityIndicatorHandlerand creates aMaterialActivityIndicator(the new Material3 control) as its platform view. It also customizes layout behavior to ensure proper sizing and centering.MaterialActivityIndicatorcontrol inMaterialActivityIndicator.cs, inheriting fromCircularProgressIndicatorand overriding measurement logic to ensure the indicator remains square and properly sized according to Material guidelines.Handler registration logic:
AddControlsHandlersextension method to conditionally register eitherMaterialActivityIndicatorHandleror the classicActivityIndicatorHandlerforActivityIndicator, based on whether Material3 is enabled on Android.Issues Fixed
Fixes #33479
Material3 Spec ActivityIndicator
Output Screenshot
Material2_ActivityIndicator.mov
Material3_ActivityIndicator.mov