This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
325 additions
and
12 deletions.
There are no files selected for viewing
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,40 @@ | ||
using Android.Util; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Internals; | ||
using Xamarin.Forms.Platform.Android; | ||
using AView = Android.Views.View; | ||
|
||
[assembly: ExportEffect(typeof(Xamarin.Forms.ControlGallery.Android.RippleEffect), nameof(Xamarin.Forms.ControlGallery.Android.RippleEffect))] | ||
namespace Xamarin.Forms.ControlGallery.Android | ||
{ | ||
[Preserve(AllMembers = true)] | ||
public class RippleEffect : PlatformEffect | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
try | ||
{ | ||
if (Container is AView view) | ||
{ | ||
view.Clickable = true; | ||
view.Focusable = true; | ||
|
||
using (var outValue = new TypedValue()) | ||
{ | ||
view.Context.Theme.ResolveAttribute(Resource.Attribute.selectableItemBackground, outValue, true); | ||
view.SetBackgroundResource(outValue.ResourceId); | ||
} | ||
} | ||
} | ||
catch | ||
{ | ||
|
||
} | ||
} | ||
|
||
protected override void OnDetached() | ||
{ | ||
|
||
} | ||
} | ||
} |
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
83 changes: 83 additions & 0 deletions
83
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11374.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,83 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:TestContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="using:Xamarin.Forms.Controls" | ||
xmlns:effects="clr-namespace:Xamarin.Forms.Controls.Issues" | ||
mc:Ignorable="d" | ||
Title="Test 11374" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue11374"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Label | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="Swipe an Item to the right or left. If you can open the SwipeView, the test has passed."/> | ||
<ListView | ||
x:Name="ItemsListView" | ||
Grid.Row="1" | ||
ItemsSource="{Binding Items}" | ||
VerticalOptions="FillAndExpand" | ||
HasUnevenRows="true" | ||
SelectionMode="Single" | ||
SeparatorVisibility="None" | ||
CachingStrategy="RecycleElementAndDataTemplate"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<ViewCell Height="64"> | ||
<SwipeView> | ||
<SwipeView.LeftItems> | ||
<SwipeItems | ||
SwipeBehaviorOnInvoked="Close"> | ||
<SwipeItemView> | ||
<Label | ||
Text="Left Swipe" | ||
Padding="25,0,25,0" | ||
VerticalOptions="FillAndExpand" | ||
VerticalTextAlignment="Center"> | ||
</Label> | ||
</SwipeItemView> | ||
</SwipeItems> | ||
</SwipeView.LeftItems> | ||
<SwipeView.RightItems> | ||
<SwipeItems SwipeBehaviorOnInvoked="Close"> | ||
<SwipeItemView> | ||
<Label | ||
Text="Right Swipe" | ||
Padding="25,0,25,0" | ||
VerticalOptions="FillAndExpand" | ||
VerticalTextAlignment="Center"> | ||
</Label> | ||
</SwipeItemView> | ||
</SwipeItems> | ||
</SwipeView.RightItems> | ||
<ContentView | ||
BackgroundColor="White"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
</Grid.ColumnDefinitions> | ||
<Grid.Effects> | ||
<effects:RippleEffect /> | ||
</Grid.Effects> | ||
<StackLayout Padding="10"> | ||
<Label | ||
Text="{Binding .}" | ||
d:Text="{Binding .}" | ||
LineBreakMode="NoWrap" | ||
FontSize="16" /> | ||
</StackLayout> | ||
</Grid> | ||
</ContentView> | ||
</SwipeView> | ||
</ViewCell> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
</Grid> | ||
</local:TestContentPage> |
69 changes: 69 additions & 0 deletions
69
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11374.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,69 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11374, | ||
"[Bug] [Android] SwipeView in ListView is not working with RippleEffect and Release configuration", | ||
PlatformAffected.Android)] | ||
public partial class Issue11374 : TestContentPage | ||
{ | ||
public Issue11374() | ||
{ | ||
#if APP | ||
Device.SetFlags(new List<string> { ExperimentalFlags.SwipeViewExperimental }); | ||
|
||
InitializeComponent(); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
BindingContext = new Issue11374ViewModel(); | ||
} | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class Issue11374ViewModel : BindableObject | ||
{ | ||
public ObservableCollection<string> Items { get; set; } | ||
|
||
public Command LoadItemsCommand { get; set; } | ||
|
||
public Issue11374ViewModel() | ||
{ | ||
LoadItems(); | ||
} | ||
|
||
void LoadItems() | ||
{ | ||
Items = new ObservableCollection<string> | ||
{ | ||
"Item 1", | ||
"Item 2", | ||
"Item 3", | ||
"Item 4", | ||
"Item 5" | ||
}; | ||
} | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class RippleEffect : RoutingEffect | ||
{ | ||
public RippleEffect() : base($"{Effects.ResolutionGroupName}.{nameof(RippleEffect)}") | ||
{ | ||
|
||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11430.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,55 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.Frame)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11430, | ||
"[Bug] [iOS] Button stays in Pressed state if the touch-up event occurs outside", | ||
PlatformAffected.iOS)] | ||
public class Issue11430 : TestContentPage | ||
{ | ||
public Issue11430() | ||
{ | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
Title = "Issue 11430"; | ||
|
||
var layout = new StackLayout(); | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "Tap a Button, drag your finger outside the Button and lift up your finger. If the Button state is Normal, the test has passed." | ||
}; | ||
|
||
var button = new Button | ||
{ | ||
Text = "Click Me" | ||
}; | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(button); | ||
|
||
Content = layout; | ||
|
||
button.Clicked += (sender, args) => | ||
{ | ||
DisplayAlert("Issue 11430", "Button Clicked.", "Ok"); | ||
}; | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9451.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,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Xamarin.Forms.Internals; | ||
using Xamarin.Forms.CustomAttributes; | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 9451, | ||
"[Bug] RelativeLayout Constraint can not go back to zero", PlatformAffected.All)] | ||
public class Issue9451 : TestContentPage | ||
{ | ||
public StackLayout StackLayout { get; set; } | ||
public Button TriggerButton { get; set; } | ||
|
||
protected override void Init() | ||
{ | ||
var relativeLayout = new RelativeLayout() { WidthRequest = 400, HeightRequest = 400 }; | ||
StackLayout = new StackLayout() { BackgroundColor = Color.Red }; | ||
|
||
TriggerButton = new Button() { Text = "Set View Width To Zero" }; | ||
|
||
StackLayout.Children.Add(TriggerButton); | ||
|
||
relativeLayout.Children.Add(StackLayout, | ||
Xamarin.Forms.Constraint.Constant(0), | ||
Xamarin.Forms.Constraint.Constant(0), | ||
Xamarin.Forms.Constraint.RelativeToParent(x => x.Width / 2), | ||
Xamarin.Forms.Constraint.RelativeToParent(y => y.Height)); | ||
|
||
Content = relativeLayout; | ||
} | ||
|
||
protected override void OnAppearing() | ||
{ | ||
base.OnAppearing(); | ||
|
||
TriggerButton.Clicked += Button_Clicked; | ||
} | ||
|
||
protected override void OnDisappearing() | ||
{ | ||
base.OnDisappearing(); | ||
|
||
TriggerButton.Clicked -= Button_Clicked; | ||
} | ||
|
||
private void Button_Clicked(object sender, EventArgs e) | ||
{ | ||
RelativeLayout.SetWidthConstraint(StackLayout, Xamarin.Forms.Constraint.Constant(0.0)); | ||
} | ||
} | ||
} |
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
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
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
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.