This commit is contained in:
Rui Marinho 2018-12-09 01:16:23 +00:00
Родитель f099097b23 97206c235c
Коммит 4fd2d6b45b
55 изменённых файлов: 738 добавлений и 445 удалений

Просмотреть файл

@ -120,10 +120,14 @@ echo foo > Xamarin.Forms.Platform.UAP\bin\debug\MasterDetailControlStyle.xbf
echo foo > Xamarin.Forms.Platform.UAP\bin\debug\PageControlStyle.xbf
echo foo > Xamarin.Forms.Platform.UAP\bin\debug\TabbedPageStyle.xbf
echo foo > Xamarin.Forms.Platform.UAP\bin\debug\FormsEmbeddedPageWrapper.xbf
echo foo > Xamarin.Forms.Platform.UAP\bin\debug\StepperControl.xbf
mkdir Xamarin.Forms.Platform.UAP\bin\debug\Items
echo foo > Xamarin.Forms.Platform.UAP\bin\debug\Items\ItemsViewStyles.xbf
if "%1" == "droid" (
%NUGET_EXE% restore .xamarin.forms.android.nuget.sln
msbuild /v:m /p:platform="any cpu" /p:WarningLevel=0 .xamarin.forms.android.nuget.sln
msbuild /v:m /p:platform="any cpu" /p:WarningLevel=0 /p:CreateAllAndroidTargets=true .xamarin.forms.android.nuget.sln
)
if "%1" == "ios" (
%NUGET_EXE% restore .xamarin.forms.ios.nuget.sln
@ -143,7 +147,7 @@ if "%1" == "uap" (
if "%1" == "all" (
%NUGET_EXE% restore .xamarin.forms.sln
msbuild /v:m /p:platform="any cpu" .xamarin.forms.uap.nuget.sln /t:restore
msbuild /v:m /p:platform="any cpu" /p:WarningLevel=0 .xamarin.forms.nuget.sln
msbuild /v:m /p:platform="any cpu" /p:WarningLevel=0 /p:CreateAllAndroidTargets=true .xamarin.forms.nuget.sln
)
if "%DEBUG_VERSION%"=="" set DEBUG_VERSION=0

Просмотреть файл

@ -128,14 +128,14 @@
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.Pdb.dll" target="build\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.Rocks.dll" target="build\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\System.CodeDom.dll" target="build\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Xamarin.Forms.Build.Tasks.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Xamarin.Forms.Core.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Xamarin.Forms.Xaml.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Mono.Cecil.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Mono.Cecil.Mdb.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Mono.Cecil.Pdb.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\Mono.Cecil.Rocks.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net461\System.CodeDom.dll" target="build\net461" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Build.Tasks.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Core.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Xaml.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Mdb.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Pdb.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Rocks.dll" target="build\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\System.ValueTuple.dll" target="build\net46" />
<!-- Xaml Design-time Stuff -->
<file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\netstandard2.0\Design" />

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<_XFBuildTasksLocation Condition="'$(_XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)netstandard2.0\</_XFBuildTasksLocation>
<_XFBuildTasksLocation Condition="'$(_XFBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory)net461\</_XFBuildTasksLocation>
<_XFBuildTasksLocation Condition="'$(_XFBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory)net46\</_XFBuildTasksLocation>
</PropertyGroup>
<UsingTask TaskName="Xamarin.Forms.Build.Tasks.XamlGTask" AssemblyFile="$(_XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll" />

7
Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
</Project>

Просмотреть файл

@ -31,13 +31,7 @@
<ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
</ItemGroup>
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>
</Project>

Просмотреть файл

@ -1 +1 @@
3.4.0
3.5.0

Просмотреть файл

@ -375,11 +375,6 @@
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>
</Project>

Просмотреть файл

@ -165,12 +165,6 @@
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />

Просмотреть файл

@ -137,11 +137,6 @@
<PackageReference Include="Xamarin.iOS.MaterialComponents" Version="60.1.0" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>

Просмотреть файл

@ -27,13 +27,6 @@
<ProjectReference Include="..\..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj" />
<ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
</ItemGroup>
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>
</Project>

@ -1 +1 @@
Subproject commit 1821d28a3ae711cffb7721ff0d595bb0128e6036
Subproject commit 3ce5b3fb2858ad3ab2792bf9d1aafaa6f52af118

Просмотреть файл

@ -0,0 +1,39 @@
using System.Linq;
using System.Xml;
using System.Collections.Generic;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Xamarin.Forms.Xaml;
using static Mono.Cecil.Cil.Instruction;
using static Mono.Cecil.Cil.OpCodes;
namespace Xamarin.Forms.Build.Tasks
{
class DataTemplateExtension : ICompiledMarkupExtension
{
public IEnumerable<Instruction> ProvideValue(IElementNode node, ModuleDefinition module, ILContext context, out TypeReference typeRef)
{
typeRef = module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "DataTemplate"));
var name = new XmlName("", "TypeName");
if (!node.Properties.TryGetValue(name, out INode typeNameNode) && node.CollectionItems.Any())
typeNameNode = node.CollectionItems[0];
if (!(typeNameNode is ValueNode valueNode))
throw new XamlParseException("TypeName isn't set.", node as XmlLineInfo);
var contentTypeRef = module.ImportReference(XmlTypeExtensions.GetTypeReference(valueNode.Value as string, module, node as BaseNode))
?? throw new XamlParseException($"Can't resolve type `{valueNode.Value}'.", node as IXmlLineInfo);
var dataTemplateCtor = module.ImportCtorReference(typeRef, new[] { module.ImportReference(("mscorlib", "System", "Type")) });
return new List<Instruction> {
Create(Ldtoken, module.ImportReference(contentTypeRef)),
Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true)),
Create(Newobj, dataTemplateCtor),
};
}
}
}

Просмотреть файл

