-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Android] Fix SwipeView not swiping using Label as direct content #14824
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
48a4f87
Fix Android SwipeView not swiping using Label as Content
jsuarezruiz c07d46c
Merge branch 'main' into fix-14805
jsuarezruiz 4792e4f
Refactoring code
jsuarezruiz b82afa9
Merge branch 'main' into fix-14805
jsuarezruiz c7aa727
Merge branch 'main' into fix-14805
jsuarezruiz 420e8c1
Merge branch 'main' into fix-14805
jsuarezruiz 47f6a30
Merge branch 'main' into fix-14805
jsuarezruiz d72b0b4
Merge branch 'main' into fix-14805
jsuarezruiz eaae1c0
Merge branch 'main' into fix-14805
jsuarezruiz ece5725
Merge branch 'main' into fix-14805
jsuarezruiz a3137dd
Merge branch 'main' into fix-14805
jsuarezruiz 19a75d6
Added sample to validate 6154
jsuarezruiz 5eb9f32
Merge branch 'main' into fix-14805
jsuarezruiz 80d972a
Merge branch 'main' into fix-14805
jsuarezruiz bca73e8
Merge branch 'main' into fix-14805
jsuarezruiz 13e173f
Merge branch 'main' into fix-14805
jsuarezruiz 338088d
Merge branch 'main' into fix-14805
jsuarezruiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...ontrols/samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/CustomSwipeControl.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SwipeView | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Pages.SwipeViewGalleries.CustomSwipeControl"> | ||
<SwipeView.LeftItems> | ||
<SwipeItems | ||
Mode="Reveal"> | ||
<SwipeItem | ||
Text="Test (Ajg)" | ||
BackgroundColor="Green"/> | ||
<SwipeItem | ||
Text="Test (Ajg)" | ||
IconImageSource="calculator.png" | ||
BackgroundColor="Orange"/> | ||
<SwipeItem | ||
Text="Delete" | ||
IconImageSource="coffee.png" | ||
BackgroundColor="Red" | ||
Invoked="OnInvoked"/> | ||
</SwipeItems> | ||
</SwipeView.LeftItems> | ||
<Label | ||
BackgroundColor="LightGray" | ||
HeightRequest="60" | ||
HorizontalTextAlignment="Center" | ||
VerticalTextAlignment="Center" | ||
Text="Swipe Right (Reveal)"/> | ||
</SwipeView> |
14 changes: 14 additions & 0 deletions
14
...rols/samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/CustomSwipeControl.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Pages.SwipeViewGalleries | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Skip)] | ||
public partial class CustomSwipeControl | ||
{ | ||
public CustomSwipeControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/CustomSwipeControlGallery.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?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.Pages.SwipeViewGalleries.CustomSwipeControlGallery" | ||
xmlns:controls="clr-namespace:Maui.Controls.Sample.Pages.SwipeViewGalleries" | ||
Title="Custom SwipeControl SwipeView"> | ||
<ContentPage.Content> | ||
<StackLayout> | ||
<controls:CustomSwipeControl /> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
14 changes: 14 additions & 0 deletions
14
...mples/Controls.Sample/Pages/Controls/SwipeViewGalleries/CustomSwipeControlGallery.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using Microsoft.Maui.Controls.Internals; | ||
|
||
namespace Maui.Controls.Sample.Pages.SwipeViewGalleries | ||
{ | ||
[Preserve(AllMembers = true)] | ||
public partial class CustomSwipeControlGallery | ||
{ | ||
public CustomSwipeControlGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...s/samples/Controls.Sample/Pages/Controls/SwipeViewGalleries/SwipeViewNoLayoutGallery.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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.Pages.SwipeViewGalleries.SwipeViewNoLayoutGallery" | ||
Title="SwipeView without Content Layout"> | ||
<ContentPage.Content> | ||
<StackLayout> | ||
<SwipeView | ||
HorizontalOptions="Center" | ||
VerticalOptions="Center" | ||
Margin="12"> | ||
<SwipeView.RightItems> | ||
<SwipeItems | ||
Mode="Execute"> | ||
<SwipeItem | ||
Text="Delete" | ||
IconImageSource="coffee.png" | ||
BackgroundColor="Red" | ||
Invoked="OnInvoked"/> | ||
</SwipeItems> | ||
</SwipeView.RightItems> | ||
<SwipeView.Content> | ||
<Label | ||
HeightRequest="60" | ||
WidthRequest="300" | ||
BackgroundColor="LightGray" | ||
HorizontalTextAlignment="Center" | ||
VerticalTextAlignment="Center" | ||
Text="Swipe Left (Execute)"/> | ||
</SwipeView.Content> | ||
</SwipeView> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
21 changes: 21 additions & 0 deletions
21
...amples/Controls.Sample/Pages/Controls/SwipeViewGalleries/SwipeViewNoLayoutGallery.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using Microsoft.Maui.Controls.Internals; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Pages.SwipeViewGalleries | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[XamlCompilation(XamlCompilationOptions.Skip)] | ||
public partial class SwipeViewNoLayoutGallery | ||
{ | ||
public SwipeViewNoLayoutGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
async void OnInvoked(object sender, EventArgs e) | ||
{ | ||
await DisplayAlert("SwipeView", "SwipeItem Invoked", "OK"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
'i' is just used to access the index, why don't we use a foreach in the collection? If we are worried about the performance of foreach vs for, we have bigger problems.
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.
Is mostly used to get the child using the
GetChildAt
method.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.
@mandel-macaque's feedback seems to still be valid here, unless I'm missing something
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.
Yes, we can ignore it. Is not a blocker.