Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 39a8eb7

Browse files
authored
Merge branch '4.6.0' into fix-4090
2 parents 7659f3b + cd1d95c commit 39a8eb7

File tree

204 files changed

+6434
-913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+6434
-913
lines changed

Stubs/Xamarin.Forms.Platform.cs

-6
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ internal class _ButtonRenderer { }
5454
[RenderWith(typeof(ImageButtonRenderer))]
5555
internal class _ImageButtonRenderer { }
5656

57-
#if __ANDROID__
58-
[RenderWith(typeof(RadioButtonRenderer))]
59-
#elif !TIZEN4_0
6057
[RenderWith(typeof(RadioButtonRenderer))]
61-
#endif
6258
internal class _RadioButtonRenderer { }
6359

6460
[RenderWith (typeof (TableViewRenderer))]
@@ -124,9 +120,7 @@ internal class _FrameRenderer { }
124120
internal class _CheckBoxRenderer { }
125121
#endif
126122

127-
#if !TIZEN4_0
128123
[RenderWith(typeof(IndicatorViewRenderer))]
129-
#endif
130124
internal class _IndicatorViewRenderer { }
131125

132126
#if __IOS__

Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Xamarin.Forms.ControlGallery.Android
1818

1919
[Activity(Label = "Control Gallery", Icon = "@drawable/icon", Theme = "@style/MyTheme",
2020
MainLauncher = true, HardwareAccelerated = true,
21-
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
21+
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.UiMode)]
2222
[IntentFilter(new[] { Intent.ActionView },
2323
Categories = new[]
2424
{
@@ -47,7 +47,7 @@ protected override void OnCreate(Bundle bundle)
4747
// Fake_Flag is here so we can test for flag initialization issues
4848
Forms.SetFlags("Fake_Flag"/*, "CollectionView_Experimental", "Shell_Experimental"*/);
4949
#else
50-
Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental", "MediaElement_Experimental");
50+
Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental", "MediaElement_Experimental", "AppTheme_Experimental");
5151
#endif
5252
Forms.Init(this, bundle);
5353

Xamarin.Forms.ControlGallery.Tizen/ControlGallery.Tizen.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void Main(string[] args)
2222
{
2323
var app = new MainApplication();
2424
FormsMaps.Init("HERE", "write-your-API-key-here");
25-
Forms.SetFlags("CollectionView_Experimental", "Shell_Experimental", "MediaElement_Experimental");
25+
Forms.SetFlags("CollectionView_Experimental", "Shell_Experimental", "MediaElement_Experimental", "IndicatorView_Experimental");
2626
Forms.Init(app);
2727
FormsMaterial.Init();
2828
app.Run(args);

Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
x:Class="Xamarin.Forms.ControlGallery.WindowsUniversal.App"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:Xamarin.Forms.ControlGallery.WindowsUniversal"
6-
RequestedTheme="Light">
5+
xmlns:local="using:Xamarin.Forms.ControlGallery.WindowsUniversal">
76

87
<Application.Resources>
98
<ResourceDictionary>

Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
7070

7171
rootFrame.NavigationFailed += OnNavigationFailed;
7272

73-
Forms.SetFlags("Shell_UWP_Experimental", "SwipeView_Experimental", "MediaElement_Experimental");
73+
Forms.SetFlags("Shell_UWP_Experimental", "SwipeView_Experimental", "MediaElement_Experimental", "AppTheme_Experimental");
7474
Forms.Init (e);
7575
//FormsMaps.Init (Controls.App.Config["UWPMapsAuthKey"]);
7676

Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary
150150
App.IOSVersion = int.Parse(versionPart[0]);
151151

152152
Xamarin.Calabash.Start();
153-
Forms.SetFlags("SwipeView_Experimental", "MediaElement_Experimental");
153+
Forms.SetFlags("SwipeView_Experimental", "MediaElement_Experimental", "AppTheme_Experimental");
154154
Forms.Init();
155155
FormsMaps.Init();
156156
#if __XCODE11__

Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
<Compile Include="CustomRenderers\RoundedLabelRenderer.cs" />
139139
<Compile Include="ApiLabelRenderer.cs" />
140140
<Compile Include="CustomRenderers\CustomSearchBarRenderer.cs" />
141+
<Compile Include="_9767CustomRenderer.cs" />
141142
</ItemGroup>
142143
<ItemGroup>
143144
<ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using CoreAnimation;
2+
using CoreGraphics;
3+
using UIKit;
4+
using Xamarin.Forms;
5+
using Xamarin.Forms.ControlGallery.iOS;
6+
using Xamarin.Forms.Controls.Issues;
7+
using Xamarin.Forms.Platform.iOS;
8+
9+
[assembly: ExportRenderer(typeof(Issue9767NavigationPage), typeof(_9767CustomRenderer))]
10+
namespace Xamarin.Forms.ControlGallery.iOS
11+
{
12+
public class _9767CustomRenderer : NavigationRenderer
13+
{
14+
public _9767CustomRenderer() : base()
15+
{
16+
17+
}
18+
19+
public override void ViewWillAppear(bool animated)
20+
{
21+
base.ViewWillAppear(animated);
22+
23+
UpdateColors();
24+
UpdateGradientView();
25+
}
26+
27+
void UpdateColors()
28+
{
29+
UINavigationBar.Appearance.BarTintColor = UIColor.FromPatternImage(UIImage.FromFile("coffee.png"));
30+
UINavigationBar.Appearance.TintColor = UIColor.Yellow;
31+
UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Blue });
32+
}
33+
34+
void UpdateGradientView()
35+
{
36+
var gradientLayer = new CAGradientLayer
37+
{
38+
Bounds = NavigationBar.Bounds,
39+
Colors = new CGColor[] { Color.Blue.ToCGColor(), Color.Purple.ToCGColor() },
40+
EndPoint = new CGPoint(0.0, 0.5),
41+
StartPoint = new CGPoint(1.0, 0.5)
42+
};
43+
UIGraphics.BeginImageContext(gradientLayer.Bounds.Size);
44+
gradientLayer.RenderInContext(UIGraphics.GetCurrentContext());
45+
UIImage image = UIGraphics.GetImageFromCurrentImageContext();
46+
UIGraphics.EndImageContext();
47+
NavigationBar.SetBackgroundImage(image, UIBarMetrics.Default);
48+
}
49+
}
50+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Github1625.cs

+28-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
#if UITEST
55
using Xamarin.UITest;
66
using NUnit.Framework;
7+
using Xamarin.Forms.Core.UITests;
78
#endif
89

910
namespace Xamarin.Forms.Controls.Issues
1011
{
1112
[Preserve(AllMembers = true)]
1213
[Issue(IssueTracker.Github, 1625, "Slider value is not changed for the first position change", PlatformAffected.Android)]
13-
public class Github1625 : TestContentPage // or TestMasterDetailPage, etc ...
14+
#if UITEST
15+
[NUnit.Framework.Category(UITestCategories.Slider)]
16+
#endif
17+
public class Github1625 : TestContentPage
1418
{
1519
protected override void Init()
1620
{
@@ -19,7 +23,7 @@ protected override void Init()
1923
slider.Minimum = 1;
2024
slider.Value = 5;
2125

22-
var valueLabel = new Label();
26+
var valueLabel = new Label() { AutomationId = "LabelValue" };
2327
var stack = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 15 };
2428

2529
valueLabel.SetBinding(Label.TextProperty, new Binding("Value", source: slider));
@@ -29,8 +33,10 @@ protected override void Init()
2933
var button = new Button
3034
{
3135
Text = "Set to 7",
36+
AutomationId = "SetTo7",
3237
Command = new Command(() => slider.Value = 7)
3338
};
39+
3440
stack.Children.Add(button);
3541

3642
var label = new Label
@@ -39,7 +45,27 @@ protected override void Init()
3945
};
4046
stack.Children.Add(label);
4147

48+
var labelAccessibility = new Label
49+
{
50+
Text = "Turn on a screen reader and use the volume buttons to modify the slider value. Ensure that the slider value on the label updates correctly."
51+
};
52+
stack.Children.Add(labelAccessibility);
53+
4254
Content = stack;
4355
}
56+
57+
58+
59+
#if UITEST
60+
[Test]
61+
public void SettingSliderToSpecificValueWorks()
62+
{
63+
RunningApp.WaitForElement("LabelValue");
64+
Assert.AreEqual("5", RunningApp.WaitForElement("LabelValue")[0].ReadText());
65+
RunningApp.Tap("SetTo7");
66+
Assert.AreEqual("7", RunningApp.WaitForElement("LabelValue")[0].ReadText());
67+
}
68+
#endif
69+
4470
}
4571
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using Xamarin.Forms.CustomAttributes;
5+
using Xamarin.Forms.Internals;
6+
7+
#if UITEST
8+
using Xamarin.Forms.Core.UITests;
9+
using Xamarin.UITest;
10+
using NUnit.Framework;
11+
#endif
12+
13+
namespace Xamarin.Forms.Controls.Issues
14+
{
15+
#if UITEST
16+
[Category(UITestCategories.ManualReview)]
17+
#endif
18+
[Preserve(AllMembers = true)]
19+
[Issue(IssueTracker.Github, 10222, "[CollectionView] ObjectDisposedException if the page is closed during scrolling", PlatformAffected.iOS)]
20+
public class Issue10222 : TestNavigationPage // or TestMasterDetailPage, etc ...
21+
{
22+
protected override void Init()
23+
{
24+
// Initialize ui here instead of ctor
25+
Navigation.PushAsync(new ContentPage
26+
{
27+
Content = new Button
28+
{
29+
AutomationId = "goTo",
30+
Text = "Go",
31+
Command = new Command(async () => await Navigation.PushAsync(new CarouselViewTestPage()))
32+
}
33+
});
34+
}
35+
36+
class CarouselViewTestPage : ContentPage
37+
{
38+
CollectionView cv;
39+
public CarouselViewTestPage()
40+
{
41+
cv = new CollectionView
42+
{
43+
AutomationId = "collectionView",
44+
Margin = new Thickness(0,40),
45+
ItemTemplate = new DataTemplate(() =>
46+
{
47+
var label = new Label
48+
{
49+
HorizontalTextAlignment = TextAlignment.Center,
50+
Margin = new Thickness(0, 100)
51+
};
52+
label.SetBinding(Label.TextProperty, new Binding("."));
53+
return label;
54+
})
55+
};
56+
Content = cv;
57+
InitCV();
58+
}
59+
60+
async void InitCV()
61+
{
62+
var items = new List<string>();
63+
for (int i = 0; i < 10; i++)
64+
{
65+
items.Add($"items{i}");
66+
}
67+
68+
cv.ItemsSource = items;
69+
70+
//give the cv time to draw the items
71+
await Task.Delay(1000);
72+
73+
cv.ScrollTo(items.Count - 1);
74+
75+
//give the cv time to scroll
76+
var rand = new Random();
77+
await Task.Delay(rand.Next(10, 200));
78+
79+
await Navigation.PopAsync(false);
80+
81+
}
82+
}
83+
84+
#if UITEST
85+
[Test]
86+
public void Issue10222Test()
87+
{
88+
RunningApp.WaitForElement(q => q.Marked("goTo"));
89+
RunningApp.Tap("goTo");
90+
RunningApp.WaitForElement(q => q.Marked("collectionView"));
91+
RunningApp.WaitForElement(q => q.Marked("goTo"));
92+
}
93+
#endif
94+
}
95+
}

0 commit comments

Comments
 (0)