From 70a80eaaea19bd7ec14f42bf022f3e0216ac6960 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 08 一月 2021 10:41:21 +0800 Subject: [PATCH] 2021-01-08 1.JLCountryCode Android和iOS xamarin库。 --- iOS/Shared.IOS.JLCountryCode.dll | 0 Shared.Droid.YCStatusBarLib/Properties/AssemblyInfo.cs | 30 ++ .gitignore | 218 ++++++++++++- Shared.IOS.JLCountryCode.dll | 0 Shared.Droid.JLCountryCode/Transforms/EnumMethods.xml | 14 Shared.Droid.JLCountryCode/Properties/AssemblyInfo.cs | 30 ++ Shared.Droid.JLCountryCode/Transforms/EnumFields.xml | 15 + Shared.Droid.YCStatusBarLib/Transforms/Metadata.xml | 10 Shared.IOS.JLCountryCode/Library/countryCodeCH.plist | 0 Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.sln | 29 + Android/Shared.Droid.JLCountryCode.dll | 0 Shared.IOS.JLCountryCode/Resources/countryCodeCH.plist | 0 Shared.Droid.JLCountryCode/Jars/AboutJars.txt | 24 + iOS/Jlcountrycode.cs | 44 ++ Shared.IOS.JLCountryCode/Library/countryCodeEN.plist | 0 Shared.IOS.JLCountryCode/Library/libJLCountryCode.a | 0 Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.csproj | 59 +++ Shared.Droid.YCStatusBarLib/Jars/YCStatusBarLib-V1.0.1.aar | 0 Shared.IOS.JLCountryCode/Properties/AssemblyInfo.cs | 34 ++ Shared.Droid.YCStatusBarLib/Additions/AboutAdditions.txt | 48 +++ Shared.IOS.JLCountryCode/Structs.cs | 6 Shared.Droid.YCStatusBarLib/Shared.Droid.YCStatusBarLib.csproj | 66 ++++ Shared.Droid.JLCountryCode/Shared.Droid.JLCountryCode.csproj | 66 ++++ Shared.Droid.JLCountryCode/Additions/AboutAdditions.txt | 48 +++ Shared.Droid.YCStatusBarLib/Jars/AboutJars.txt | 24 + Shared.IOS.JLCountryCode/ApiDefinition.cs | 21 + Shared.Droid.JLCountryCode/Jars/JLCountryCode-V1.0.3.aar | 0 Shared.Droid.JLCountryCode/Transforms/Metadata.xml | 17 + Shared.IOS.JLCountryCode/Resources/countryCodeEN.plist | 0 Shared.Droid.JLCountryCode.dll | 0 Shared.Droid.YCStatusBarLib/Transforms/EnumMethods.xml | 14 Android/Jlcountrycode.cs | 56 +++ Shared.Droid.YCStatusBarLib/Transforms/EnumFields.xml | 15 + 33 files changed, 863 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index a3cd143..27948ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,194 @@ -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -# Pods/ +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ +.vs/ +.gitignore +packages/ +ZigBee.Ios/ +ZigBee.Droid/ +Shared.IOS/ +.DS_Store +.gitignore + +# Roslyn cache directories +*.ide/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +#NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +## TODO: Comment the next line if you want to checkin your +## web deploy settings but do note that will include unencrypted +## passwords +*.pubxml + +# NuGet Packages +packages/* +*.nupkg +## TODO: If the tool you use requires repositories.config +## uncomment the next line +#!packages/repositories.config + +# Enable "build/" folder in the NuGet Packages folder since +# NuGet packages use it for MSBuild targets. +# This line needs to be after the ignore of the build folder +# (and the packages folder if the line above has been uncommented) +!packages/build/ + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ diff --git a/Android/Jlcountrycode.cs b/Android/Jlcountrycode.cs new file mode 100644 index 0000000..fb0ce4e --- /dev/null +++ b/Android/Jlcountrycode.cs @@ -0,0 +1,56 @@ +锘縰sing System; +using Android.Content; +using Com.Widget.Jlcountrycode; + +namespace Jlcountrycode +{ + public class CountryCodeView + { + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + private static CountryCodeView m_Current = null; + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + public static CountryCodeView Current + { + get + { + if (m_Current == null) + { + m_Current = new CountryCodeView(); + } + return m_Current; + } + } + + /// <summary> + /// 鍥藉鍖哄彿閫夋嫨 + /// </summary> + /// <param name="action"></param> + public void Show(Action<string, string> action) + { + JLCountryCodeActivity.OnCountryCodeCallback = new OnCountryCodeCallback(action); + Shared.Application.Activity.StartActivity(new Intent(Shared.Application.Activity, typeof(JLCountryCodeActivity))); + } + } + + /// <summary> + /// OnCountryCodeCallback + /// </summary> + public class OnCountryCodeCallback : Java.Lang.Object, Com.Widget.Jlcountrycode.Contact.IOnCountryCodeCallback + { + + Action<string, string> mAction; + public OnCountryCodeCallback(Action<string, string> action) + { + mAction = action; + } + + public void OnSelectCountryCallback(string countryName, string code) + { + mAction?.Invoke(countryName, code); + } + } +} \ No newline at end of file diff --git a/Android/Shared.Droid.JLCountryCode.dll b/Android/Shared.Droid.JLCountryCode.dll new file mode 100644 index 0000000..f7f9d91 --- /dev/null +++ b/Android/Shared.Droid.JLCountryCode.dll Binary files differ diff --git a/Shared.Droid.JLCountryCode.dll b/Shared.Droid.JLCountryCode.dll new file mode 100644 index 0000000..be50629 --- /dev/null +++ b/Shared.Droid.JLCountryCode.dll Binary files differ diff --git a/Shared.Droid.JLCountryCode/Additions/AboutAdditions.txt b/Shared.Droid.JLCountryCode/Additions/AboutAdditions.txt new file mode 100644 index 0000000..c240307 --- /dev/null +++ b/Shared.Droid.JLCountryCode/Additions/AboutAdditions.txt @@ -0,0 +1,48 @@ +锘緼dditions 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; } +} \ No newline at end of file diff --git a/Shared.Droid.JLCountryCode/Jars/AboutJars.txt b/Shared.Droid.JLCountryCode/Jars/AboutJars.txt new file mode 100644 index 0000000..c359b62 --- /dev/null +++ b/Shared.Droid.JLCountryCode/Jars/AboutJars.txt @@ -0,0 +1,24 @@ +锘縏his directory is for Android .jars. + +There are 2 types of jars that are supported: + +== Input Jar == + +This is the jar that bindings should be generated for. + +For example, if you were binding the Google Maps library, this would +be Google's "maps.jar". + +Set the build action for these jars in the properties page to "InputJar". + + +== Reference Jars == + +These are jars that are referenced by the input jar. C# bindings will +not be created for these jars. These jars will be used to resolve +types used by the input jar. + +NOTE: Do not add "android.jar" as a reference jar. It will be added automatically +based on the Target Framework selected. + +Set the build action for these jars in the properties page to "ReferenceJar". \ No newline at end of file diff --git a/Shared.Droid.JLCountryCode/Jars/JLCountryCode-V1.0.3.aar b/Shared.Droid.JLCountryCode/Jars/JLCountryCode-V1.0.3.aar new file mode 100644 index 0000000..13e4f5b --- /dev/null +++ b/Shared.Droid.JLCountryCode/Jars/JLCountryCode-V1.0.3.aar Binary files differ diff --git a/Shared.Droid.JLCountryCode/Properties/AssemblyInfo.cs b/Shared.Droid.JLCountryCode/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..847dd8d --- /dev/null +++ b/Shared.Droid.JLCountryCode/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Shared.Droid.JLCountryCode")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Shared.Droid.JLCountryCode")] +[assembly: AssemblyCopyright("Copyright 漏 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")] diff --git a/Shared.Droid.JLCountryCode/Shared.Droid.JLCountryCode.csproj b/Shared.Droid.JLCountryCode/Shared.Droid.JLCountryCode.csproj new file mode 100644 index 0000000..3f61bd4 --- /dev/null +++ b/Shared.Droid.JLCountryCode/Shared.Droid.JLCountryCode.csproj @@ -0,0 +1,66 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{82A1E78A-69FA-4F09-98B8-EE4E57F57880}</ProjectGuid> + <ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Shared.Droid.JLCountryCode</RootNamespace> + <AssemblyName>Shared.Droid.JLCountryCode</AssemblyName> + <FileAlignment>512</FileAlignment> + <TargetFrameworkVersion>v8.0</TargetFrameworkVersion> + <AndroidClassParser>class-parse</AndroidClassParser> + <AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>portable</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Mono.Android" /> + <Reference Include="System" /> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="Jars\AboutJars.txt" /> + <None Include="Additions\AboutAdditions.txt" /> + </ItemGroup> + <ItemGroup> + <TransformFile Include="Transforms\Metadata.xml" /> + <TransformFile Include="Transforms\EnumFields.xml" /> + <TransformFile Include="Transforms\EnumMethods.xml" /> + </ItemGroup> + <ItemGroup> + <LibraryProjectZip Include="Jars\JLCountryCode-V1.0.3.aar" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Shared.Droid.JLCountryCode/Transforms/EnumFields.xml b/Shared.Droid.JLCountryCode/Transforms/EnumFields.xml new file mode 100644 index 0000000..e4a0f89 --- /dev/null +++ b/Shared.Droid.JLCountryCode/Transforms/EnumFields.xml @@ -0,0 +1,15 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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> \ No newline at end of file diff --git a/Shared.Droid.JLCountryCode/Transforms/EnumMethods.xml b/Shared.Droid.JLCountryCode/Transforms/EnumMethods.xml new file mode 100644 index 0000000..6ff109b --- /dev/null +++ b/Shared.Droid.JLCountryCode/Transforms/EnumMethods.xml @@ -0,0 +1,14 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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> \ No newline at end of file diff --git a/Shared.Droid.JLCountryCode/Transforms/Metadata.xml b/Shared.Droid.JLCountryCode/Transforms/Metadata.xml new file mode 100644 index 0000000..3bbfa94 --- /dev/null +++ b/Shared.Droid.JLCountryCode/Transforms/Metadata.xml @@ -0,0 +1,17 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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']" /> + --> + <remove-node path="/api/package[@name='com.widget.jlcountrycode.contact']/class[@name='ContactItemComparator']" /> + <remove-node path="/api/package[@name='com.alibaba.fastjson']/class[@name='JSONObject']" /> + <remove-node path="/api/package[@name='com.alibaba.fastjson.util']/class[@name='FieldInfo']" /> + <remove-node path="/api/package[@name='com.alibaba.fastjson']/class[@name='JSONArray']" /> + <remove-node path="/api/package[@name='com.alibaba.fastjson.parser']/class[@name='JavaBeanDeserializer']" /> + <remove-node path="/api/package[@name='com.alibaba.fastjson.serializer']/class[@name='FieldSerializer']" /> + <!-- <remove-node />--> +</metadata> \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Additions/AboutAdditions.txt b/Shared.Droid.YCStatusBarLib/Additions/AboutAdditions.txt new file mode 100644 index 0000000..c240307 --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Additions/AboutAdditions.txt @@ -0,0 +1,48 @@ +锘緼dditions 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; } +} \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Jars/AboutJars.txt b/Shared.Droid.YCStatusBarLib/Jars/AboutJars.txt new file mode 100644 index 0000000..c359b62 --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Jars/AboutJars.txt @@ -0,0 +1,24 @@ +锘縏his directory is for Android .jars. + +There are 2 types of jars that are supported: + +== Input Jar == + +This is the jar that bindings should be generated for. + +For example, if you were binding the Google Maps library, this would +be Google's "maps.jar". + +Set the build action for these jars in the properties page to "InputJar". + + +== Reference Jars == + +These are jars that are referenced by the input jar. C# bindings will +not be created for these jars. These jars will be used to resolve +types used by the input jar. + +NOTE: Do not add "android.jar" as a reference jar. It will be added automatically +based on the Target Framework selected. + +Set the build action for these jars in the properties page to "ReferenceJar". \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Jars/YCStatusBarLib-V1.0.1.aar b/Shared.Droid.YCStatusBarLib/Jars/YCStatusBarLib-V1.0.1.aar new file mode 100644 index 0000000..ffb2a08 --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Jars/YCStatusBarLib-V1.0.1.aar Binary files differ diff --git a/Shared.Droid.YCStatusBarLib/Properties/AssemblyInfo.cs b/Shared.Droid.YCStatusBarLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e35673f --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Shared.Droid.YCStatusBarLib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Shared.Droid.YCStatusBarLib")] +[assembly: AssemblyCopyright("Copyright 漏 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] diff --git a/Shared.Droid.YCStatusBarLib/Shared.Droid.YCStatusBarLib.csproj b/Shared.Droid.YCStatusBarLib/Shared.Droid.YCStatusBarLib.csproj new file mode 100644 index 0000000..6f7b13f --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Shared.Droid.YCStatusBarLib.csproj @@ -0,0 +1,66 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{9893D262-A18D-4819-BDF2-ED81A85CD167}</ProjectGuid> + <ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Shared.Droid.YCStatusBarLib</RootNamespace> + <AssemblyName>Shared.Droid.YCStatusBarLib</AssemblyName> + <FileAlignment>512</FileAlignment> + <TargetFrameworkVersion>v8.0</TargetFrameworkVersion> + <AndroidClassParser>class-parse</AndroidClassParser> + <AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>portable</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Mono.Android" /> + <Reference Include="System" /> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="Jars\AboutJars.txt" /> + <None Include="Additions\AboutAdditions.txt" /> + </ItemGroup> + <ItemGroup> + <TransformFile Include="Transforms\Metadata.xml" /> + <TransformFile Include="Transforms\EnumFields.xml" /> + <TransformFile Include="Transforms\EnumMethods.xml" /> + </ItemGroup> + <ItemGroup> + <LibraryProjectZip Include="Jars\YCStatusBarLib-V1.0.1.aar" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Transforms/EnumFields.xml b/Shared.Droid.YCStatusBarLib/Transforms/EnumFields.xml new file mode 100644 index 0000000..e4a0f89 --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Transforms/EnumFields.xml @@ -0,0 +1,15 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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> \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Transforms/EnumMethods.xml b/Shared.Droid.YCStatusBarLib/Transforms/EnumMethods.xml new file mode 100644 index 0000000..6ff109b --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Transforms/EnumMethods.xml @@ -0,0 +1,14 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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> \ No newline at end of file diff --git a/Shared.Droid.YCStatusBarLib/Transforms/Metadata.xml b/Shared.Droid.YCStatusBarLib/Transforms/Metadata.xml new file mode 100644 index 0000000..d091d82 --- /dev/null +++ b/Shared.Droid.YCStatusBarLib/Transforms/Metadata.xml @@ -0,0 +1,10 @@ +锘�<?xml version="1.0" encoding="UTF-8"?> +<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']" /> + --> +</metadata> \ No newline at end of file diff --git a/Shared.IOS.JLCountryCode.dll b/Shared.IOS.JLCountryCode.dll new file mode 100644 index 0000000..7a7d0cd --- /dev/null +++ b/Shared.IOS.JLCountryCode.dll Binary files differ diff --git a/Shared.IOS.JLCountryCode/ApiDefinition.cs b/Shared.IOS.JLCountryCode/ApiDefinition.cs new file mode 100644 index 0000000..ca4733d --- /dev/null +++ b/Shared.IOS.JLCountryCode/ApiDefinition.cs @@ -0,0 +1,21 @@ +锘縰sing System; + +using ObjCRuntime; +using Foundation; +using UIKit; + +namespace Shared.IOS.JLCountryCode +{ + // typedef void (^selectCountryCodeBlock)(NSString * _Nonnull, NSString * _Nonnull); + delegate void selectCountryCodeBlock(string countryName, string code); + + // @interface JLCountryCodeController : UIViewController + [BaseType(typeof(UIViewController))] + interface JLCountryCodeController + { + // @property (copy, nonatomic) selectCountryCodeBlock _Nonnull selectCountryCodeBlock; + [Export("selectCountryCodeBlock", ArgumentSemantic.Copy)] + selectCountryCodeBlock SelectCountryCodeBlock { get; set; } + } +} + diff --git a/Shared.IOS.JLCountryCode/Library/countryCodeCH.plist b/Shared.IOS.JLCountryCode/Library/countryCodeCH.plist new file mode 100755 index 0000000..dedcd9b --- /dev/null +++ b/Shared.IOS.JLCountryCode/Library/countryCodeCH.plist Binary files differ diff --git a/Shared.IOS.JLCountryCode/Library/countryCodeEN.plist b/Shared.IOS.JLCountryCode/Library/countryCodeEN.plist new file mode 100755 index 0000000..8766c12 --- /dev/null +++ b/Shared.IOS.JLCountryCode/Library/countryCodeEN.plist Binary files differ diff --git a/Shared.IOS.JLCountryCode/Library/libJLCountryCode.a b/Shared.IOS.JLCountryCode/Library/libJLCountryCode.a new file mode 100644 index 0000000..53c2b13 --- /dev/null +++ b/Shared.IOS.JLCountryCode/Library/libJLCountryCode.a Binary files differ diff --git a/Shared.IOS.JLCountryCode/Properties/AssemblyInfo.cs b/Shared.IOS.JLCountryCode/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..469151a --- /dev/null +++ b/Shared.IOS.JLCountryCode/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; + +using Foundation; + +// This attribute allows you to mark your assemblies as 鈥渟afe to link鈥�. +// When the attribute is present, the linker鈥攊f enabled鈥攚ill process the assembly +// even if you鈥檙e using the 鈥淟ink SDK assemblies only鈥� option, which is the default for device builds. + +[assembly: LinkerSafe] + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Shared.IOS.JLCountryCode")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Shared.IOS.JLCountryCode")] +[assembly: AssemblyCopyright("Copyright 漏 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.3")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/Shared.IOS.JLCountryCode/Resources/countryCodeCH.plist b/Shared.IOS.JLCountryCode/Resources/countryCodeCH.plist new file mode 100755 index 0000000..dedcd9b --- /dev/null +++ b/Shared.IOS.JLCountryCode/Resources/countryCodeCH.plist Binary files differ diff --git a/Shared.IOS.JLCountryCode/Resources/countryCodeEN.plist b/Shared.IOS.JLCountryCode/Resources/countryCodeEN.plist new file mode 100755 index 0000000..8766c12 --- /dev/null +++ b/Shared.IOS.JLCountryCode/Resources/countryCodeEN.plist Binary files differ diff --git a/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.csproj b/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.csproj new file mode 100644 index 0000000..8ab6c9d --- /dev/null +++ b/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.csproj @@ -0,0 +1,59 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ProjectGuid>{CA72F24A-973D-4953-BB2C-C5BA130BF1C3}</ProjectGuid> + <TemplateGuid>{b6f3ff35-79b2-4f25-a2fc-60a7cf61013b}</TemplateGuid> + <OutputType>Library</OutputType> + <RootNamespace>Shared.IOS.JLCountryCode</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>Shared.IOS.JLCountryCode</AssemblyName> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingApiDefinition Include="ApiDefinition.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingCoreSource Include="Structs.cs" /> + </ItemGroup> + <ItemGroup> + <NativeReference Include="Library\libJLCountryCode.a"> + <Kind>Static</Kind> + <SmartLink>False</SmartLink> + </NativeReference> + </ItemGroup> + <ItemGroup> + <BundleResource Include="Resources\countryCodeCH.plist" /> + <BundleResource Include="Resources\countryCodeEN.plist" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.sln b/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.sln new file mode 100644 index 0000000..071d913 --- /dev/null +++ b/Shared.IOS.JLCountryCode/Shared.IOS.JLCountryCode.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.IOS.JLCountryCode", "Shared.IOS.JLCountryCode.csproj", "{CA72F24A-973D-4953-BB2C-C5BA130BF1C3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Droid.JLCountryCode", "..\Shared.Droid.JLCountryCode\Shared.Droid.JLCountryCode.csproj", "{82A1E78A-69FA-4F09-98B8-EE4E57F57880}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Droid.YCStatusBarLib", "..\Shared.Droid.YCStatusBarLib\Shared.Droid.YCStatusBarLib.csproj", "{9893D262-A18D-4819-BDF2-ED81A85CD167}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CA72F24A-973D-4953-BB2C-C5BA130BF1C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA72F24A-973D-4953-BB2C-C5BA130BF1C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA72F24A-973D-4953-BB2C-C5BA130BF1C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA72F24A-973D-4953-BB2C-C5BA130BF1C3}.Release|Any CPU.Build.0 = Release|Any CPU + {82A1E78A-69FA-4F09-98B8-EE4E57F57880}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82A1E78A-69FA-4F09-98B8-EE4E57F57880}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82A1E78A-69FA-4F09-98B8-EE4E57F57880}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82A1E78A-69FA-4F09-98B8-EE4E57F57880}.Release|Any CPU.Build.0 = Release|Any CPU + {9893D262-A18D-4819-BDF2-ED81A85CD167}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9893D262-A18D-4819-BDF2-ED81A85CD167}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9893D262-A18D-4819-BDF2-ED81A85CD167}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9893D262-A18D-4819-BDF2-ED81A85CD167}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Shared.IOS.JLCountryCode/Structs.cs b/Shared.IOS.JLCountryCode/Structs.cs new file mode 100644 index 0000000..64e8621 --- /dev/null +++ b/Shared.IOS.JLCountryCode/Structs.cs @@ -0,0 +1,6 @@ +锘縰sing System; + +namespace Shared.IOS.JLCountryCode +{ +} + diff --git a/iOS/Jlcountrycode.cs b/iOS/Jlcountrycode.cs new file mode 100644 index 0000000..d815f8f --- /dev/null +++ b/iOS/Jlcountrycode.cs @@ -0,0 +1,44 @@ +锘縰sing System; +using Shared.IOS.JLCountryCode; + +namespace Jlcountrycode +{ + public class CountryCodeView + { + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + private static CountryCodeView m_Current = null; + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + public static CountryCodeView Current + { + get + { + if (m_Current == null) + { + m_Current = new CountryCodeView(); + } + return m_Current; + } + } + + /// <summary> + /// 鍥藉鍖哄彿閫夋嫨 + /// </summary> + /// <param name="action"></param> + public void Show(Action<string, string> action) + { + JLCountryCodeController mJLCountryCodeController = new JLCountryCodeController(); + + mJLCountryCodeController.SelectCountryCodeBlock += (countryName, code) => + { + action?.Invoke(countryName, code); + }; + + Shared.Application.currentVC.NavigationController.PushViewController(mJLCountryCodeController, true); + + } + } +} \ No newline at end of file diff --git a/iOS/Shared.IOS.JLCountryCode.dll b/iOS/Shared.IOS.JLCountryCode.dll new file mode 100644 index 0000000..245c88c --- /dev/null +++ b/iOS/Shared.IOS.JLCountryCode.dll Binary files differ -- Gitblit v1.8.0