This commit is contained in:
Samantha Houts 2020-03-30 17:19:18 -07:00
Родитель 1be09cb36d 80bb094ec6
Коммит 2877eb35f6
12 изменённых файлов: 176 добавлений и 51 удалений

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

@ -47,6 +47,9 @@
<file src="_._" target="lib\MonoAndroid10\_._" />
<file src="Xamarin.Forms.Visual.Material.targets" target="build\MonoAndroid10\Xamarin.Forms.Visual.Material.targets" />
<!--Android 10 buildTransitive-->
<file src="Xamarin.Forms.Visual.Material.targets" target="buildTransitive\MonoAndroid10\Xamarin.Forms.Visual.Material.targets" />
<!--Android 90-->
<file src="..\Xamarin.Forms.Material.Android\bin\$Configuration$\monoandroid90\Xamarin.Forms.Material.dll" target="lib\MonoAndroid90" />
<file src="..\Xamarin.Forms.Material.Android\bin\$Configuration$\monoandroid90\Xamarin.Forms.Material.*pdb" target="lib\MonoAndroid90" />
@ -65,5 +68,6 @@
<!--Tizen-->
<file src="..\Xamarin.Forms.Material.Tizen\bin\$Configuration$\tizen40\Xamarin.Forms.Material.dll" target="lib\tizen40" />
<file src="..\Xamarin.Forms.Material.Tizen\bin\$Configuration$\tizen40\Xamarin.Forms.Material.*pdb" target="lib\tizen40" />
</files>
</package>

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

@ -152,6 +152,28 @@
<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" />
<!--Xamlc stuff buildTransitive-->
<file src="Xamarin.Forms.targets" target="buildTransitive" />
<file src="Xamarin.Forms.props" target="buildTransitive" />
<file src="Xamarin.Forms.DefaultItems.targets" target="buildTransitive" />
<file src="Xamarin.Forms.DefaultItems.props" target="buildTransitive" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Build.Tasks.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Xaml.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.Mdb.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.Pdb.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\Mono.Cecil.Rocks.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\netstandard2.0\System.CodeDom.dll" target="buildTransitive\netstandard2.0" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Build.Tasks.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Core.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Xamarin.Forms.Xaml.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Mdb.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Pdb.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\Mono.Cecil.Rocks.dll" target="buildTransitive\net46" />
<file src="..\Xamarin.Forms.Build.Tasks\bin\$Configuration$\net46\System.ValueTuple.dll" target="buildTransitive\net46" />
<!-- Xaml Design-time Stuff -->
<file src="..\Xamarin.Forms.Core.Design\bin\$Configuration$\Xamarin.Forms.Core.Design.dll" target="lib\netstandard2.0\Design" />
<file src="..\Xamarin.Forms.Xaml.Design\bin\$Configuration$\Xamarin.Forms.Xaml.Design.dll" target="lib\netstandard2.0\Design" />
@ -174,6 +196,8 @@
<!--Android 10-->
<file src="proguard.cfg" target="build\MonoAndroid10\proguard.cfg" />
<file src="proguard.cfg" target="buildTransitive\MonoAndroid10\proguard.cfg" />
<!--Android 90-->
<file src="..\Xamarin.Forms.Platform.Android\bin\$Configuration$\MonoAndroid90\Xamarin.Forms.Platform.Android.dll" target="lib\MonoAndroid90" />
@ -213,6 +237,15 @@
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*pdb" target="build\XCODE10" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*mdb" target="build\XCODE10" />
<!--iPhone Unified buildTransitive-->
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.dll" target="buildTransitive\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*pdb" target="buildTransitive\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*mdb" target="buildTransitive\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.dll" target="buildTransitive\XCODE10" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*pdb" target="buildTransitive\XCODE10" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*mdb" target="buildTransitive\XCODE10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*pdb" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*mdb" target="lib\Xamarin.iOS10" />
@ -269,6 +302,10 @@
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.macOS.dll" target="build\XCODE11" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.macOS.dll" target="build\XCODE10" />
<!--Mac buildTransitive-->
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.macOS.dll" target="buildTransitive\XCODE11" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.macOS.dll" target="buildTransitive\XCODE10" />
<!-- iOS Localized String Resource Assemblies -->
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\ar\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\ar" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\ca\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\ca" />
@ -316,6 +353,7 @@
<file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Xaml.dll" target="lib\tizen40" />
<file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Xaml.*pdb" target="lib\tizen40" />
<file src="..\docs\Xamarin.Forms.Xaml.xml" target="lib\tizen40" />
</files>
</package>

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

