Skip to content

Commit

Permalink
Merge pull request #9 from realZhangChi/PhotoEditor
Browse files Browse the repository at this point in the history
Photo editor
  • Loading branch information
realZhangChi authored Mar 15, 2023
2 parents adfc51e + 611fe21 commit 979e454
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/src/Toaster/**/*.aar
/src/WeChat/**/*.aar
/src/DialogX/**/*.aar
/src/PhotoEditor/**/*.aar
10 changes: 10 additions & 0 deletions MauiBinding.sln
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiguangJCore", "src\Jiguang
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiguangJPush", "src\Jiguang\Android\JiguangJPush\JiguangJPush.csproj", "{0BEF6D6F-6C3A-42F6-8AEA-953F08645603}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PhotoEditor", "PhotoEditor", "{D13DFF5D-6C74-4A75-8BFC-4E20C13F7566}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PhotoEditor", "src\PhotoEditor\PhotoEditor\PhotoEditor.csproj", "{6CB73F49-5F0F-4A0E-8445-B7DF971206A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -193,6 +197,10 @@ Global
{0BEF6D6F-6C3A-42F6-8AEA-953F08645603}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BEF6D6F-6C3A-42F6-8AEA-953F08645603}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BEF6D6F-6C3A-42F6-8AEA-953F08645603}.Release|Any CPU.Build.0 = Release|Any CPU
{6CB73F49-5F0F-4A0E-8445-B7DF971206A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CB73F49-5F0F-4A0E-8445-B7DF971206A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CB73F49-5F0F-4A0E-8445-B7DF971206A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CB73F49-5F0F-4A0E-8445-B7DF971206A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -235,6 +243,8 @@ Global
{0F7B07CB-D9D7-4AA2-945A-4B3AB3CA28D8} = {595DE70F-BC33-41BA-8363-81243AC63C5D}
{8D1435D2-2A9E-40EB-86AF-8C6BB15B3BFC} = {D90C3D34-C53C-44EB-A0C5-2ECDFA3C2532}
{0BEF6D6F-6C3A-42F6-8AEA-953F08645603} = {D90C3D34-C53C-44EB-A0C5-2ECDFA3C2532}
{D13DFF5D-6C74-4A75-8BFC-4E20C13F7566} = {79968845-C170-45B7-AEFC-0D5BFA3DD64B}
{6CB73F49-5F0F-4A0E-8445-B7DF971206A5} = {D13DFF5D-6C74-4A75-8BFC-4E20C13F7566}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5E6D9B10-AA5C-45F6-A8F2-3C896718F3A6}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [EasyFloat](https://github.com/realZhangChi/MauiBinding/tree/main/src/EasyFloat)
- [Ezviz(萤石)](https://github.com/realZhangChi/MauiBinding/tree/main/src/Ezviz)
- [Getui(个推)](https://github.com/realZhangChi/MauiBinding/tree/main/src/Getui)
- [PhotoEditor](https://github.com/realZhangChi/MauiBinding/tree/main/src/PhotoEditor)
- [Jiguang(极光)](https://github.com/realZhangChi/MauiBinding/tree/main/src/Jiguang)
- [Toaster](https://github.com/realZhangChi/MauiBinding/tree/main/src/Toaster)
- [WeChat](https://github.com/realZhangChi/MauiBinding/tree/main/src/WeChat)
Expand Down
48 changes: 48 additions & 0 deletions src/PhotoEditor/PhotoEditor/Additions/AboutAdditions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Additions allow you to add arbitrary C# to the generated classes
before they are compiled. This can be helpful for providing convenience
methods or adding pure C# classes.

== Adding Methods to Generated Classes ==

Let's say the library being bound has a Rectangle class with a constructor
that takes an x and y position, and a width and length size. It will look like
this:

public partial class Rectangle
{
public Rectangle (int x, int y, int width, int height)
{
// JNI bindings
}
}

Imagine we want to add a constructor to this class that takes a Point and
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
with a partial class containing our new method:

public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}

At compile time, the additions class will be added to the generated class
and the final assembly will a Rectangle class with both constructors.


== Adding C# Classes ==

Another thing that can be done is adding fully C# managed classes to the
generated library. In the above example, let's assume that there isn't a
Point class available in Java or our library. The one we create doesn't need
to interact with Java, so we'll create it like a normal class in C#.

By adding a Point.cs file with this class, it will end up in the binding library:

public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
2 changes: 2 additions & 0 deletions src/PhotoEditor/PhotoEditor/NativeAsset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://repo1.maven.org/maven2/com/burhanrashid52/photoeditor/3.0.0/photoeditor-3.0.0.aar
PhotoEditor.aar
28 changes: 28 additions & 0 deletions src/PhotoEditor/PhotoEditor/PhotoEditor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<Version>3.0.0</Version>
<Description>Maui binding library for https://github.com/burhanrashid52/PhotoEditor.</Description>
<PackageId>$(PackageIdPrefix).Android.PhotoEditor</PackageId>
<Title>$(PackageIdPrefix).Android.PhotoEditor</Title>
</PropertyGroup>

<ItemGroup>
<None Remove="PhotoEditor.aar" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.6.0.1" />
<PackageReference Include="Xamarin.AndroidX.Core.Core.Ktx" Version="1.9.0.2" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.8.10" />
<PackageReference Include="Xamarin.KotlinX.Coroutines.Android" Version="1.6.4.2" />
<PackageReference Include="Xamarin.KotlinX.Coroutines.Core" Version="1.6.4.2" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions src/PhotoEditor/PhotoEditor/Transforms/EnumFields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<enum-field-mappings>
<!--
This example converts the constants Fragment_id, Fragment_name,
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
to an enum called Android.Support.V4.App.FragmentTagType with values
Id, Name, and Tag.
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
<field jni-name="Fragment_name" clr-name="Name" value="0" />
<field jni-name="Fragment_id" clr-name="Id" value="1" />
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
</mapping>
-->
</enum-field-mappings>
13 changes: 13 additions & 0 deletions src/PhotoEditor/PhotoEditor/Transforms/EnumMethods.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<enum-method-mappings>
<!--
This example changes the Java method:
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
to be:
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
when bound in C#.
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
</mapping>
-->
</enum-method-mappings>
11 changes: 11 additions & 0 deletions src/PhotoEditor/PhotoEditor/Transforms/Metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->

<attr path="/api/package[@name='ja.burhanrashid52.photoeditor']/class[@name='TextStyleBuilder.TextStyle']/field[@name='TEXT_STYLE']" name="managedName">TextStyle_</attr>
</metadata>
9 changes: 9 additions & 0 deletions src/PhotoEditor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Maui binding library for PhotoEditor

See [PhotoEditor repository](https://github.com/burhanrashid52/PhotoEditor) for details.

## Android

| Binding library | Native SDK | Nuget |
|:-| :-: | :-: |
|Chi.MauiBinding.Android.PhotoEditor| [photoeditor-3.0.0.aar](https://central.sonatype.com/artifact/com.burhanrashid52/photoeditor/3.0.0)| [![NuGet](https://buildstats.info/nuget/Chi.MauiBinding.Android.PhotoEditor?includePreReleases=false)](https://www.nuget.org/packages/Chi.MauiBinding.Android.PhotoEditor/ "Download Chi.MauiBinding.Android.PhotoEditor from NuGet.org") |

0 comments on commit 979e454

Please sign in to comment.