Skip to content

Commit 148cc7f

Browse files
Add project files.
1 parent a5f4f4b commit 148cc7f

7 files changed

+126
-0
lines changed

Additions/AboutAdditions.txt

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Additions allow you to add arbitrary C# to the generated classes
2+
before they are compiled. This can be helpful for providing convenience
3+
methods or adding pure C# classes.
4+
5+
== Adding Methods to Generated Classes ==
6+
7+
Let's say the library being bound has a Rectangle class with a constructor
8+
that takes an x and y position, and a width and length size. It will look like
9+
this:
10+
11+
public partial class Rectangle
12+
{
13+
public Rectangle (int x, int y, int width, int height)
14+
{
15+
// JNI bindings
16+
}
17+
}
18+
19+
Imagine we want to add a constructor to this class that takes a Point and
20+
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
21+
with a partial class containing our new method:
22+
23+
public partial class Rectangle
24+
{
25+
public Rectangle (Point location, Size size) :
26+
this (location.X, location.Y, size.Width, size.Height)
27+
{
28+
}
29+
}
30+
31+
At compile time, the additions class will be added to the generated class
32+
and the final assembly will a Rectangle class with both constructors.
33+
34+
35+
== Adding C# Classes ==
36+
37+
Another thing that can be done is adding fully C# managed classes to the
38+
generated library. In the above example, let's assume that there isn't a
39+
Point class available in Java or our library. The one we create doesn't need
40+
to interact with Java, so we'll create it like a normal class in C#.
41+
42+
By adding a Point.cs file with this class, it will end up in the binding library:
43+
44+
public class Point
45+
{
46+
public int X { get; set; }
47+
public int Y { get; set; }
48+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net7.0-android</TargetFramework>
4+
<SupportedOSPlatformVersion>14</SupportedOSPlatformVersion>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
<PropertyGroup>
9+
<Version>3.0.0</Version>
10+
<PackageLicenseUrl>https://github.com/google/flexbox-layout/blob/main/LICENSE</PackageLicenseUrl>
11+
<PackageProjectUrl>https://github.com/google/flexbox-layout</PackageProjectUrl>
12+
<RepositoryUrl>https://github.com/ShortDevelopment/ShortDev.Android.Google.FlexBox/</RepositoryUrl>
13+
</PropertyGroup>
14+
<ItemGroup>
15+
<None Remove="flexbox-3.0.0.aar" />
16+
</ItemGroup>
17+
</Project>

ShortDev.Android.Google.FlexBox.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33403.182
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShortDev.Android.Google.FlexBox", "ShortDev.Android.Google.FlexBox.csproj", "{6BB31715-0886-4A78-AE34-0DAE940AFABC}"
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+
{6BB31715-0886-4A78-AE34-0DAE940AFABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{6BB31715-0886-4A78-AE34-0DAE940AFABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{6BB31715-0886-4A78-AE34-0DAE940AFABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{6BB31715-0886-4A78-AE34-0DAE940AFABC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {8CABB3B5-A982-4D6C-9B45-87A68CC38703}
24+
EndGlobalSection
25+
EndGlobal

Transforms/EnumFields.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<enum-field-mappings>
2+
<!--
3+
This example converts the constants Fragment_id, Fragment_name,
4+
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
5+
to an enum called Android.Support.V4.App.FragmentTagType with values
6+
Id, Name, and Tag.
7+
8+
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
9+
<field jni-name="Fragment_name" clr-name="Name" value="0" />
10+
<field jni-name="Fragment_id" clr-name="Id" value="1" />
11+
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
12+
</mapping>
13+
-->
14+
</enum-field-mappings>

Transforms/EnumMethods.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<enum-method-mappings>
2+
<!--
3+
This example changes the Java method:
4+
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
5+
to be:
6+
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
7+
when bound in C#.
8+
9+
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
10+
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
11+
</mapping>
12+
-->
13+
</enum-method-mappings>

Transforms/Metadata.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<metadata>
2+
<!--
3+
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
4+
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
5+
6+
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
7+
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
8+
-->
9+
</metadata>

flexbox-3.0.0.aar

78.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)