@ -1,9 +1,14 @@
-keep class android.support.v7.widget.FitWindowsFrameLayout { *; }
-dontwarn android.support.v7.widget.FitWindowsFrameLayout
-keep class androidx.appcompat.widget.FitWindowsFrameLayout { *; }
-dontwarn androidx.appcompat.widget.FitWindowsFrameLayout
-keep class android.support.design.** { *; }
-keep class android.support.multidex.MultiDexApplication { *; }
-keep class androidx.multidex.MultiDexApplication { *; }
-keep class android.support.design.internal.BaselineLayout { *; }
-dontwarn android.support.design.internal.BaselineLayout
-keep class com.google.android.material.internal.BaselineLayout { *; }
-dontwarn com.google.android.material.internal.BaselineLayout
-keep class com.google.firebase.provider.FirebaseInitProvider { *; }
-keep class androidx.appcompat.widget.AlertDialogLayout { *; }
-keep class androidx.appcompat.widget.DialogTitle { *; }

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

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
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
{
[Issue(IssueTracker.Github, 8766, "[Bug] CollectionView.EmptyView does not inherit parent Visual", PlatformAffected.All)]
public class Issue8766 : TestContentPage
{
protected override void Init()
{
Visual = VisualMarker.Material;
var layout = new StackLayout();
var instructions = new Label { Text = "If the Entry and Button above the CollectionView and the Entry and Button inside the CollectionView, should both be using the Material Visual. If so, this test has passed."};
layout.Children.Add(instructions);
var entry = new Entry { Placeholder = "I am material" };
var button = new Button { Text = "I am material" };
layout.Children.Add(entry);
layout.Children.Add(button);
var colv = new CollectionView() { };
var emptyViewEntry = new Entry { Placeholder = "I should be material" };
var emptyViewButton = new Button { Text = "I should be material, too" };
var stack = new StackLayout { Children = { emptyViewEntry, emptyViewButton } };
colv.EmptyView = stack;
layout.Children.Add(colv);
Content = layout;
}
#if UITEST
[Test]
[Category(UITestCategories.ManualReview)]
public void VisualPropagatesToEmptyView()
{
RunningApp.Screenshot("CollectionViewWithEmptyView");
}
#endif
}
}

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

@ -25,6 +25,7 @@
<DependentUpon>Issue8715.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue8766.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8801.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9428.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9419.cs" />

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

@ -462,43 +462,6 @@ namespace Xamarin.Forms
internal event EventHandler ParentSet;
internal static void SetFlowDirectionFromParent(Element child)
{
IFlowDirectionController controller = child as IFlowDirectionController;
if (controller == null)
return;
if (controller.EffectiveFlowDirection.IsImplicit())
{
var parentView = child.Parent as IFlowDirectionController;
if (parentView == null)
return;
var flowDirection = parentView.EffectiveFlowDirection.ToFlowDirection();
if (flowDirection != controller.EffectiveFlowDirection.ToFlowDirection())
{
controller.EffectiveFlowDirection = flowDirection.ToEffectiveFlowDirection();
}
}
}
internal static void SetVisualfromParent(Element child)
{
IVisualController controller = child as IVisualController;
if (controller == null)
return;
if (controller.Visual != VisualMarker.MatchParent)
{
controller.EffectiveVisual = controller.Visual;
return;
}
if (child.Parent is IVisualController parentView)
controller.EffectiveVisual = parentView.EffectiveVisual;
}
internal virtual void SetChildInheritedBindingContext(Element child, object context)
{
SetInheritedBindingContext(child, context);

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

@ -5,15 +5,15 @@ using System.Text;
namespace Xamarin.Forms.Internals
{
internal static class PropertyPropagationExtensions
public static class PropertyPropagationExtensions
{
public static void PropagatePropertyChanged(string propertyName, Element element, IEnumerable children)
internal static void PropagatePropertyChanged(string propertyName, Element element, IEnumerable children)
{
if (propertyName == null || propertyName == VisualElement.FlowDirectionProperty.PropertyName)
Element.SetFlowDirectionFromParent(element);
SetFlowDirectionFromParent(element);
if (propertyName == null || propertyName == VisualElement.VisualProperty.PropertyName)
Element.SetVisualfromParent(element);
SetVisualfromParent(element);
if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName)
BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element);
@ -31,16 +31,63 @@ namespace Xamarin.Forms.Internals
}
}
internal static void PropagatePropertyChanged(string propertyName, Element element)
public static void PropagatePropertyChanged(string propertyName, Element target, Element source)
{
if (propertyName == null || propertyName == VisualElement.FlowDirectionProperty.PropertyName)
Element.SetFlowDirectionFromParent(element);
PropagateFlowDirection(target, source);
if (propertyName == null || propertyName == VisualElement.VisualProperty.PropertyName)
Element.SetVisualfromParent(element);
PropagateVisual(target, source);
if (element is IPropertyPropagationController view)
view.PropagatePropertyChanged(propertyName);
if (target is IPropertyPropagationController view)
view.PropagatePropertyChanged(propertyName);
}
internal static void PropagateFlowDirection(Element target, Element source)
{
IFlowDirectionController targetController = target as IFlowDirectionController;
if (targetController == null)
return;
if (targetController.EffectiveFlowDirection.IsImplicit())
{
var sourceController = source as IFlowDirectionController;
if (sourceController == null)
return;
var flowDirection = sourceController.EffectiveFlowDirection.ToFlowDirection();
if (flowDirection != targetController.EffectiveFlowDirection.ToFlowDirection())
{
targetController.EffectiveFlowDirection = flowDirection.ToEffectiveFlowDirection();
}
}
}
internal static void SetFlowDirectionFromParent(Element child)
{
PropagateFlowDirection(child, child.Parent);
}
internal static void PropagateVisual(Element target, Element source)
{
IVisualController targetController = target as IVisualController;
if (targetController == null)
return;
if (targetController.Visual != VisualMarker.MatchParent)
{
targetController.EffectiveVisual = targetController.Visual;
return;
}
if (source is IVisualController sourceController)
targetController.EffectiveVisual = sourceController.EffectiveVisual;
}
internal static void SetVisualfromParent(Element child)
{
PropagateVisual(child, child.Parent);
}
}
}

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

