-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for TextAlignment.Justify
- fix
#24376
Add support for TextAlignment.Justify
- fix
#24376
Conversation
Hey there @MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
} | ||
TextAlignment.Center => HorizontalAlignment.Center, | ||
TextAlignment.End => HorizontalAlignment.Right, | ||
TextAlignment.Justify => HorizontalAlignment.Stretch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line
@@ -8,6 +8,7 @@ public enum TextAlignment | |||
/// <include file="../../docs/Microsoft.Maui/TextAlignment.xml" path="//Member[@MemberName='Center']/Docs/*" /> | |||
Center, | |||
/// <include file="../../docs/Microsoft.Maui/TextAlignment.xml" path="//Member[@MemberName='End']/Docs/*" /> | |||
End | |||
End, | |||
Justify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API change
case Microsoft.UI.Xaml.TextAlignment.Justify: | ||
return HorizontalAlignment.Stretch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure if I should do this or not.
b233b4b
to
611ebec
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -40,6 +41,13 @@ public static void UpdateTextAlignment(this EditText view, TextAlignment horizon | |||
view.TextAlignment = horizontal.ToTextAlignment(); | |||
view.Gravity = vertical.ToVerticalGravityFlags(); | |||
} | |||
|
|||
if (OperatingSystem.IsAndroidVersionAtLeast(26)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is not being used inside MAUI and I would evaluate removing it from PublicAPI (or at least mark it as obsolete and remove with .NET10).
public static void UpdateTextAlignment(this EditText view, TextAlignment horizontal, TextAlignment vertical)
Besides that the goal here is to support text alignment on Label
right?
If so, this code should be moved here: https://github.com/dotnet/maui/blob/main/src/Core/src/Platform/Android/TextViewExtensions.cs#L54
If you want to also support Entry
text alignment (I guess so), you can use the above method
internal static void UpdateHorizontalAlignment(this EditText view, TextAlignment alignment, AGravityFlags orMask = AGravityFlags.NoGravity)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I tested moving this into EditText as well but it didn't seem to do anything to EditText unfortunately :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright marked this one obsolete and removed non functional code
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
9e9051d
to
557371b
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Description of Change
Adds support for
TextAlignment.Justify
(or should it beJustified
?).Demo
Android
Windows
iOS
Issues Fixed
Fixes #24373