This commit is contained in:
ShaneN 2019-04-08 13:17:37 -06:00
Родитель c013f64e48 d5dd812907
Коммит 5475846880
11 изменённых файлов: 62 добавлений и 38 удалений

3
.gitattributes поставляемый
Просмотреть файл

@ -15,3 +15,6 @@
# Always checkout docs using unix line endings because mdoc uses unix line endings even on windows
/docs/**/*.xml text eol=lf
# avoid overriding GitInfo.txt on merge
GitInfo.txt merge=ours

2
.gitconfig Normal file
Просмотреть файл

@ -0,0 +1,2 @@
[merge "ours"]
driver = true

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

@ -56,19 +56,26 @@ We also recommend installing [Xamarin Android Device Manager](https://developer.
If you already have VS 2017 installed, you can verify that these features are installed by modifying the VS 2017 installation via the Visual Studio Installer.
### Mac ###
#### Install Visual Studio for Mac ####
#### Install Visual Studio for Mac 2019 ####
If you do not already have it installed, instructions to download and setup can be found [here](https://docs.microsoft.com/en-us/visualstudio/mac/installation?view=vsmac-2017).
Because of current Multi-Targeting limitations with Visual Studio for Mac you will need to manually build/restore some projects before you are able to work on the Xamarin Forms solution.
Here are two different options we've put together to help make this process easier
Here are a few different options we've put together to help make this process easier
- Branches 3.5+ come with a Cake script target that you can use to build and open VSMac
```sh
./build.sh --target vsmac
```
- When working on an earlier branch that does not have the cake scripts then you can use the following [build.sh] script(https://gist.github.com/PureWeen/92c1e1aff0c257c3decf0bcb8d6e9296)
- If you don't want to run any scripts then
- Open Xamarin.Forms.sln
- Wait for VSMAC to finish restoring all projects
- from the command line run:
- `msbuild Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj`
- Now you should be able to run and deploy everything. The only reason you would need to do this process again is if you clean the solution folder or delete the bin/obj folders that are part of the `Xamarin.Forms.Build.Tasks.csproj`
If you are on Visual Studio for Mac 2017 you will need to turn off automatic package restore (Visual Studio => Preferences => Nuget => General => uncheck the Package Restore box) before working on the Xamarin.Forms solution. This step is no longer needed with Visual Studio for Mac 2019
##### Solution Configuration #####
@ -120,5 +127,4 @@ We follow the style used by the [.NET Foundation](https://github.com/dotnet/core
### Reporting Bugs ###
We use [GitHub Issues](https://github.com/xamarin/Xamarin.Forms/issues) to track issues. If at all possible, please submit a [reproduction of your bug](https://gist.github.com/jassmith/92405c300e54a01dcc6d) along with your bug report.
We use [GitHub Issues](https://github.com/xamarin/Xamarin.Forms/issues) to track issues. If at all possible, please submit a [reproduction of your bug](https://gist.github.com/jassmith/92405c300e54a01dcc6d) along with your bug report.

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

@ -5,28 +5,24 @@ namespace Xamarin.Forms
{
public abstract class Behavior : BindableObject, IAttachedObject
{
internal Behavior(Type associatedType)
protected Behavior() : this(typeof(BindableObject))
{
if (associatedType == null)
throw new ArgumentNullException("associatedType");
AssociatedType = associatedType;
}
internal Behavior(Type associatedType) => AssociatedType = associatedType ?? throw new ArgumentNullException(nameof(associatedType));
protected Type AssociatedType { get; }
void IAttachedObject.AttachTo(BindableObject bindable)
{
if (bindable == null)
throw new ArgumentNullException("bindable");
throw new ArgumentNullException(nameof(bindable));
if (!AssociatedType.IsInstanceOfType(bindable))
throw new InvalidOperationException("bindable not an instance of AssociatedType");
OnAttachedTo(bindable);
}
void IAttachedObject.DetachFrom(BindableObject bindable)
{
OnDetachingFrom(bindable);
}
void IAttachedObject.DetachFrom(BindableObject bindable) => OnDetachingFrom(bindable);
protected virtual void OnAttachedTo(BindableObject bindable)
{

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

@ -29,7 +29,6 @@ namespace Xamarin.Forms.Material.Android
_textInputLayout = (MaterialFormsTextInputLayout)view;
_textInputEditText = _textInputLayout.FindViewById<MaterialFormsEditText>(Resource.Id.materialformsedittext);
_textInputEditText.ImeOptions = ImeAction.Done;
UpdatePlaceholderText();
return _textInputLayout;
}

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

@ -113,16 +113,14 @@ namespace Xamarin.Forms.Material.Android
internal void SetHint(string hint, VisualElement element)
{
if (HintEnabled != !String.IsNullOrWhiteSpace(hint))
HintEnabled = !string.IsNullOrWhiteSpace(hint);
if (HintEnabled)
{
HintEnabled = !String.IsNullOrWhiteSpace(hint);
Hint = hint ?? String.Empty;
EditText.Hint = String.Empty;
element?.InvalidateMeasureNonVirtual(Internals.InvalidationTrigger.VerticalOptionsChanged);
}
else
{
Hint = hint ?? String.Empty;
Hint = hint;
// EditText.Hint => Hint
// It is impossible to reset it but you can make it invisible.
EditText.SetHintTextColor(global::Android.Graphics.Color.Transparent);
}
}

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

@ -190,6 +190,9 @@ namespace Xamarin.Forms.Platform.iOS
public sealed class FontImageSourceHandler : IImageSourceHandler
{
//should this be the default color on the BP for iOS?
readonly Color _defaultColor = Color.White;
public Task<UIImage> LoadImageAsync(
ImageSource imagesource,
CancellationToken cancelationToken = default(CancellationToken),
@ -199,7 +202,7 @@ namespace Xamarin.Forms.Platform.iOS
var fontsource = imagesource as FontImageSource;
if (fontsource != null)
{
var iconcolor = fontsource.Color != Color.Default ? fontsource.Color : Color.White;
var iconcolor = fontsource.Color.IsDefault ? _defaultColor : fontsource.Color;
var imagesize = new SizeF((float)fontsource.Size, (float)fontsource.Size);
var font = UIFont.FromName(fontsource.FontFamily ?? string.Empty, (float)fontsource.Size) ??
UIFont.SystemFontOfSize((float)fontsource.Size);
@ -216,7 +219,7 @@ namespace Xamarin.Forms.Platform.iOS
image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
if (iconcolor != Color.Default)
if (iconcolor != _defaultColor)
image = image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
}
return Task.FromResult(image);

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

@ -607,7 +607,6 @@ namespace Xamarin.Forms.Xaml.UnitTests
string clrNamespace = null;
string typeName = null;
XamlLoader.FallbackTypeResolver = (fallbackTypeInfos, type) =>
{
assemblyName = fallbackTypeInfos?[1].AssemblyName;
@ -682,6 +681,24 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
Assert.That(exceptions.Count, Is.GreaterThanOrEqualTo(1));
}
[Test]
public void MissingGenericRootTypeProvidesCorrectTypeName()
{
var xaml = @"
<local:GenericContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
xmlns:local=""clr-namespace:MissingNamespace""
x:TypeArguments=""x:Object"" />";
XamlLoader.FallbackTypeResolver = (p, type) =>
{
Assert.That(p.Select(i => i.TypeName), Has.Some.EqualTo("GenericContentPage`1"));
return typeof(ContentPage);
};
Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
}
}
public class InstantiateThrows

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

@ -119,7 +119,8 @@ namespace Xamarin.Forms.Xaml
continue;
}
var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), null, (IXmlNamespaceResolver)reader);
var typeArguments = XamlParser.GetTypeArguments(reader);
var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, typeArguments), null, (IXmlNamespaceResolver)reader);
XamlParser.ParseXaml(rootnode, reader);
var visitorContext = new HydrationContext {
ExceptionHandler = exceptionHandler,

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

@ -165,10 +165,7 @@ namespace Xamarin.Forms.Xaml
var attributes = ParseXamlAttributes(reader, out xmlns);
var prefixes = PrefixesToIgnore(xmlns);
IList<XmlType> typeArguments = null;
if (attributes.Any(kvp => kvp.Key == XmlName.xTypeArguments))
typeArguments = ((ValueNode)attributes.First(kvp => kvp.Key == XmlName.xTypeArguments).Value).Value as IList<XmlType>;
var typeArguments = GetTypeArguments(attributes);
node = new ElementNode(new XmlType(elementNsUri, elementName, typeArguments), elementNsUri,
reader as IXmlNamespaceResolver, elementXmlInfo.LineNumber, elementXmlInfo.LinePosition);
@ -195,6 +192,15 @@ namespace Xamarin.Forms.Xaml
throw new XamlParseException("Closing PropertyElement expected", (IXmlLineInfo)reader);
}
internal static IList<XmlType> GetTypeArguments(XmlReader reader) => GetTypeArguments(ParseXamlAttributes(reader, out _));
static IList<XmlType> GetTypeArguments(IList<KeyValuePair<XmlName, INode>> attributes)
{
return attributes.Any(kvp => kvp.Key == XmlName.xTypeArguments)
? ((ValueNode)attributes.First(kvp => kvp.Key == XmlName.xTypeArguments).Value).Value as IList<XmlType>
: null;
}
static IList<KeyValuePair<XmlName, INode>> ParseXamlAttributes(XmlReader reader, out IList<KeyValuePair<string,string>> xmlns)
{
Debug.Assert(reader.NodeType == XmlNodeType.Element);

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

@ -140,13 +140,6 @@ Task("VSMAC")
.IsDependentOn("BuildHack")
.Does(() =>
{
MSBuild("./Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj",
GetMSBuildSettings()
.WithRestore()
// work around bug on vs mac where resources generate wrong first time
.WithTarget("rebuild")
);
StartProcess("open", new ProcessSettings{ Arguments = "Xamarin.Forms.sln" });
});
@ -201,4 +194,4 @@ MSBuildSettings GetMSBuildSettings()
msbuildSettings.Configuration = configuration;
return msbuildSettings;
}
}