@ -97,8 +97,6 @@ namespace Xamarin.Forms
_logicalChildren.Add(element);
PropertyPropagationExtensions.PropagatePropertyChanged(null, element);
element.Parent = this;
}

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

@ -234,7 +234,7 @@ namespace Xamarin.Forms.Platform.Android
}
// EmptyView is a Forms View; display that
return SimpleViewHolder.FromFormsView(formsView, context, () => GetWidth(parent), () => GetHeight(parent));
return SimpleViewHolder.FromFormsView(formsView, context, () => GetWidth(parent), () => GetHeight(parent), ItemsView);
}
var itemContentView = new SizedItemContentView(parent.Context, () => GetWidth(parent), () => GetHeight(parent));

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

@ -41,10 +41,14 @@ namespace Xamarin.Forms.Platform.Android
return new SimpleViewHolder(textView, null);
}
public static SimpleViewHolder FromFormsView(View formsView, Context context, Func<int> width, Func<int> height)
public static SimpleViewHolder FromFormsView(View formsView, Context context, Func<int> width, Func<int> height, ItemsView container)
{
var itemContentControl = new SizedItemContentView(context, width, height);
// Make sure the Visual property is available during renderer creation
Internals.PropertyPropagationExtensions.PropagatePropertyChanged(null, formsView, container);
itemContentControl.RealizeContent(formsView);
return new SimpleViewHolder(itemContentControl, formsView);
}

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

@ -57,8 +57,12 @@ namespace Xamarin.Forms.Platform.Android
// available during OnElementChanged
View.BindingContext = itemBindingContext;
// Make sure the Visual property is available when the renderer is created
PropertyPropagationExtensions.PropagatePropertyChanged(null, View, itemsView);
// Actually create the native renderer
_itemContentView.RealizeContent(View);
_selectedTemplate = template;
}

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

@ -31,8 +31,12 @@ namespace Xamarin.Forms.Platform.iOS
// We have a template; turn it into a Forms view
var templateElement = viewTemplate.CreateContent() as View;
var renderer = CreateRenderer(templateElement);
// Make sure the Visual property is available when the renderer is created
PropertyPropagationExtensions.PropagatePropertyChanged(null, templateElement, itemsView);
var renderer = CreateRenderer(templateElement);
// and set the EmptyView as its BindingContext
BindableObject.SetInheritedBindingContext(renderer.Element, view);
@ -41,6 +45,9 @@ namespace Xamarin.Forms.Platform.iOS
if (view is View formsView)
{
// Make sure the Visual property is available when the renderer is created
PropertyPropagationExtensions.PropagatePropertyChanged(null, formsView, itemsView);
// No template, and the EmptyView is a Forms view; use that
var renderer = CreateRenderer(formsView);