diff --git a/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets b/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets index 0fe1df68c9dd..6eee58090437 100644 --- a/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets +++ b/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets @@ -351,6 +351,10 @@ Condition="'$(_EnableMauiAspire)' != ''" Value="$(_EnableMauiAspire)" Trim="true" /> + diff --git a/src/Core/src/Platform/Android/MauiMaterialContextThemeWrapper.cs b/src/Core/src/Platform/Android/MauiMaterialContextThemeWrapper.cs index f2ddde546370..66d0572426c7 100644 --- a/src/Core/src/Platform/Android/MauiMaterialContextThemeWrapper.cs +++ b/src/Core/src/Platform/Android/MauiMaterialContextThemeWrapper.cs @@ -5,7 +5,10 @@ namespace Microsoft.Maui.Platform; internal class MauiMaterialContextThemeWrapper : ContextThemeWrapper { - public MauiMaterialContextThemeWrapper(Context context) : this(context, Resource.Style.Maui_MainTheme_Base) + public MauiMaterialContextThemeWrapper(Context context) + : this(context, RuntimeFeature.IsMaterial3Enabled + ? Resource.Style.Maui_Material3_Theme_Base + : Resource.Style.Maui_MainTheme_Base) { } diff --git a/src/Core/src/Platform/Android/Resources/values/colors-material3.xml b/src/Core/src/Platform/Android/Resources/values/colors-material3.xml new file mode 100644 index 000000000000..37a16d3f5db7 --- /dev/null +++ b/src/Core/src/Platform/Android/Resources/values/colors-material3.xml @@ -0,0 +1,178 @@ + + + + + + #6750A4 + #FFFFFF + #EADDFF + #21005D + + + #625B71 + #FFFFFF + #E8DEF8 + #1D192B + + + #7D5260 + #FFFFFF + #FFD8E4 + #31111D + + + #BA1A1A + #FFDAD6 + #FFFFFF + #410002 + + + #FFFBFE + #1C1B1F + + + #FFFBFE + #1C1B1F + #E7E0EC + #49454F + + + #F3EDF7 + #ECE6F0 + #E6E0E9 + #F7F2FA + #FFFFFF + #FFFBFE + #DDD8E1 + + + #79747E + #CAC4D0 + + + #313033 + #F4EFF4 + #D0BCFF + + + #6750A4 + #000000 + + + #000000 + + + #1A6750A4 + #1F6750A4 + #296750A4 + + #141C1B1F + #1F1C1B1F + #291C1B1F + + + #EADDFF + #21005D + #D0BCFF + #4F378B + + #E8DEF8 + #1D192B + #CCC2DC + #4A4458 + + #FFD8E4 + #31111D + #EFB8C8 + #633B48 + + + + + #D0BCFF + #371E73 + #4F378B + #EADDFF + + + #CCC2DC + #332D41 + #4A4458 + #E8DEF8 + + + #EFB8C8 + #492532 + #633B48 + #FFD8E4 + + + #FFB4AB + #93000A + #690005 + #FFDAD6 + + + #10090D + #E6E1E5 + + + #10090D + #E6E1E5 + #49454F + #CAC4D0 + + + #211F26 + #2B2930 + #36343B + #1D1B20 + #0B0F14 + #3B383E + #141218 + + + #938F99 + #49454F + + + #E6E1E5 + #322F35 + #6750A4 + + + #D0BCFF + #000000 + + + #000000 + + + #1AD0BCFF + #1FD0BCFF + #29D0BCFF + + #14E6E1E5 + #1FE6E1E5 + #29E6E1E5 + + + #EADDFF + #21005D + #D0BCFF + #4F378B + + #E8DEF8 + #1D192B + #CCC2DC + #4A4458 + + #FFD8E4 + #31111D + #EFB8C8 + #633B48 + + + @color/md_theme_light_surface + @color/md_theme_dark_surface + diff --git a/src/Core/src/Platform/Android/Resources/values/styles-material3.xml b/src/Core/src/Platform/Android/Resources/values/styles-material3.xml new file mode 100644 index 000000000000..703fc37ce374 --- /dev/null +++ b/src/Core/src/Platform/Android/Resources/values/styles-material3.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Core/src/RuntimeFeature.cs b/src/Core/src/RuntimeFeature.cs index 4880b94bc743..0bce1aefc61d 100644 --- a/src/Core/src/RuntimeFeature.cs +++ b/src/Core/src/RuntimeFeature.cs @@ -27,6 +27,7 @@ static class RuntimeFeature const bool EnableDiagnosticsByDefault = false; const bool IsMeterSupportedByDefault = true; const bool EnableAspireByDefault = true; + const bool IsMaterial3EnabledByDefault = false; #pragma warning disable IL4000 // Return value does not match FeatureGuardAttribute 'System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute'. #if NET9_0_OR_GREATER @@ -147,6 +148,14 @@ internal set ? isEnabled : EnableAspireByDefault; +#if NET10_0_OR_GREATER + [FeatureSwitchDefinition($"{FeatureSwitchPrefix}.{nameof(IsMaterial3Enabled)}")] +#endif + public static bool IsMaterial3Enabled => + AppContext.TryGetSwitch($"{FeatureSwitchPrefix}.{nameof(IsMaterial3Enabled)}", out bool isEnabled) + ? isEnabled + : IsMaterial3EnabledByDefault; + #pragma warning restore IL4000 } }