Skip to content

Commit

Permalink
Merge branch 'main' into merge-main-net9
Browse files Browse the repository at this point in the history
# Conflicts:
#	eng/Version.Details.xml
#	src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs
  • Loading branch information
rmarinho committed Sep 24, 2024
2 parents c6ca951 + a4d2290 commit eb3ec76
Show file tree
Hide file tree
Showing 46 changed files with 1,613 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "10.0.0-prerelease.24466.1",
"version": "10.0.0-prerelease.24467.4",
"commands": [
"xharness"
]
Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,17 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>46cfb747b4c22471242dee0d106f5c79cf9fd4c5</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="10.0.0-prerelease.24466.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="10.0.0-prerelease.24467.4">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>f20e52f7731da99588dd6b4f4bd60119f03220a3</Sha>
<Sha>3cfb1a3d86da666fb80ba0adb970525e88339d57</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="10.0.0-prerelease.24466.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="10.0.0-prerelease.24467.4">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>f20e52f7731da99588dd6b4f4bd60119f03220a3</Sha>
<Sha>3cfb1a3d86da666fb80ba0adb970525e88339d57</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="10.0.0-prerelease.24466.1">
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="10.0.0-prerelease.24467.4">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>f20e52f7731da99588dd6b4f4bd60119f03220a3</Sha>
<Sha>3cfb1a3d86da666fb80ba0adb970525e88339d57</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@
<_HarfBuzzSharpVersion>7.3.0.2</_HarfBuzzSharpVersion>
<_SkiaSharpNativeAssetsVersion>0.0.0-commit.7af1d0840a381c0ce7ef2877454a88dbb2949686.1086</_SkiaSharpNativeAssetsVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.114</MicrosoftTemplateEngineTasksVersion>
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>10.0.0-prerelease.24466.1</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>10.0.0-prerelease.24466.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>10.0.0-prerelease.24466.1</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>10.0.0-prerelease.24467.4</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>10.0.0-prerelease.24467.4</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>10.0.0-prerelease.24467.4</MicrosoftDotNetXHarnessCLIVersion>
<TizenUIExtensionsVersion>0.9.2</TizenUIExtensionsVersion>
<SvgSkiaPackageVersion>1.0.0.16</SvgSkiaPackageVersion>
<FizzlerPackageVersion>1.3.0</FizzlerPackageVersion>
Expand Down
12 changes: 11 additions & 1 deletion eng/devices/android.cake
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,17 @@ void PerformCleanupIfNeeded(bool cleanupEnabled)
void SetAndroidEnvironmentVariables(string sdkRoot)
{
// Set up Android SDK environment variables and paths
string[] paths = { $"{sdkRoot}/tools/bin", $"{sdkRoot}/cmdline-tools/latest/bin", $"{sdkRoot}/cmdline-tools/5.0/bin", $"{sdkRoot}/cmdline-tools/7.0/bin", $"{sdkRoot}/platform-tools", $"{sdkRoot}/emulator" };
string[] paths = {
$"{sdkRoot}/tools/bin",
$"{sdkRoot}/cmdline-tools/latest/bin",
$"{sdkRoot}/cmdline-tools/5.0/bin",
$"{sdkRoot}/cmdline-tools/7.0/bin",
$"{sdkRoot}/cmdline-tools/11.0/bin",
$"{sdkRoot}/cmdline-tools/12.0/bin",
$"{sdkRoot}/cmdline-tools/13.0/bin",
$"{sdkRoot}/platform-tools",
$"{sdkRoot}/emulator" };

foreach (var path in paths)
{
SetEnvironmentVariable("PATH", path, prepend: true);
Expand Down
7 changes: 4 additions & 3 deletions src/Controls/src/Core/Button/Button.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ Size ICrossPlatformLayout.CrossPlatformMeasure(double widthConstraint, double he
}
}

// if we are in a scenario with unlimited width and the image is on top or bottom, let's make sure the title is not cut off by ensuring we have enough padding for the image and title
if (padding == ButtonHandler.DefaultPadding
&& image is not null
// if we are in a scenario with unlimited width and the image is on top or bottom,
// of if the horizontalOption is not fill and the image is on top or bottom,
// let's make sure the title is not cut off by ensuring we have enough padding for the image and title.
if (image is not null
&& (widthConstraint == double.PositiveInfinity || button.HorizontalOptions != LayoutOptions.Fill)
&& (layout.Position == ButtonContentLayout.ImagePosition.Top || layout.Position == ButtonContentLayout.ImagePosition.Bottom))
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue19214"
Title="Issue19214">
<Grid RowDefinitions="40,*,*,*" Margin="20">
<ScrollView Background="LightBlue" Padding="10" Grid.Row="1" AutomationId="ScrollView_1">
<VerticalStackLayout>
<Entry Text="Top Scroll" Background="Lightgray" HeightRequest="40" AutomationId="TopEntry_1"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry1" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry2" Background="Lightgray" HeightRequest="40" AutomationId="Entry2_1"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry3" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry4" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry5" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry6" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry7" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry8" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry9" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry10" Background="Lightgray" HeightRequest="40" AutomationId="Entry10_1"/>
<BoxView HeightRequest="40" />

<Entry Text="Bottom!!" Background="Green" HeightRequest="40" AutomationId="BottomEntry_1"/>
</VerticalStackLayout>
</ScrollView>

<ScrollView Background="Lightgreen" Padding="10" Grid.Row="2" AutomationId="ScrollView_2">
<VerticalStackLayout>
<Entry Text="Top Scroll" Background="Lightgray" HeightRequest="40" AutomationId="TopEntry_2"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry1" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry2" Background="Lightgray" HeightRequest="40" AutomationId="Entry2_2"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry3" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry4" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry5" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry6" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry7" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry8" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry9" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry10" Background="Lightgray" HeightRequest="40" AutomationId="Entry10_2"/>
<BoxView HeightRequest="40" />

<Entry Text="Bottom!!" Background="Green" HeightRequest="40" AutomationId="BottomEntry_2"/>
</VerticalStackLayout>
</ScrollView>


<ScrollView Background="pink" Padding="10" Grid.Row="3" AutomationId="ScrollView_3">
<VerticalStackLayout>
<Entry Text="Top Scroll" Background="Lightgray" HeightRequest="40" AutomationId="TopEntry_3"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry1" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry2" Background="Lightgray" HeightRequest="40" AutomationId="Entry2_3"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry3" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry4" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry5" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry6" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry7" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry8" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry9" Background="Lightgray" HeightRequest="40"/>
<BoxView HeightRequest="40" />

<Entry Text="Entry10" Background="Lightgray" HeightRequest="40" AutomationId="Entry10_3"/>
<BoxView HeightRequest="40" />

<Entry Text="Bottom!!" Background="Green" HeightRequest="40" AutomationId="BottomEntry_3"/>
</VerticalStackLayout>
</ScrollView>
</Grid>
</ContentPage>
15 changes: 15 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 19214, "iOS Keyboard Scrolling ContentInset Tests", PlatformAffected.iOS)]
public partial class Issue19214 : ContentPage
{
public Issue19214()
{
InitializeComponent();
}
}
12 changes: 12 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214_2.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue19214_2"
Title="Issue19214_2">
<Grid RowDefinitions="50, 50, *, 50" Margin="30">
<Entry Text="Content before" AutomationId="EntryBefore" FontSize="Large" ReturnType="Next" BackgroundColor="Aquamarine" Grid.Row="0" />
<Label x:Name="CursorHeightTracker" Text="0" AutomationId="CursorHeightTracker" FontSize="Large" BackgroundColor="Aquamarine" Grid.Row="1" />
<Editor x:Name="editor" AutomationId="IssueEditor" FontSize="Large" BackgroundColor="Orange" Grid.Row="2" TextChanged="Editor_TextChanged" />
<Button Text="Erase" Clicked="Button_Clicked" Grid.Row="3"/>
</Grid>
</ContentPage>
72 changes: 72 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214_2.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 19214_2, "iOS Editor Cursor stays above keyboard - Top level Grid", PlatformAffected.iOS)]
public partial class Issue19214_2 : ContentPage
{
public Issue19214_2()
{
InitializeComponent();
}

private void Button_Clicked(object sender, EventArgs e)
{
editor.Text = string.Empty;
}

private void Editor_TextChanged(object sender, TextChangedEventArgs e)
{
if (sender is Editor editor)
{
AddCursorHeightToLabel(editor);
}
}

void AddCursorHeightToLabel (Editor editor)
{
#if IOS
var textInput = editor.Handler.PlatformView as UIKit.UITextView;
var selectedTextRange = textInput?.SelectedTextRange;
var localCursor = selectedTextRange is not null ? textInput?.GetCaretRectForPosition(selectedTextRange.Start) : null;

if (localCursor is CoreGraphics.CGRect local && textInput is not null)
{
var container = GetContainerView(textInput);
var cursorInContainer = container.ConvertRectFromView(local, textInput);
var cursorInWindow = container.ConvertRectToView(cursorInContainer, null);

CursorHeightTracker.Text = cursorInWindow.Y.ToString();
}

}

UIKit.UIView GetContainerView(UIKit.UIView startingPoint)
{
var rootView = FindResponder<Microsoft.Maui.Platform.ContainerViewController>(startingPoint)?.View;

if (rootView is not null)
{
return rootView;
}

return null;
}

T FindResponder<T>(UIKit.UIView view) where T : UIKit.UIResponder
{
var nextResponder = view as UIKit.UIResponder;
while (nextResponder is not null)
{
nextResponder = nextResponder.NextResponder;

if (nextResponder is T responder)
return responder;
}
return null;
#endif
}
}
14 changes: 14 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214_3.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue19214_3"
Title="Issue19214_3">
<ScrollView Margin="30">
<VerticalStackLayout>
<Entry Text="Content before" AutomationId="EntryBefore" FontSize="Large" ReturnType="Next" BackgroundColor="Aquamarine"/>
<Label x:Name="CursorHeightTracker" Text="0" AutomationId="CursorHeightTracker" FontSize="Large" BackgroundColor="Aquamarine" />
<Editor x:Name="editor" HeightRequest="650" AutomationId="IssueEditor" FontSize="Large" BackgroundColor="Orange" TextChanged="Editor_TextChanged" />
<Button Text="Erase" Clicked="Button_Clicked" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
72 changes: 72 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19214_3.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 19214_3, "iOS Editor Cursor stays above keyboard - Top level ScrollView", PlatformAffected.iOS)]
public partial class Issue19214_3 : ContentPage
{
public Issue19214_3()
{
InitializeComponent();
}

private void Button_Clicked(object sender, EventArgs e)
{
editor.Text = string.Empty;
}

private void Editor_TextChanged(object sender, TextChangedEventArgs e)
{
if (sender is Editor editor)
{
AddCursorHeightToLabel(editor);
}
}

void AddCursorHeightToLabel (Editor editor)
{
#if IOS
var textInput = editor.Handler.PlatformView as UIKit.UITextView;
var selectedTextRange = textInput?.SelectedTextRange;
var localCursor = selectedTextRange is not null ? textInput?.GetCaretRectForPosition(selectedTextRange.Start) : null;

if (localCursor is CoreGraphics.CGRect local && textInput is not null)
{
var container = GetContainerView(textInput);
var cursorInContainer = container.ConvertRectFromView(local, textInput);
var cursorInWindow = container.ConvertRectToView(cursorInContainer, null);

CursorHeightTracker.Text = cursorInWindow.Y.ToString();
}

}

UIKit.UIView GetContainerView(UIKit.UIView startingPoint)
{
var rootView = FindResponder<Microsoft.Maui.Platform.ContainerViewController>(startingPoint)?.View;

if (rootView is not null)
{
return rootView;
}

return null;
}

T FindResponder<T>(UIKit.UIView view) where T : UIKit.UIResponder
{
var nextResponder = view as UIKit.UIResponder;
while (nextResponder is not null)
{
nextResponder = nextResponder.NextResponder;

if (nextResponder is T responder)
return responder;
}
return null;
#endif
}
}
Loading

0 comments on commit eb3ec76

Please sign in to comment.