@ -10,7 +10,6 @@ using Xamarin.Forms.Xaml;
using static Mono.Cecil.Cil.Instruction;
using static Mono.Cecil.Cil.OpCodes;
namespace Xamarin.Forms.Build.Tasks
{
class TypeExtension : ICompiledMarkupExtension
@ -18,14 +17,12 @@ namespace Xamarin.Forms.Build.Tasks
public IEnumerable<Instruction> ProvideValue(IElementNode node, ModuleDefinition module, ILContext context, out TypeReference memberRef)
{
memberRef = module.ImportReference(("mscorlib", "System", "Type"));
INode typeNameNode;
var name = new XmlName("", "TypeName");
if (!node.Properties.TryGetValue(name, out typeNameNode) && node.CollectionItems.Any())
if (!node.Properties.TryGetValue(name, out INode typeNameNode) && node.CollectionItems.Any())
typeNameNode = node.CollectionItems[0];
var valueNode = typeNameNode as ValueNode;
if (valueNode == null)
if (!(typeNameNode is ValueNode valueNode))
throw new XamlParseException("TypeName isn't set.", node as XmlLineInfo);
if (!node.Properties.ContainsKey(name)) {

Просмотреть файл

@ -8,7 +8,7 @@
<PropertyGroup>
<_DisableStrongNamer Condition=" '$(_DisableStrongNamer)' != 'True' ">False</_DisableStrongNamer>
<AssemblyName>Xamarin.Forms.Build.Tasks</AssemblyName>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<SignAssembly Condition=" '$(_DisableStrongNamer)' != 'True' ">True</SignAssembly>
@ -20,13 +20,14 @@
<ItemGroup>
<PackageReference Include="Mono.Cecil" Version="0.10.1" />
<PackageReference Include="System.CodeDom" Version="4.4.0" />
<PackageReference Include="System.CodeDom" Version="4.4.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="Microsoft.Build" Version="15.8.166" />
<PackageReference Include="Microsoft.Build.Framework" Version="15.8.166" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.8.166" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.8.166" />
<PackageReference Include="StrongNamer" Version="0.0.8" />
<PackageReference Include="GitInfo" Version="2.0.20" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="GitInfo" Version="2.0.11" />
</ItemGroup>
<ItemGroup>
@ -43,7 +44,7 @@
<PropertyGroup Condition="'$(SnExe)' == '' And '$(OS)' != 'Windows_NT'">
<SnExe>sn</SnExe>
</PropertyGroup>
<Target Name="_SetSnExe" Condition="'$(SnExe)' == '' And '$(OS)' == 'Windows_NT'">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
@ -55,7 +56,7 @@
<SnExe>$([System.Text.RegularExpressions.Regex]::Replace('$(SnExe)', ';.*', ''))</SnExe>
</PropertyGroup>
</Target>
<Target Name="_StrongName" AfterTargets="Build" DependsOnTargets="_SetSnExe" Condition="'$(TargetPath)' != ''" Inputs="$(TargetPath)" Outputs="$(IntermediateOutputPath)Sn.stamp">
<Exec Command='"$(SnExe)" -R $(TargetPath) ..\xamarin.forms.snk' Condition=" '$(SignAssembly)' == 'true' " />
</Target>

Просмотреть файл

@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using System.Threading;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 4187, "Picker list shows up, when focus is set on other controls", PlatformAffected.Android)]
public class Issue4187 : TestCarouselPage
{
protected override void Init()
{
var items = new List<Issue4187Model>
{
new Issue4187Model
{
Label = "Label 1",
PickerSource = new List<string> {"Flower", "Harvest", "Propagation", "Vegetation"},
Text = "Text 1",
Date = DateTime.Now
},
new Issue4187Model
{
Label = "Label 2",
PickerSource = new List<string> {"1", "2", "3", "4"},
Text = "Text 2",
Date = DateTime.Now.AddDays(1)
}
};
var listView = new ListView
{
VerticalOptions = LayoutOptions.FillAndExpand,
HasUnevenRows = true,
ItemsSource = items,
ItemTemplate = new DataTemplate(() => GetViewCell())
};
var tableView = new TableView
{
BackgroundColor = Color.Wheat,
HasUnevenRows = true,
RowHeight = 100
};
tableView.Root = new TableRoot
{
new TableSection
{
GetViewCell(),
GetViewCell(),
}
};
tableView.BindingContext = new Issue4187Model
{
Label = "Label 1",
PickerSource = new List<string> { "Flower", "Harvest", "Propagation", "Vegetation" },
Text = "Text 1",
Date = DateTime.Now
};
Children.Add(new ContentPage
{
Content = new StackLayout
{
Children = {
GenerateNewPicker(),
listView
}
}
});
Children.Add(new ContentPage
{
BackgroundColor = Color.Red,
Content = new StackLayout
{
Children = { GenerateNewPicker(), tableView }
}
});
Children.Add(new ContentPage
{
BackgroundColor = Color.Blue,
Content = new StackLayout
{
Children = { GenerateNewPicker() }
}
});
}
static ViewCell GetViewCell()
{
var label = new Label { Text = "Status" };
label.SetBinding(Label.TextProperty, new Binding(nameof(Issue4187Model.Label)));
var picker = new Picker();
picker.SetBinding(Picker.ItemsSourceProperty, new Binding(nameof(Issue4187Model.PickerSource)));
var datePicker = new DatePicker();
datePicker.SetBinding(DatePicker.DateProperty, new Binding(nameof(Issue4187Model.Date)));
var entry = new Entry();
entry.SetBinding(Entry.TextProperty, new Binding(nameof(Issue4187Model.Text)));
return new ViewCell
{
View = new StackLayout
{
BackgroundColor = Color.Pink,
Children = {
label,
picker,
datePicker,
new TimePicker(),
entry
}
}
};
}
Picker GenerateNewPicker()
{
var picker = new Picker();
for (int i = 1; i < 100; i++)
picker.Items.Add($"item {i}");
return picker;
}
[Preserve(AllMembers = true)]
class Issue4187Model
{
public string Label { get; set; }
public List<string> PickerSource { get; set; }
public string Text { get; set; }
public DateTime Date { get; set; }
}
#if UITEST && __ANDROID__
[Test]
public void Issue4187Test()
{
RunningApp.WaitForElement("Text 1");
Assert.AreEqual(7, RunningApp.Query(q => q.TextField().Class("PickerEditText")).Length, "picker count");
TapOnPicker(1);
Assert.IsTrue(DialogIsOpened(), "#1");
RunningApp.Tap("Text 2");
Assert.IsFalse(DialogIsOpened(), "#2");
TapOnPicker(3);
Assert.IsTrue(DialogIsOpened(), "#3");
RunningApp.Tap("Text 1");
Assert.IsFalse(DialogIsOpened(), "#5");
// Carousel - first page
RunningApp.Back();
RunningApp.ScrollUp();
TapOnPicker(0);
Assert.IsTrue(DialogIsOpened(), "Carousel - #1");
// Red page
RunningApp.SwipeRightToLeft();
Assert.IsFalse(DialogIsOpened(), "Carousel - #2");
TapOnPicker(0);
Assert.IsTrue(DialogIsOpened(), "Carousel - #3");
// Blue page
RunningApp.SwipeRightToLeft();
Assert.IsFalse(DialogIsOpened(), "Carousel - #4");
TapOnPicker(0);
Assert.IsTrue(DialogIsOpened(), "Carousel - #5");
}
void TapOnPicker(int index)
{
var picker = RunningApp.Query(q => q.TextField().Class("PickerEditText"))[index];
var location = picker.Rect;
RunningApp.TapCoordinates(location.X + 10, location.Y + location.Height / 2);
}
bool DialogIsOpened()
{
Thread.Sleep(1500);
var frameLayouts = RunningApp.Query(q => q.Class("FrameLayout"));
foreach (var layout in frameLayouts)
{
if (layout.Rect.X > 0 && layout.Rect.Y > 0 && layout.Description.Contains(@"id/content"))
{
// close dialog
RunningApp.Back();
Thread.Sleep(1500);
return true;
}
}
return false;
}
#endif
}
}

Просмотреть файл

