diff --git a/src/Controls/src/Core/Editor/Editor.Android.cs b/src/Controls/src/Core/Editor/Editor.Android.cs index 851df83ca820..b96d0eff8814 100644 --- a/src/Controls/src/Core/Editor/Editor.Android.cs +++ b/src/Controls/src/Core/Editor/Editor.Android.cs @@ -18,5 +18,22 @@ public static void MapText(IEditorHandler handler, Editor editor) Platform.EditTextExtensions.UpdateText(handler.PlatformView, editor); } + + // TODO: Material3 - make it public in .net 11 + internal static void MapText(EditorHandler2 handler, Editor editor) + { + if (handler.PlatformView is null) + { + return; + } + + if (handler.DataFlowDirection == DataFlowDirection.FromPlatform) + { + Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, editor); + return; + } + + Platform.EditTextExtensions.UpdateText(handler.PlatformView, editor); + } } } diff --git a/src/Controls/src/Core/Editor/Editor.Mapper.cs b/src/Controls/src/Core/Editor/Editor.Mapper.cs index d2dc2b69a706..0258acedebea 100644 --- a/src/Controls/src/Core/Editor/Editor.Mapper.cs +++ b/src/Controls/src/Core/Editor/Editor.Mapper.cs @@ -15,6 +15,16 @@ public partial class Editor EditorHandler.Mapper.ReplaceMapping(nameof(Text), MapText); EditorHandler.Mapper.ReplaceMapping(nameof(TextTransform), MapText); +#if ANDROID + if (RuntimeFeature.IsMaterial3Enabled) + { + EditorHandler2.Mapper.ReplaceMapping(nameof(Text), MapText); + EditorHandler2.Mapper.ReplaceMapping(nameof(TextTransform), MapText); + EditorHandler2.Mapper.AppendToMapping(nameof(VisualElement.IsFocused), InputView.MapIsFocused); + EditorHandler2.CommandMapper.PrependToMapping(nameof(IEditor.Focus), InputView.MapFocus); + } +#endif + #if IOS || ANDROID EditorHandler.Mapper.AppendToMapping(nameof(VisualElement.IsFocused), InputView.MapIsFocused); EditorHandler.Mapper.AppendToMapping(nameof(VisualElement.IsVisible), InputView.MapIsVisible); diff --git a/src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs b/src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs index 22c823e71038..28a3bc2b3abb 100644 --- a/src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs +++ b/src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs @@ -70,6 +70,18 @@ internal static IMauiHandlersCollection AddControlsHandlers(this IMauiHandlersCo handlersCollection.AddHandler(); handlersCollection.AddHandler(); #endif +#if ANDROID + if (RuntimeFeature.IsMaterial3Enabled) + { + handlersCollection.AddHandler(); + } + else + { + handlersCollection.AddHandler(); + } +#else + handlersCollection.AddHandler(); +#endif #if ANDROID if (RuntimeFeature.IsMaterial3Enabled) { @@ -111,7 +123,6 @@ internal static IMauiHandlersCollection AddControlsHandlers(this IMauiHandlersCo handlersCollection.AddHandler(); handlersCollection.AddHandler(); handlersCollection.AddHandler(); - handlersCollection.AddHandler(); handlersCollection.AddHandler(); handlersCollection.AddHandler(); handlersCollection.AddHandler(); diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenFontFamily.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenFontFamily.png new file mode 100644 index 000000000000..10c2e9ddb1c6 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenFontFamily.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenMaxLengthSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenMaxLengthSet.png new file mode 100644 index 000000000000..ed7778662acd Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorCharacterSpacingWhenMaxLengthSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenFlowDirectionSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenFlowDirectionSet.png new file mode 100644 index 000000000000..9d1c6cb28411 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenFlowDirectionSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderColorSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderColorSet.png new file mode 100644 index 000000000000..d7e1c596af3c Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderColorSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderTextSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderTextSet.png new file mode 100644 index 000000000000..479b683085a7 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorControlWhenPlaceholderTextSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentBasedOnCharacterSpacing.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentBasedOnCharacterSpacing.png new file mode 100644 index 000000000000..00c6b4f88b56 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentBasedOnCharacterSpacing.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentWhenVerticalTextAlignmentSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentWhenVerticalTextAlignmentSet.png new file mode 100644 index 000000000000..90e617754ade Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorHorizontalTextAlignmentWhenVerticalTextAlignmentSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWhenFlowDirectionSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWhenFlowDirectionSet.png new file mode 100644 index 000000000000..2070f5d96535 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWhenFlowDirectionSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithCharacterSpacing.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithCharacterSpacing.png new file mode 100644 index 000000000000..9cdae0a1382e Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithCharacterSpacing.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontAttributes.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontAttributes.png new file mode 100644 index 000000000000..87d44a246707 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontAttributes.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontFamily.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontFamily.png new file mode 100644 index 000000000000..b670f774b6f6 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontFamily.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontSize.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontSize.png new file mode 100644 index 000000000000..34bf729a7dfe Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithFontSize.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithHorizontalAlignment.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithHorizontalAlignment.png new file mode 100644 index 000000000000..c00fbfd1436a Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithHorizontalAlignment.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithShadow.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithShadow.png new file mode 100644 index 000000000000..992300cdb23e Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithShadow.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithVerticalAlignment.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithVerticalAlignment.png new file mode 100644 index 000000000000..4a398118852f Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorPlaceholderWithVerticalAlignment.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedHorizontally.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedHorizontally.png new file mode 100644 index 000000000000..61bc9622bab6 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedHorizontally.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedVertically.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedVertically.png new file mode 100644 index 000000000000..9667e458eeed Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenAlingnedVertically.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenCharacterSpacingSetValues.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenCharacterSpacingSetValues.png new file mode 100644 index 000000000000..b62f05a0a781 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenCharacterSpacingSetValues.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontAttributesSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontAttributesSet.png new file mode 100644 index 000000000000..23154e7fcbfc Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontAttributesSet.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontFamilySetValue.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontFamilySetValue.png new file mode 100644 index 000000000000..ed1f07a4eecb Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontFamilySetValue.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontSizeSetCorrectly.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontSizeSetCorrectly.png new file mode 100644 index 000000000000..bfc8b2b7fbbf Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenFontSizeSetCorrectly.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenTextColorSetCorrectly.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenTextColorSetCorrectly.png new file mode 100644 index 000000000000..a89f07711646 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorTextWhenTextColorSetCorrectly.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorVerticalTextAlignmentBasedOnCharacterSpacing.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorVerticalTextAlignmentBasedOnCharacterSpacing.png new file mode 100644 index 000000000000..a31a068511c1 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditorVerticalTextAlignmentBasedOnCharacterSpacing.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditor_WithShadow.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditor_WithShadow.png new file mode 100644 index 000000000000..7073a66a9268 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyEditor_WithShadow.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeDiabled.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeDiabled.png new file mode 100644 index 000000000000..6adf11c37e61 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeDiabled.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeTextChanges.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeTextChanges.png new file mode 100644 index 000000000000..ce29ba8bb959 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorPlaceholderWithAutoSizeTextChanges.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeDisabled.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeDisabled.png new file mode 100644 index 000000000000..5075c0c8fe57 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeDisabled.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeTextChangesSet.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeTextChangesSet.png new file mode 100644 index 000000000000..2609d3b550b7 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3Editor_VerifyzEditorTextWhenAutoSizeTextChangesSet.png differ diff --git a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs index a145948019c1..1d967735cf43 100644 --- a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs +++ b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs @@ -105,6 +105,7 @@ public override string ToString() new GalleryPageFactory(() => new ScrollViewControlPage(), "ScrollView Feature Matrix"), new GalleryPageFactory(() => new GraphicsViewControlPage(), "GraphicsView Feature Matrix"), new GalleryPageFactory(() => new EditorControlPage(), "Editor Feature Matrix"), + new GalleryPageFactory(() => new Material3_EditorControlPage(), "Editor Material3 Feature Matrix"), new GalleryPageFactory(() => new ToolbarFeaturePage(), "Toolbar Feature Matrix"), new GalleryPageFactory(() => new StackLayoutControlPage(), "StackLayout Feature Matrix"), new GalleryPageFactory(() => new AbsoluteLayoutControlPage(), "AbsoluteLayout Feature Matrix"), diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/EditorMaterial3/Material3_EditorControlPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/EditorMaterial3/Material3_EditorControlPage.xaml new file mode 100644 index 000000000000..5901ffe597d7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/EditorMaterial3/Material3_EditorControlPage.xaml @@ -0,0 +1,110 @@ + + +