Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 95e36ea

Browse files
committed
Added Constraint Layout and Solver bindings
1 parent 6eda796 commit 95e36ea

Some content is hidden

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

41 files changed

+1193
-0
lines changed

constraint-layout-solver/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Android Support Constraint Layout
2+
=================================
3+
4+
Xamarin creates and maintains Xamarin.Android bindings for the Google Android Support Constraint Layout Libraries, including:
5+
6+
- Constraint Layout
7+
- Constraint Layout Solver
8+
9+
10+
## License
11+
12+
See the top level [README.md](../README.md) for more information.
13+
14+
## Contribution Guidelines
15+
16+
See the top level [README.md](../README.md) for more information.
17+
18+
## .NET Foundation
19+
20+
See the top level [README.md](../README.md) for more information.
21+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>Xamarin.Android.Support.Constraint.Layout.Solver</id>
5+
<title>Xamarin Android Constraint Layout Solver</title>
6+
<version>$version$</version>
7+
<authors>Xamarin Inc.</authors>
8+
<owners>Xamarin Inc.</owners>
9+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
10+
<description>Android Constraint Layout Solver C# bindings for Xamarin</description>
11+
<copyright>Copyright © Microsoft Corporation</copyright>
12+
<projectUrl>https://github.com/xamarin/AndroidSupportComponents/</projectUrl>
13+
<licenseUrl>https://github.com/xamarin/AndroidSupportComponents/blob/master/LICENSE.md</licenseUrl>
14+
<iconUrl>https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/constraint-layout-solver_128x128.png</iconUrl>
15+
</metadata>
16+
<files>
17+
<file src="output/Xamarin.Android.Support.Constraint.Layout.Solver.dll" target="lib/MonoAndroid70" />
18+
</files>
19+
</package>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{84FD66DF-C448-425E-860F-C0B076EED150}</ProjectGuid>
7+
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>Android.Support.Constraints</RootNamespace>
10+
<AssemblyName>Xamarin.Android.Support.Constraint.Layout.Solver</AssemblyName>
11+
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
12+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
13+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
14+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
15+
<AndroidClassParser>class-parse</AndroidClassParser>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug</OutputPath>
22+
<DefineConstants>DEBUG;</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
<AndroidLinkMode>None</AndroidLinkMode>
26+
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugSymbols>true</DebugSymbols>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release</OutputPath>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
36+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
37+
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="System" />
41+
<Reference Include="System.Xml" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="Mono.Android" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<TransformFile Include="Transforms\EnumFields.xml" />
50+
<TransformFile Include="Transforms\EnumMethods.xml" />
51+
<TransformFile Include="Transforms\Metadata.xml" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<InputJar Include="..\..\externals\solver\constraint-layout-solver-1.0.0-alpha9.jar">
55+
<Link>Jars\constraint-layout-solver.jar</Link>
56+
</InputJar>
57+
</ItemGroup>
58+
<ItemGroup>
59+
<Folder Include="Additions\" />
60+
</ItemGroup>
61+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
62+
</Project>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using Android.App;
4+
5+
// Information about this assembly is defined by the following attributes.
6+
// Change them to the values specific to your project.
7+
8+
[assembly: AssemblyTitle ("Xamarin.Android.Support.Constraint.Layout.Solver")]
9+
[assembly: AssemblyDescription ("")]
10+
[assembly: AssemblyConfiguration ("")]
11+
[assembly: AssemblyCompany ("Microsoft Corporation")]
12+
[assembly: AssemblyProduct ("")]
13+
[assembly: AssemblyCopyright ("Copyright © Microsoft Corporation")]
14+
[assembly: AssemblyTrademark ("")]
15+
[assembly: AssemblyCulture ("")]
16+
17+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
18+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
19+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
20+
21+
[assembly: AssemblyVersion ("1.0.0")]
22+
23+
// The following attributes are used to specify the signing key for the assembly,
24+
// if desired. See the Mono documentation for more information about signing.
25+
26+
//[assembly: AssemblyDelaySign(false)]
27+
//[assembly: AssemblyKeyFile("")]
28+
29+
[assembly: Java.Interop.JavaLibraryReference (__Consts.JarPath,
30+
PackageName = __Consts.PackageName,
31+
SourceUrl = __Consts.Url,
32+
//EmbeddedArchive = __Consts.JarPath,
33+
Version = __Consts.Version,
34+
Sha1sum = __Consts.Sha1sum)]
35+
36+
//[assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
37+
// PackageName = __Consts.PackageName,
38+
// SourceUrl = __Consts.Url,
39+
// EmbeddedArchive = __Consts.AarPath,
40+
// Version = __Consts.Version,
41+
// Sha1sum = __Consts.Sha1sum)]
42+
43+
static class __Consts
44+
{
45+
public const string JarPath = "solver/constraint-layout-solver-" + JarVersion + ".jar";
46+
public const string JarVersion = "1.0.0-alpha9";
47+
public const string Version = JarVersion;
48+
public const string PackageName = "Xamarin.Android.Support.Constraint.Layout.Solver";
49+
public const string Url = "https://dl-ssl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-" + JarVersion + ".zip";
50+
public const string Sha1sum = "2c52ddd883d83230a17042b8f4ba03669f0f5f40";
51+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<enum-field-mappings>
3+
<!--
4+
This example converts the constants Fragment_id, Fragment_name,
5+
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
6+
to an enum called Android.Support.V4.App.FragmentTagType with values
7+
Id, Name, and Tag.
8+
9+
<mapping clr-enum-type="Android.Support.V4.App.FragmentTagType" jni-class="android/support/v4/app/FragmentActivity$FragmentTag">
10+
<field clr-name="Id" jni-name="Fragment_id" value="1" />
11+
<field clr-name="Name" jni-name="Fragment_name" value="0" />
12+
<field clr-name="Tag" jni-name="Fragment_tag" value="2" />
13+
</type>
14+
15+
Notes:
16+
- An optional "bitfield" attribute marks the enum type with [Flags].
17+
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
18+
-->
19+
</enum-field-mappings>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<enum-method-mappings>
3+
<!--
4+
This example changes the Java method:
5+
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
6+
to be:
7+
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
8+
when bound in C#.
9+
10+
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
11+
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
12+
</mapping>
13+
14+
Notes:
15+
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
16+
- To change the type of the return value, use "return" as the parameter name.
17+
- The parameter names will be p0, p1, ... unless you provide JavaDoc file in the project.
18+
-->
19+
</enum-method-mappings>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metadata>
3+
<attr path="/api/package[@name='android.support.constraint.solver']" name="managedName">Android.Support.Constraints.Solver</attr>
4+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']" name="managedName">Android.Support.Constraints.Solver.Widgets</attr>
5+
6+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='ConstraintAnchor']/method[@name='getType' and count(parameter)=0]" name="managedName">GetAnchorType</attr>
7+
8+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='RELATIVE_END']" name="managedName">RELATIVE_END</attr>
9+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='RELATIVE_BEGIN']" name="managedName">RELATIVE_BEGIN</attr>
10+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='RELATIVE_PERCENT']" name="managedName">RELATIVE_PERCENT</attr>
11+
<!-- Yes, google typo'd this, we'll fix it, and eventually they probably will too -->
12+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='RELATIVE_UNKNWON']" name="managedName">RELATIVE_UNKNOWN</attr>
13+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='VERTICAL']" name="managedName">VERTICAL</attr>
14+
<attr path="/api/package[@name='android.support.constraint.solver.widgets']/class[@name='Guideline']/field[@name='HORIZONTAL']" name="managedName">HORIZONTAL</attr>
15+
</metadata>
16+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConstraintLayout", "source\ConstraintLayout.csproj", "{045F2ED1-9752-4CC2-A73C-86A5B9E28C8F}"
5+
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConstraintLayoutSolver", "..\constraint-layout-solver\source\ConstraintLayoutSolver.csproj", "{84FD66DF-C448-425E-860F-C0B076EED150}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{045F2ED1-9752-4CC2-A73C-86A5B9E28C8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{045F2ED1-9752-4CC2-A73C-86A5B9E28C8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{045F2ED1-9752-4CC2-A73C-86A5B9E28C8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{045F2ED1-9752-4CC2-A73C-86A5B9E28C8F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
{84FD66DF-C448-425E-860F-C0B076EED150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{84FD66DF-C448-425E-860F-C0B076EED150}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{84FD66DF-C448-425E-860F-C0B076EED150}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{84FD66DF-C448-425E-860F-C0B076EED150}.Release|Any CPU.Build.0 = Release|Any CPU
22+
EndGlobalSection
23+
EndGlobal

constraint-layout/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Android Support Constraint Layout
2+
=================================
3+
4+
Xamarin creates and maintains Xamarin.Android bindings for the Google Android Support Constraint Layout Libraries, including:
5+
6+
- Constraint Layout
7+
- Constraint Layout Solver
8+
9+
10+
## License
11+
12+
See the top level [README.md](../README.md) for more information.
13+
14+
## Contribution Guidelines
15+
16+
See the top level [README.md](../README.md) for more information.
17+
18+
## .NET Foundation
19+
20+
See the top level [README.md](../README.md) for more information.
21+

constraint-layout/build.cake

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#tool nuget:?package=XamarinComponent
2+
3+
#addin nuget:?package=Cake.Xamarin
4+
#addin nuget:?package=Cake.Xamarin.Build
5+
6+
var TARGET = Argument ("target", Argument ("t", "Default"));
7+
8+
9+
var NUGET_VERSION = "1.0.0-alpha9";
10+
var AAR_VERSION = "1.0.0-alpha9";
11+
12+
var CONSTRAINT_LAYOUT_URL = string.Format ("https://dl-ssl.google.com/android/repository/com.android.support.constraint-constraint-layout-{0}.zip", AAR_VERSION);
13+
var CONSTRAINT_LAYOUT_SOLVER_URL = string.Format ("https://dl-ssl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-{0}.zip", AAR_VERSION);
14+
15+
16+
var buildSpec = new BuildSpec {
17+
Libs = new [] {
18+
new DefaultSolutionBuilder {
19+
SolutionPath = "./ConstraintLayout.sln",
20+
BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac,
21+
OutputFiles = new [] {
22+
new OutputFileCopy { FromFile = "./source/bin/Release/Xamarin.Android.Support.Constraint.Layout.dll", ToDirectory = "./output/" },
23+
new OutputFileCopy { FromFile = "../constraint-layout-solver/source/bin/Release/Xamarin.Android.Support.Constraint.Layout.Solver.dll", ToDirectory = "./output/" },
24+
}
25+
}
26+
},
27+
28+
Samples = new [] {
29+
new DefaultSolutionBuilder { SolutionPath = "./samples/ConstraintLayoutSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
30+
},
31+
32+
NuGets = new [] {
33+
new NuGetInfo { NuSpec = "./nuget/Xamarin.Android.Support.Constraint.Layout.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
34+
new NuGetInfo { NuSpec = "../constraint-layout-solver/nuget/Xamarin.Android.Support.Constraint.Layout.Solver.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
35+
},
36+
};
37+
38+
39+
Task ("externals")
40+
.WithCriteria (() => !FileExists ("../externals/constraintlayout/classes.jar")).Does (() =>
41+
{
42+
var path = "../externals/";
43+
44+
EnsureDirectoryExists (path);
45+
46+
// Get the actual .aar files and extract
47+
if (!FileExists (path + "constraintlayout.zip"))
48+
DownloadFile (CONSTRAINT_LAYOUT_URL, path + "constraintlayout.zip");
49+
if (!FileExists (path + "constraintlayout/source.properties"))
50+
Unzip(path + "constraintlayout.zip", path);
51+
Unzip (path + "constraintlayout/constraint-layout-" + AAR_VERSION + ".aar", path + "constraintlayout/");
52+
53+
if (!FileExists (path + "constraintlayoutsolver.zip"))
54+
DownloadFile (CONSTRAINT_LAYOUT_SOLVER_URL, path + "constraintlayoutsolver.zip");
55+
if (!FileExists (path + "solver/source.properties"))
56+
Unzip(path + "constraintlayoutsolver.zip", path);
57+
});
58+
59+
Task ("clean").IsDependentOn ("clean-base").Does (() =>
60+
{
61+
if (DirectoryExists ("../externals/constraintlayout"))
62+
DeleteDirectory ("../externals/constraintlayout", true);
63+
if (FileExists ("../externals/constraintlayout.zip"))
64+
DeleteFile ("../externals/constraintlayout.zip");
65+
66+
if (DirectoryExists ("../externals/solver"))
67+
DeleteDirectory ("../externals/solver", true);
68+
if (FileExists ("../externals/solver.zip"))
69+
DeleteFile ("../externals/solver.zip");
70+
71+
if (DirectoryExists ("./output"))
72+
DeleteDirectory ("./output", true);
73+
});
74+
75+
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
76+
77+
RunTarget (TARGET);

0 commit comments

Comments
 (0)