@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Linq;
#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, 4597, "[Android] ImageCell not loading images and setting ImageSource to null has no effect",
PlatformAffected.Android)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Image)]
[NUnit.Framework.Category(UITestCategories.ListView)]
#endif
public class Issue4597 : TestContentPage
{
ImageButton _imageButton;
Button _button;
Image _image;
ListView _listView;
string _disappearText = "You should see 4 images. Clicking this should cause the images to all disappear";
string _appearText = "Clicking this should cause the images to all appear";
string _theListView = "theListViewAutomationId";
string _fileName = "coffee";
protected override void Init()
{
_image = new Image() { Source = _fileName, AutomationId = _fileName };
_button = new Button() { Image = _fileName, AutomationId = _fileName };
_imageButton = new ImageButton() { Source = _fileName, AutomationId = _fileName };
_listView = new ListView()
{
ItemTemplate = new DataTemplate(() =>
{
var cell = new ImageCell();
cell.SetBinding(ImageCell.ImageSourceProperty, ".");
return cell;
}),
AutomationId = _theListView,
ItemsSource = new[] { _fileName },
HasUnevenRows = true,
BackgroundColor = Color.Purple
};
Button button = null;
button = new Button()
{
AutomationId = "ClickMe",
Text = _disappearText,
Command = new Command(() =>
{
if (button.Text == _disappearText)
{
_image.Source = null;
_button.Image = null;
_imageButton.Source = null;
_listView.ItemsSource = new string[] { null };
button.Text = _appearText;
}
else
{
_image.Source = _fileName;
_button.Image = _fileName;
_imageButton.Source = _fileName;
_listView.ItemsSource = new string[] { _fileName };
button.Text = _disappearText;
}
})
};
var layout = new StackLayout()
{
Children =
{
button,
_image,
_button,
_imageButton,
_listView,
}
};
Content = layout;
}
#if UITEST
[Test]
public void TestImagesDisappearCorrectly()
{
RunningApp.WaitForElement(_fileName);
var elementsBefore = RunningApp.WaitForElement(_fileName);
var imageCell = RunningApp.Query(app => app.Marked(_theListView).Descendant()).Where(x => x.Class.Contains("Image")).FirstOrDefault();
#if __IOS__
Assert.AreEqual(4, elementsBefore.Where(x => x.Class.Contains("Image")).Count());
#else
Assert.AreEqual(3, elementsBefore.Length);
#endif
Assert.IsNotNull(imageCell);
RunningApp.Tap("ClickMe");
var elementsAfter = RunningApp.WaitForElement(_fileName);
var imageCellAfter = RunningApp.Query(app => app.Marked(_theListView).Descendant()).Where(x => x.Class.Contains("Image")).FirstOrDefault();
Assert.IsNull(imageCellAfter);
#if __IOS__
Assert.AreEqual(0, elementsAfter.Where(x => x.Class.Contains("Image")).Count());
#endif
#if __ANDROID__
foreach(var newElement in elementsAfter)
{
foreach(var oldElement in elementsBefore)
{
if(newElement.Class == oldElement.Class)
{
Assert.IsTrue(newElement.Rect.Height < oldElement.Rect.Height);
continue;
}
}
}
#endif
}
#endif
}
}

Просмотреть файл

@ -21,6 +21,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue4484.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3509.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue4597.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Github3856.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1937.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3555.cs" />
@ -557,6 +558,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue1236.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1259.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1267.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue4187.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1305.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1329.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1384.cs" />

Просмотреть файл

@ -32,13 +32,6 @@
<ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
</ItemGroup>
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />

Просмотреть файл

@ -162,8 +162,6 @@ namespace Xamarin.Forms
static readonly BindablePropertyKey MenuItemsPropertyKey =
BindableProperty.CreateReadOnly(nameof(MenuItems), typeof(MenuItemCollection), typeof(Shell), null, defaultValueCreator: bo => new MenuItemCollection());
#region IShellController
List<(IAppearanceObserver Observer, Element Pivot)> _appearanceObservers = new List<(IAppearanceObserver Observer, Element Pivot)>();
List<IFlyoutBehaviorObserver> _flyoutBehaviorObservers = new List<IFlyoutBehaviorObserver>();
@ -324,9 +322,7 @@ namespace Xamarin.Forms
OnNavigated(new ShellNavigatedEventArgs(oldState, CurrentState, source));
}
#endregion IShellController
#region URI Navigation
public static Shell CurrentShell => Application.Current?.MainPage as Shell;
public async Task GoToAsync(ShellNavigationState state, bool animate = true)
{
@ -484,8 +480,6 @@ namespace Xamarin.Forms
return stateBuilder.ToString();
}
#endregion URI Navigation
public static readonly BindableProperty CurrentItemProperty =
BindableProperty.Create(nameof(CurrentItem), typeof(ShellItem), typeof(Shell), null, BindingMode.TwoWay,
propertyChanging: OnCurrentItemChanging,
@ -1009,4 +1003,4 @@ namespace Xamarin.Forms
}
#endregion
}
}
}

Просмотреть файл

