From e35091e667fad8b6642f1a28b73a7dbf058b31d7 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 6 Feb 2025 09:21:49 +0100 Subject: [PATCH] Replace Android ToSpannableString overload --- .../Extensions/FormattedStringExtensions.cs | 23 +------------------ .../net-android/PublicAPI.Unshipped.txt | 2 ++ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Controls/src/Core/Platform/Android/Extensions/FormattedStringExtensions.cs b/src/Controls/src/Core/Platform/Android/Extensions/FormattedStringExtensions.cs index 65bb15d7fa8d..704f0c2829e5 100644 --- a/src/Controls/src/Core/Platform/Android/Extensions/FormattedStringExtensions.cs +++ b/src/Controls/src/Core/Platform/Android/Extensions/FormattedStringExtensions.cs @@ -14,7 +14,7 @@ namespace Microsoft.Maui.Controls.Platform public static class FormattedStringExtensions { public static SpannableString ToSpannableString(this Label label) - => ToSpannableStringNewWay( + => ToSpannableString( label.FormattedText, label.RequireFontManager(), label.Handler?.MauiContext?.Context, @@ -25,28 +25,7 @@ public static SpannableString ToSpannableString(this Label label) label.TextTransform, label.TextDecorations); - // TODO: NET8 this overload must be removed in net8.0 and replaced with the one below public static SpannableString ToSpannableString( - this FormattedString formattedString, - IFontManager fontManager, - TextPaint? textPaint = null, - Context? context = null, - double defaultLineHeight = 0, - TextAlignment defaultHorizontalAlignment = TextAlignment.Start, - Font? defaultFont = null, - Graphics.Color? defaultColor = null, - TextTransform defaultTextTransform = TextTransform.Default) - => formattedString.ToSpannableStringNewWay( - fontManager, - context, - 0d, - defaultHorizontalAlignment, - defaultFont, - defaultColor, - defaultTextTransform, - TextDecorations.None); - - internal static SpannableString ToSpannableStringNewWay( this FormattedString formattedString, IFontManager fontManager, Context? context = null, diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt index d434dae9bcae..33b34b380989 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -11,6 +11,8 @@ *REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget(T! target) -> void Microsoft.Maui.Controls.StyleableElement.Style.get -> Microsoft.Maui.Controls.Style? +*REMOVED*static Microsoft.Maui.Controls.Platform.FormattedStringExtensions.ToSpannableString(this Microsoft.Maui.Controls.FormattedString! formattedString, Microsoft.Maui.IFontManager! fontManager, Android.Text.TextPaint? textPaint = null, Android.Content.Context? context = null, double defaultLineHeight = 0, Microsoft.Maui.TextAlignment defaultHorizontalAlignment = Microsoft.Maui.TextAlignment.Start, Microsoft.Maui.Font? defaultFont = null, Microsoft.Maui.Graphics.Color? defaultColor = null, Microsoft.Maui.TextTransform defaultTextTransform = Microsoft.Maui.TextTransform.Default) -> Android.Text.SpannableString! +static Microsoft.Maui.Controls.Platform.FormattedStringExtensions.ToSpannableString(this Microsoft.Maui.Controls.FormattedString! formattedString, Microsoft.Maui.IFontManager! fontManager, Android.Content.Context? context = null, double defaultCharacterSpacing = 0, Microsoft.Maui.TextAlignment defaultHorizontalAlignment = Microsoft.Maui.TextAlignment.Start, Microsoft.Maui.Font? defaultFont = null, Microsoft.Maui.Graphics.Color? defaultColor = null, Microsoft.Maui.TextTransform defaultTextTransform = Microsoft.Maui.TextTransform.Default, Microsoft.Maui.TextDecorations defaultTextDecorations = Microsoft.Maui.TextDecorations.None) -> Android.Text.SpannableString! ~Microsoft.Maui.Controls.ResourceDictionary.SetAndCreateSource(System.Uri value) -> void ~Microsoft.Maui.Controls.Internals.TypedBindingBase.UpdateSourceEventName.set -> void ~Microsoft.Maui.Controls.WebViewProcessTerminatedEventArgs.PlatformArgs.get -> Microsoft.Maui.Controls.PlatformWebViewProcessTerminatedEventArgs