@ -1,30 +1,20 @@
using Android.App;
using Android.Content.Res;
using Android.Text;
using Android.Util;
using Android.Widget;
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using Android.Content;
using Object = Java.Lang.Object;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using System.Collections.Generic;
using Android.Views;
using Android.Widget;
namespace Xamarin.Forms.Platform.Android.AppCompat
{
public class PickerRenderer : ViewRenderer<Picker, EditText>
public class PickerRenderer : ViewRenderer<Picker, EditText>, IPickerRenderer
{
AlertDialog _dialog;
bool _disposed;
TextColorSwitcher _textColorSwitcher;
HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
public PickerRenderer(Context context) : base(context)
{
AutoPackage = false;
@ -38,7 +28,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override EditText CreateNativeControl()
{
return new EditText(Context);
return new PickerEditText(Context, this);
}
protected override void Dispose(bool disposing)
@ -63,17 +53,11 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
((INotifyCollectionChanged)e.NewElement.Items).CollectionChanged += RowsCollectionChanged;
if (Control == null)
{
EditText textField = CreateNativeControl();
textField.Focusable = true;
textField.Clickable = true;
textField.Tag = this;
textField.InputType = InputTypes.Null;
textField.KeyPress += TextFieldKeyPress;
textField.SetOnClickListener(PickerListener.Instance);
var textField = CreateNativeControl();
var useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();
_textColorSwitcher = new TextColorSwitcher(textField.TextColors, useLegacyColorManagement);
SetNativeControl(textField);
}
UpdateFont();
@ -84,24 +68,6 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
base.OnElementChanged(e);
}
void TextFieldKeyPress(object sender, KeyEventArgs e)
{
if (availableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;
}
e.Handled = true;
OnClick();
}
internal override void OnNativeFocusChanged(bool hasFocus)
{
base.OnNativeFocusChanged(hasFocus);
if (hasFocus)
OnClick();
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
@ -121,7 +87,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
OnClick();
CallOnClick();
else if (_dialog != null)
{
_dialog.Hide();
@ -131,7 +97,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
}
void OnClick()
void IPickerRenderer.OnClick()
{
Picker model = Element;
if (_dialog == null)
@ -143,7 +109,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
builder.SetItems(items, (s, e) => ((IElementController)model).SetValueFromRenderer(Picker.SelectedIndexProperty, e.Which));
builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { });
((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
_dialog = builder.Create();
@ -185,20 +151,5 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
{
_textColorSwitcher?.UpdateTextColor(Control, Element.TextColor);
}
class PickerListener : Object, IOnClickListener
{
#region Statics
public static readonly PickerListener Instance = new PickerListener();
#endregion
public void OnClick(global::Android.Views.View v)
{
var renderer = v.Tag as PickerRenderer;
renderer?.OnClick();
}
}
}
}

Просмотреть файл

@ -24,13 +24,13 @@ namespace Xamarin.Forms.Platform.Android
{
IImageController imageController = newView as IImageController;
newImageSource = newView?.Source;
previousImageSource = previousView?.Source;
newImageSource = newImageSource ?? newView?.Source;
previousImageSource = previousImageSource ?? previousView?.Source;
if (newImageSource == null || imageView.IsDisposed())
if (imageView.IsDisposed())
return;
if (Equals(previousImageSource, newImageSource))
if (newImageSource != null && Equals(previousImageSource, newImageSource))
return;
imageController?.SetIsLoading(true);

Просмотреть файл

@ -0,0 +1,7 @@
namespace Xamarin.Forms.Platform.Android
{
public interface IPickerRenderer
{
void OnClick();
}
}

Просмотреть файл

@ -60,7 +60,8 @@ namespace Xamarin.Forms.Platform.Android
void OnUpdate(object sender, ValueAnimator.AnimatorUpdateEventArgs e)
{
_progress = (float)e.Animation.AnimatedValue;
InvalidateSelf();
if (!this.IsDisposed())
InvalidateSelf();
}
}
}

Просмотреть файл

@ -1,29 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.Text;
using Android.Util;
using Android.Views;
using Android.Widget;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using AView = Android.Views.View;
using Object = Java.Lang.Object;
namespace Xamarin.Forms.Platform.Android
{
public class DatePickerRenderer : ViewRenderer<DatePicker, EditText>
public class DatePickerRenderer : ViewRenderer<DatePicker, EditText>, IPickerRenderer
{
DatePickerDialog _dialog;
bool _disposed;
TextColorSwitcher _textColorSwitcher;
HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
public DatePickerRenderer(Context context) : base(context)
{
AutoPackage = false;
@ -62,7 +51,7 @@ namespace Xamarin.Forms.Platform.Android
protected override EditText CreateNativeControl()
{
return new EditText(Context) { Focusable = true, Clickable = true, Tag = this };
return new PickerEditText(Context, this);
}
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
@ -73,9 +62,6 @@ namespace Xamarin.Forms.Platform.Android
{
var textField = CreateNativeControl();
textField.SetOnClickListener(TextFieldClickHandler.Instance);
textField.InputType = InputTypes.Null;
textField.KeyPress += TextFieldKeyPress;
SetNativeControl(textField);
var useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();
@ -90,24 +76,6 @@ namespace Xamarin.Forms.Platform.Android
UpdateTextColor();
}
void TextFieldKeyPress(object sender, KeyEventArgs e)
{
if (availableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;
}
e.Handled = true;
OnTextFieldClicked();
}
internal override void OnNativeFocusChanged(bool hasFocus)
{
base.OnNativeFocusChanged(hasFocus);
if (hasFocus)
OnTextFieldClicked();
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
@ -129,7 +97,7 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
OnTextFieldClicked();
CallOnClick();
else if (_dialog != null)
{
_dialog.Hide();
@ -170,7 +138,7 @@ namespace Xamarin.Forms.Platform.Android
}
}
void OnTextFieldClicked()
void IPickerRenderer.OnClick()
{
if (_dialog != null && _dialog.IsShowing)
{
@ -232,15 +200,5 @@ namespace Xamarin.Forms.Platform.Android
{
_textColorSwitcher?.UpdateTextColor(Control, Element.TextColor);
}
class TextFieldClickHandler : Object, IOnClickListener
{
public static readonly TextFieldClickHandler Instance = new TextFieldClickHandler();
public void OnClick(AView v)
{
((DatePickerRenderer)v.Tag).OnTextFieldClicked();
}
}
}
}

Просмотреть файл

@ -0,0 +1,82 @@
using Android.Content;
using Android.Views;
using Android.Widget;
using Android.Text;
using Java.Lang;
using System.Collections.Generic;
using Android.Graphics;
using Android.Runtime;
namespace Xamarin.Forms.Platform.Android
{
public class PickerEditText : EditText
{
readonly static HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
System.WeakReference<IPickerRenderer> rendererRef;
internal bool FromFocusSearch;
public PickerEditText(Context context, IPickerRenderer pickerRenderer) : base(context)
{
Focusable = true;
Clickable = true;
InputType = InputTypes.Null;
KeyPress += OnKeyPress;
rendererRef = new System.WeakReference<IPickerRenderer>(pickerRenderer);
SetOnClickListener(PickerListener.Instance);
}
protected override void OnFocusChanged(bool gainFocus, [GeneratedEnum] FocusSearchDirection direction, Rect previouslyFocusedRect)
{
base.OnFocusChanged(gainFocus, direction, previouslyFocusedRect);
if (gainFocus && FromFocusSearch)
CallOnClick();
FromFocusSearch = false;
}
void OnKeyPress(object sender, KeyEventArgs e)
{
if (availableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;
}
e.Handled = true;
CallOnClick();
}
public override bool OnTouchEvent(MotionEvent e)
{
if (e.Action == MotionEventActions.Up && !IsFocused)
RequestFocus();
return base.OnTouchEvent(e); // raises the OnClick event if focus is already received
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
KeyPress -= OnKeyPress;
rendererRef = null;
}
base.Dispose(disposing);
}
class PickerListener : Object, IOnClickListener
{
public static readonly PickerListener Instance = new PickerListener();
public void OnClick(global::Android.Views.View v)
{
if (v is PickerEditText picker)
{
picker.rendererRef.TryGetTarget(out IPickerRenderer renderer);
renderer?.OnClick();
}
}
}
}
}

Просмотреть файл

@ -1,5 +1,4 @@
using Android.App;
using Android.Content.Res;
using Android.Util;
using Android.Views;
using Android.Widget;
@ -7,27 +6,17 @@ using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using ADatePicker = Android.Widget.DatePicker;
using ATimePicker = Android.Widget.TimePicker;
using Object = Java.Lang.Object;
using Orientation = Android.Widget.Orientation;
using Android.Content;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using System.Collections.Generic;
using Android.Text;
namespace Xamarin.Forms.Platform.Android
{
public class PickerRenderer : ViewRenderer<Picker, EditText>
public class PickerRenderer : ViewRenderer<Picker, EditText>, IPickerRenderer
{
AlertDialog _dialog;
bool _isDisposed;
TextColorSwitcher _textColorSwitcher;
HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
public PickerRenderer(Context context) : base(context)
{
AutoPackage = false;
@ -54,7 +43,7 @@ namespace Xamarin.Forms.Platform.Android
protected override EditText CreateNativeControl()
{
return new EditText(Context) { Focusable = true, Clickable = true, Tag = this };
return new PickerEditText(Context, this);
}
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
@ -68,16 +57,13 @@ namespace Xamarin.Forms.Platform.Android
if (Control == null)
{
var textField = CreateNativeControl();
textField.SetOnClickListener(PickerListener.Instance);
textField.InputType = InputTypes.Null;
textField.KeyPress += TextFieldKeyPress;
var useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();
_textColorSwitcher = new TextColorSwitcher(textField.TextColors, useLegacyColorManagement);
SetNativeControl(textField);
}
UpdateFont();
UpdatePicker();
UpdateTextColor();
@ -86,24 +72,6 @@ namespace Xamarin.Forms.Platform.Android
base.OnElementChanged(e);
}
void TextFieldKeyPress(object sender, KeyEventArgs e)
{
if (availableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;
}
e.Handled = true;
OnClick();
}
internal override void OnNativeFocusChanged(bool hasFocus)
{
base.OnNativeFocusChanged(hasFocus);
if (hasFocus)
OnClick();
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
@ -123,7 +91,7 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
OnClick();
CallOnClick();
else if (_dialog != null)
{
_dialog.Hide();
@ -132,7 +100,7 @@ namespace Xamarin.Forms.Platform.Android
}
}
void OnClick()
void IPickerRenderer.OnClick()
{
Picker model = Element;
@ -212,19 +180,5 @@ namespace Xamarin.Forms.Platform.Android
{
_textColorSwitcher?.UpdateTextColor(Control, Element.TextColor);
}
class PickerListener : Object, IOnClickListener
{
public static readonly PickerListener Instance = new PickerListener();
public void OnClick(global::Android.Views.View v)
{
var renderer = v.Tag as PickerRenderer;
if (renderer == null)
return;
renderer.OnClick();
}
}
}
}

Просмотреть файл

@ -138,7 +138,8 @@ namespace Xamarin.Forms.Platform.Android
void clickCallback(object s, EventArgs e)
{
selectCallback(shellContent, bottomSheetDialog);
innerLayout.Click -= clickCallback;
if (!innerLayout.IsDisposed())
innerLayout.Click -= clickCallback;
}
innerLayout.Click += clickCallback;

Просмотреть файл

@ -3,27 +3,17 @@ using System.ComponentModel;
using Android.App;
using Android.Content;
using Android.Util;
using Android.Widget;
using Android.Text.Format;
using ATimePicker = Android.Widget.TimePicker;
using Object = Java.Lang.Object;
using AView = Android.Views.View;
using Android.OS;
using Android.Views;
using System.Collections.Generic;
using Android.Text;
using Android.Widget;
namespace Xamarin.Forms.Platform.Android
{
public class TimePickerRenderer : ViewRenderer<TimePicker, EditText>, TimePickerDialog.IOnTimeSetListener
public class TimePickerRenderer : ViewRenderer<TimePicker, EditText>, TimePickerDialog.IOnTimeSetListener, IPickerRenderer
{
AlertDialog _dialog;
TextColorSwitcher _textColorSwitcher;
HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
bool Is24HourView
{
@ -57,7 +47,7 @@ namespace Xamarin.Forms.Platform.Android
protected override EditText CreateNativeControl()
{
return new EditText(Context) { Focusable = true, Clickable = true, Tag = this };
return new PickerEditText(Context, this);
}
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
@ -68,9 +58,6 @@ namespace Xamarin.Forms.Platform.Android
{
var textField = CreateNativeControl();
textField.SetOnClickListener(TimePickerListener.Instance);
textField.InputType = InputTypes.Null;
textField.KeyPress += TextFieldKeyPress;
SetNativeControl(textField);
var useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();
@ -85,24 +72,6 @@ namespace Xamarin.Forms.Platform.Android
Control.TextAlignment = global::Android.Views.TextAlignment.ViewStart;
}
void TextFieldKeyPress(object sender, KeyEventArgs e)
{
if (availableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;
}
e.Handled = true;
OnClick();
}
internal override void OnNativeFocusChanged(bool hasFocus)
{
base.OnNativeFocusChanged(hasFocus);
if (hasFocus)
OnClick();
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
@ -120,7 +89,7 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
OnClick();
CallOnClick();
else if (_dialog != null)
{
_dialog.Hide();
@ -143,7 +112,7 @@ namespace Xamarin.Forms.Platform.Android
return dialog;
}
void OnClick()
void IPickerRenderer.OnClick()
{
if (_dialog != null && _dialog.IsShowing)
{
@ -178,19 +147,5 @@ namespace Xamarin.Forms.Platform.Android
{
_textColorSwitcher?.UpdateTextColor(Control, Element.TextColor);
}
class TimePickerListener : Object, IOnClickListener
{
public static readonly TimePickerListener Instance = new TimePickerListener();
public void OnClick(AView v)
{
var renderer = v.Tag as TimePickerRenderer;
if (renderer == null)
return;
renderer.OnClick();
}
}
}
}

Просмотреть файл

@ -166,6 +166,10 @@ namespace Xamarin.Forms.Platform.Android
control = (renderer as ITabStop)?.TabStop;
} while (!(control?.Focusable == true || ++attempt >= maxAttempts));
// when the user focuses on picker show a popup dialog
if (control is PickerEditText picker)
picker.FromFocusSearch = true;
return control;
}

Просмотреть файл

@ -148,6 +148,8 @@
<Compile Include="Material\MaterialButtonRenderer.cs" />
<Compile Include="Material\MaterialEntryRenderer.cs" />
<Compile Include="Material\MaterialProgressBarRenderer.cs" />
<Compile Include="IPickerRenderer.cs" />
<Compile Include="Renderers\PickerEditText.cs" />
<Compile Include="Renderers\FormsWebViewClient.cs" />
<Compile Include="Renderers\IImageViewHandler.cs" />
<Compile Include="InnerGestureListener.cs" />
@ -308,7 +310,7 @@
<Compile Include="Resources\Resource.Designer.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="using:Xamarin.Forms.Xaml.UnitTests"
x:Class="Xamarin.Forms.Xaml.UnitTests.DataTemplateExtension">
<ContentPage.Resources>
<ShellContent x:Key="content" ContentTemplate="{DataTemplate local:DataTemplateExtension}" />
</ContentPage.Resources>
</ContentPage>

Просмотреть файл

@ -0,0 +1,32 @@
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
public partial class DataTemplateExtension : ContentPage
{
public DataTemplateExtension() => InitializeComponent();
public DataTemplateExtension(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
class Tests
{
[SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
[TearDown] public void TearDown() => Device.PlatformServices = null;
[TestCase(true), TestCase(false)]
public void DataTemplateExtension(bool useCompiledXaml)
{
var layout = new DataTemplateExtension(useCompiledXaml);
var content = layout.Resources["content"] as ShellContent;
var template = content.ContentTemplate;
var obj = template.CreateContent();
Assert.That(obj, Is.TypeOf<DataTemplateExtension>());
}
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh4572">
<Label x:Name="label">
<Label.Text>
<Binding Path="labeltext"/>
</Label.Text>
</Label>
</ContentPage>

Просмотреть файл

@ -0,0 +1,31 @@
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
public partial class Gh4572 : ContentPage
{
public Gh4572() => InitializeComponent();
public Gh4572(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
class Tests
{
[SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
[TearDown] public void TearDown() => Device.PlatformServices = null;
[TestCase(true), TestCase(false)]
public void BindingAsElement(bool useCompiledXaml)
{
if (useCompiledXaml)
Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Gh4572)));
var layout = new Gh4572(useCompiledXaml) { BindingContext = new { labeltext = "Foo" } };
Assert.That(layout.label.Text, Is.EqualTo("Foo"));
}
}
}
}

Просмотреть файл

@ -177,27 +177,6 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.AreEqual ("Foo", label.Text);
}
[Test]
public void TestBindingAsElement ()
{
var xaml = @"
<Label
xmlns=""http://xamarin.com/schemas/2014/forms"">
<Label.Text>
<Binding Path=""labeltext""/>
</Label.Text>
</Label>";
var label = new Label ();
label.LoadFromXaml (xaml);
Assert.AreEqual (Label.TextProperty.DefaultValue, label.Text);
label.BindingContext = new {labeltext="Foo"};
Assert.AreEqual ("Foo", label.Text);
}
[Test]
public void TestSetBindingToNonBindablePropertyShouldThrow ()
{

Просмотреть файл

@ -37,13 +37,6 @@
<Link>BaseTestFixture.cs</Link>
</Compile>
</ItemGroup>
<PropertyGroup>
<__XFBuildTasksLocation>$(_XFBuildTasksLocation)</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == '' AND '$(MSBuildRuntimeType)' == 'Core'">..\.nuspec\netstandard2.0\</__XFBuildTasksLocation>
<__XFBuildTasksLocation Condition="'$(__XFBuildTasksLocation)' == ''">..\.nuspec\net461\</__XFBuildTasksLocation>
</PropertyGroup>
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>

Просмотреть файл

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Items")]
[ContentProperty(nameof(Items))]
[AcceptEmptyServiceProvider]
public class ArrayExtension : IMarkupExtension<Array>
{

Просмотреть файл

@ -3,7 +3,7 @@ using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Path")]
[ContentProperty(nameof(Path))]
[AcceptEmptyServiceProvider]
public sealed class BindingExtension : IMarkupExtension<BindingBase>
{

Просмотреть файл

@ -2,17 +2,28 @@
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Type")]
[ContentProperty(nameof(TypeName))]
[ProvideCompiled("Xamarin.Forms.Build.Tasks.DataTemplateExtension")]
public sealed class DataTemplateExtension : IMarkupExtension<DataTemplate>
{
public string Type { get; set; }
public string TypeName { get; set; }
public DataTemplate ProvideValue(IServiceProvider serviceProvider)
{
var typeResolver = serviceProvider.GetService<IXamlTypeResolver>();
if (typeResolver.TryResolve(Type, out var type))
if (serviceProvider == null)
throw new ArgumentNullException(nameof(serviceProvider));
if (!(serviceProvider.GetService(typeof(IXamlTypeResolver)) is IXamlTypeResolver typeResolver))
throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
if (string.IsNullOrEmpty(TypeName)) {
var li = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) is IXmlLineInfoProvider lip) ? lip.XmlLineInfo : new XmlLineInfo();
throw new XamlParseException("TypeName isn't set.", li);
}
if (typeResolver.TryResolve(TypeName, out var type))
return new DataTemplate(type);
throw new Exception("Could not locate type for " + Type);
var lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) is IXmlLineInfoProvider lineInfoProvider) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
throw new XamlParseException($"DataTemplateExtension: Could not locate type for {TypeName}.", lineInfo);
}
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)

Просмотреть файл

@ -3,7 +3,7 @@ using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Key")]
[ContentProperty(nameof(Key))]
public sealed class DynamicResourceExtension : IMarkupExtension<DynamicResource>
{
public string Key { get; set; }

Просмотреть файл

@ -5,7 +5,7 @@ using System.Xml;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Default")]
[ContentProperty(nameof(Default))]
public class OnIdiomExtension : IMarkupExtension
{
// See Device.Idiom

Просмотреть файл

@ -5,7 +5,7 @@ using System.Xml;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Default")]
[ContentProperty(nameof(Default))]
public class OnPlatformExtension : IMarkupExtension
{
public object Default { get; set; }

Просмотреть файл

@ -4,7 +4,7 @@ using Xamarin.Forms.Xaml.Internals;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Name")]
[ContentProperty(nameof(Name))]
public class ReferenceExtension : IMarkupExtension
{
public string Name { get; set; }

Просмотреть файл

@ -6,7 +6,7 @@ using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Key")]
[ContentProperty(nameof(Key))]
public sealed class StaticResourceExtension : IMarkupExtension
{
public string Key { get; set; }

Просмотреть файл

@ -2,7 +2,7 @@ using System;
namespace Xamarin.Forms.Xaml
{
[ContentProperty("Path")]
[ContentProperty(nameof(Path))]
[AcceptEmptyServiceProvider]
public sealed class TemplateBindingExtension : IMarkupExtension<BindingBase>
{

Просмотреть файл

@ -10,13 +10,14 @@ namespace Xamarin.Forms.Xaml
public Type ProvideValue(IServiceProvider serviceProvider)
{
if (string.IsNullOrEmpty(TypeName))
throw new InvalidOperationException("TypeName isn't set.");
if (serviceProvider == null)
throw new ArgumentNullException(nameof(serviceProvider));
var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
if (typeResolver == null)
if (!(serviceProvider.GetService(typeof(IXamlTypeResolver)) is IXamlTypeResolver typeResolver))
throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
if (string.IsNullOrEmpty(TypeName)) {
var li = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) is IXmlLineInfoProvider lip) ? lip.XmlLineInfo : new XmlLineInfo();
throw new XamlParseException("TypeName isn't set.", li);
}
return typeResolver.Resolve(TypeName, serviceProvider);
}

Просмотреть файл

@ -322,7 +322,6 @@ Global
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|iPhone.Build.0 = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|x64.ActiveCfg = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|x64.Build.0 = Debug|Any CPU
{4B14D295-C09B-4C38-B880-7CC768E50585}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1207,9 +1206,7 @@ Global
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|ARM.Build.0 = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|iPhone.Build.0 = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|x64.ActiveCfg = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|x64.Build.0 = Debug|Any CPU
{699C79F6-1D91-4DBF-B817-E8CFFD6263BB}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1231,9 +1228,7 @@ Global
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|ARM.ActiveCfg = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|ARM.Build.0 = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|iPhone.Build.0 = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|x64.Build.0 = Debug|Any CPU
{83790029-272E-45AF-A41D-E7716684E5B8}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1362,9 +1357,7 @@ Global
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|ARM.Build.0 = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|iPhone.Build.0 = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|x64.ActiveCfg = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|x64.Build.0 = Debug|Any CPU
{AFF3AD0D-7181-4551-A29C-8701FE3E6753}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1384,9 +1377,7 @@ Global
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|ARM.ActiveCfg = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|ARM.Build.0 = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|iPhone.Build.0 = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|x64.ActiveCfg = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|x64.Build.0 = Debug|Any CPU
{8C7F0087-4031-4297-A651-6ED55F7B88BA}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1406,9 +1397,7 @@ Global
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|ARM.Build.0 = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|iPhone.Build.0 = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|x64.ActiveCfg = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|x64.Build.0 = Debug|Any CPU
{C5C1D2BE-DB01-4B2E-BCA5-2C9A9691E3F1}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1453,9 +1442,7 @@ Global
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|ARM.ActiveCfg = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|ARM.Build.0 = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|iPhone.Build.0 = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|x64.ActiveCfg = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|x64.Build.0 = Debug|Any CPU
{98637471-8E5C-4DDE-89CA-2EAA664FB0EF}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1477,9 +1464,7 @@ Global
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|ARM.Build.0 = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|iPhone.Build.0 = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|x64.ActiveCfg = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|x64.Build.0 = Debug|Any CPU
{C4340D4E-BDDB-4053-BFBC-CF4F043FAE87}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1501,9 +1486,7 @@ Global
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|ARM.ActiveCfg = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|ARM.Build.0 = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|iPhone.Build.0 = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|x64.ActiveCfg = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|x64.Build.0 = Debug|Any CPU
{65BC4888-CC59-428A-9B75-540CF1C09480}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -1537,9 +1520,7 @@ Global
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|ARM.ActiveCfg = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|ARM.Build.0 = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|iPhone.Build.0 = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|x64.ActiveCfg = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|x64.Build.0 = Debug|Any CPU
{39B3457F-01D8-43D0-8E84-D8C4F73CF48E}.Debug|x86.ActiveCfg = Debug|Any CPU

Просмотреть файл

@ -7,6 +7,24 @@ variables:
value: ''
- name: Suffix
value: ''
- name: major
value: 4
- name: minor
value: 0
- name: patch
value: 1
- name: buildversion
value: $[counter('versioncounter', 1000)]
- name: sign
value: 'false'
- name: provisioning
value: 'true'
- name: AppleCodesignIdentity
value: ''
- name: AppleCodesignIdentityUrl
value: ''
- name: AppleCodesignProfileUrl
value: ''
- group: Xamarin.Forms
- group: XQA Secrets
@ -14,8 +32,9 @@ trigger:
branches:
include:
- master
- 3.4.0
- 3.3.0
- 3.4.0
- 3.5.0
paths:
exclude:
- README.md
@ -76,6 +95,9 @@ jobs:
- sh
- msbuild
- Xamarin.iOS
variables:
provisioningOSX : true
provisioningSign : $(provisioning)
steps:
- template: build/steps/build-osx.yml
@ -95,9 +117,11 @@ jobs:
- job: Phase_6
displayName: Sign Phase
dependsOn: Phase_5
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/')))
condition: and(succeeded(), eq(dependencies.Phase_1.outputs['prepare.sign'], 'true'))
pool:
name: VSEng-Xamarin-Forms
variables:
sign: $[dependencies.Phase_1.outputs['prepare.sign']]
steps:
- template: build/steps/build-sign.yml

Просмотреть файл

@ -1,29 +1,8 @@
if (!IsMac)
return;
Item (XreItem.Xcode_10_1_0).XcodeSelect ();
var channel = Env("PROVISIONATOR_XAMARIN_CHANNEL") ?? "Stable";
AndroidSdk ()
.ApiLevel (AndroidApiLevel.JellyBean)
.ApiLevel (AndroidApiLevel.JellyBean_4_2)
.ApiLevel (AndroidApiLevel.JellyBean_4_3)
.ApiLevel (AndroidApiLevel.KitKat)
.ApiLevel (AndroidApiLevel.Lollipop)
.ApiLevel (AndroidApiLevel.Lollipop_5_1)
.ApiLevel (AndroidApiLevel.Lollipop_5_2)
.ApiLevel (AndroidApiLevel.Marshmallow)
.ApiLevel (AndroidApiLevel.Nougat)
.ApiLevel (AndroidApiLevel.Nougat_7_1)
.ApiLevel (AndroidApiLevel.Oreo)
.ApiLevel (AndroidApiLevel.Oreo_8_1)
.SdkManagerPackage ("build-tools;25.0.0")
.SdkManagerPackage ("build-tools;27.0.0")
.SdkManagerPackage ("build-tools;28.0.0")
.SdkManagerPackage ("extras;google;m2repository");
Item ("https://dl.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-5.12.0.309.macos10.xamarin.universal.pkg");
Item ("https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-12.1.0.15.pkg");
Item ("https://dl.xamarin.com/XamarinforMac/Mac/xamarin.mac-5.0.0.0.pkg");
Item ("https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-9.0.0-20.pkg");
Item ("https://dl.xamarin.com/VsMac/VisualStudioForMac-7.6.11.9.dmg");
if (IsMac)
{
Item (XreItem.Xcode_10_1_0).XcodeSelect ();
}
XamarinChannel(channel);

Просмотреть файл

@ -0,0 +1,12 @@
using System;
using System.IO;
using System.Linq;
using Serilog;
if (!IsMac)
return;
Log.Information ("Identity : " + Env(""APPLECODESIGNIDENTITYURL""));
Log.Information ("Profile : " + Env(""APPLECODESIGNPROFILEURL""));
AppleCodesignIdentity("iPhone Developer: Xamarin QA (JP4JS5NR3R)",Env("APPLECODESIGNIDENTITYURL"));
AppleCodesignProfile(Env("APPLECODESIGNPROFILEURL"));

Просмотреть файл

@ -1,26 +0,0 @@
var arch = Is64Bit ? "x64" : "x86";
SetPowershellExecutionPolicy (PowershellExecutionPolicy.Bypass, PowershellScope.CurrentUser);
SetUACBehavior (UACBehavior.ElevateWithoutConsentOrCredentials);
InstallWindowsFeature ("NetFx3");
VisualStudio (VisualStudioChannel.Stable, VisualStudioTier.Enterprise, "15.8.9")
.Workload (VisualStudioWorkload.ManagedDesktop)
.Workload (VisualStudioWorkload.NetCrossPlat)
.Workload (VisualStudioWorkload.NativeDesktop)
.Workload (VisualStudioWorkload.Universal)
.Component (VisualStudioComponent.Microsoft_VisualStudio_Component_Windows81SDK)
.Component (VisualStudioComponent.Microsoft_VisualStudio_Component_Windows10SDK_16299_UWP)
.Component (VisualStudioComponent.Microsoft_VisualStudio_Component_Windows10SDK_16299_UWP_Native)
.Component (VisualStudioComponent.Component_Android_SDK23)
.Component (VisualStudioComponent.Component_Android_SDK25)
.Component (VisualStudioComponent.Component_JavaJDK)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_5_1_TargetingPack)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_5_2_TargetingPack)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_5_TargetingPack)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_6_2_SDK)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_6_2_TargetingPack)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_7_SDK)
.Component (VisualStudioComponent.Microsoft_Net_Component_4_7_TargetingPack);

Просмотреть файл

@ -23,8 +23,7 @@ steps:
- powershell: |
$buildConfiguration = "Release"
$formsNugetVersion = "" + $env:CURRENTSEMANTICVERSION + "." + ($env:BUILD_BUILDID - $env:MAGICNUMBER)
$formsNugetVersion = $env:major + "." + $env:minor + "." + $env:patch + "." + $env:buildversion
if($env:SUFFIX)
{
$formsNugetVersion = $formsNugetVersion +"-"+$env:SUFFIX
@ -38,17 +37,11 @@ steps:
displayName: 'Make NuGet Package'
inputs:
command: pack
feedsToUse: config
packagesToPack: '.nuspec/*.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)/nuget/debug'
versioningScheme: byEnvVar
versionEnvVar: XamarinFormsPackageVersion
buildProperties: 'IdAppend=$(FormsIdAppend)'
@ -56,11 +49,8 @@ steps:
displayName: 'NuGet push'
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/nuget/debug/*.nupkg'
publishVstsFeed: '13fa23d7-5f2f-47f1-a87c-45a9f173dd74'
allowPackageConflicts: true
@ -77,7 +67,6 @@ steps:
} | Set-Content $_
}
failOnStderr: true
displayName: 'Update nuspecs'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/')))
@ -85,24 +74,16 @@ steps:
displayName: 'Make NuGet Package Release'
inputs:
command: pack
feedsToUse: config
packagesToPack: '.nuspec/*.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)/nuget/release'
versioningScheme: byEnvVar
versionEnvVar: XamarinFormsPackageVersion
buildProperties: 'IdAppend=$(FormsIdAppend)'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'],'refs/tags/'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: nuget'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget'
ArtifactName: nuget

Просмотреть файл

@ -1,8 +1,10 @@
steps:
- checkout: self
submodules: true
- task: ms-devlabs.utilitytasks.task-Shellpp.Shell++@0
displayName: 'Add QA cert password to keychain'
condition: eq(variables['provisioningSign'], 'true')
inputs:
type: InlineScript
script: '$(Build.Repository.LocalPath)/Xamarin.Forms.Build/provisionator.sh keychain set pb_dev_iphone.p12 $(.p12.Password)'
@ -10,9 +12,17 @@ steps:
- bash: '$(Build.Repository.LocalPath)/$(ProvisionatorExecutablePath) keychain set github.com $(GitHub.Token) || echo "PAT already set"'
displayName: 'Initialize PAT'
condition: eq(variables['provisioningSign'], 'true')
- bash: '$(Build.Repository.LocalPath)/Xamarin.Forms.Build/provisionator.sh $(Build.Repository.LocalPath)/Xamarin.Forms.Build/provisioning.csx -v'
- bash: '$(Build.Repository.LocalPath)/Xamarin.Forms.Build/provisionator.sh $(Build.Repository.LocalPath)/Xamarin.Forms.Build/provisioning_sign.csx -v'
displayName: Provisioning
condition: eq(variables['provisioningSign'], 'true')
env:
APPLECODESIGNIDENTITY: $(AppleCodesignIdentity)
APPLECODESIGNIDENTITYURL: $(AppleCodesignIdentityUrl)
APPLECODESIGNPROFILEURL: $(AppleCodesignProfileUrl)
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.8.1'
@ -38,7 +48,6 @@ steps:
inputs:
solutionFile: Xamarin.Forms.sln
configuration: '$(BuildConfiguration)'
runNugetRestore: true
- task: MSBuild@1
@ -111,6 +120,7 @@ steps:
Contents: |
**/$(IpaName)
Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/**
TargetFolder: '$(build.artifactstagingdirectory)/ios'
CleanTargetFolder: true
flattenFolders: true

Просмотреть файл

@ -1,6 +1,5 @@
steps:
- powershell: |
Write-Host "Finding the right branch"
$sourceBranchName = "" + $env:BUILD_SOURCEBRANCHNAME
$sourceBranch = "" + $env:BUILD_SOURCEBRANCH
$sourceVersion = "" + $env:BUILD_SOURCEVERSION
@ -25,13 +24,14 @@ steps:
}
displayName: 'Set Build Number'
- powershell: |
Write-Host "Finding the right branch"
$sourceBranchName = ""+ $env:BUILD_SOURCEBRANCHNAME
$sourceBranch = ""+ $env:BUILD_SOURCEBRANCH
$publicTags = ""+ $env:PUBLICTAGS
$sourceBranchName = "" + $env:BUILD_SOURCEBRANCHNAME
$sourceBranch = "" + $env:BUILD_SOURCEBRANCH
$publicTags = "" + $env:PUBLICTAGS
$tags = New-Object System.Collections.ArrayList
$buildId = ""+ $env:BUILD_BUILDID
$sorceV = "" +$env:BUILD_SOURCEVERSION
$buildId = "" + $env:BUILD_BUILDID
$sorceV = "" + $env:BUILD_SOURCEVERSION
$sign = "" + $env:SIGN
$reason = "" + $env:BUILD_REASON
echo $sorceV
echo $sourceBranchName
@ -67,22 +67,36 @@ steps:
}
}
}
if($reason -eq "Schedule")
{
$tags.Add("nightly-release")
}
#Tag this build
#check PublicTags also add them to the tag list
foreach($publicTag in $publicTags.Split(';'))
{
if($publicTag){
$tags.Add($publicTag);
}
if($publicTag){
$tags.Add($publicTag);
}
}
#Add tags to the VSTS Build
foreach ($tag in $tags) {
Write-Host "##vso[build.addbuildtag]$tag"
if($tag -eq "public-release")
{
$sign = 'true'
}
if($tag -eq "nightly-release")
{
$sign = 'true'
}
Write-Host "##vso[build.addbuildtag]$tag"
}
Write-Host "Sign: $sign"
$publicTags = $tags -join ';'
Write-Host "##vso[task.setvariable variable=publictags;isOutput=true;]$publicTags"
Write-Host "##vso[task.setvariable variable=sign;isOutput=true]$sign"
displayName: 'Tag and name build copy'
displayName: 'Tag and name build'
name: prepare

Просмотреть файл

@ -14,15 +14,10 @@ steps:
displayName: 'Build solution Xamarin.Forms.sln'
inputs:
solution: Xamarin.Forms.sln
msbuildVersion: 15.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/nowarn:VSX1000 /p:CreateAllAndroidTargets=true'
clean: true
@ -122,13 +117,9 @@ steps:
displayName: 'Copy files test adapter'
inputs:
Contents: '**/NUnitTestAdapter.*/tools/*.dll'
TargetFolder: '$(Build.ArtifactStagingDirectory)/testadapter'
CleanTargetFolder: true
OverWrite: true
flattenFolders: true