Skip to content

Commit 37d1179

Browse files
authored
Merge pull request #1 from SyncfusionExamples/NativeSample
Native sample
2 parents d6ae06f + 3214290 commit 37d1179

Some content is hidden

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

49 files changed

+10097
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29324.140
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorSample", "EditorSample\EditorSample.csproj", "{BF1B0E02-DB92-4A9B-998A-548A887B0B04}"
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+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{BF1B0E02-DB92-4A9B-998A-548A887B0B04}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {2E9AA509-CC5B-4A1D-823E-745FDFAC8653}
26+
EndGlobalSection
27+
EndGlobal
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with your package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{BF1B0E02-DB92-4A9B-998A-548A887B0B04}</ProjectGuid>
9+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<TemplateGuid>{122416d6-6b49-4ee2-a1e8-b825f31c79fe}</TemplateGuid>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace>EditorSample</RootNamespace>
14+
<AssemblyName>EditorSample</AssemblyName>
15+
<FileAlignment>512</FileAlignment>
16+
<AndroidApplication>True</AndroidApplication>
17+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
18+
<AndroidResgenClass>Resource</AndroidResgenClass>
19+
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
20+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
21+
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
22+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
23+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
24+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
25+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
26+
<AndroidUseAapt2>true</AndroidUseAapt2>
27+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
30+
<DebugSymbols>True</DebugSymbols>
31+
<DebugType>portable</DebugType>
32+
<Optimize>False</Optimize>
33+
<OutputPath>bin\Debug\</OutputPath>
34+
<DefineConstants>DEBUG;TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
38+
<AndroidLinkMode>None</AndroidLinkMode>
39+
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
40+
</PropertyGroup>
41+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
42+
<DebugSymbols>True</DebugSymbols>
43+
<DebugType>portable</DebugType>
44+
<Optimize>True</Optimize>
45+
<OutputPath>bin\Release\</OutputPath>
46+
<DefineConstants>TRACE</DefineConstants>
47+
<ErrorReport>prompt</ErrorReport>
48+
<WarningLevel>4</WarningLevel>
49+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
50+
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
51+
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
52+
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
53+
</PropertyGroup>
54+
<ItemGroup>
55+
<Reference Include="System" />
56+
<Reference Include="System.Xml" />
57+
<Reference Include="System.Core" />
58+
<Reference Include="Mono.Android" />
59+
<Reference Include="System.Numerics" />
60+
<Reference Include="System.Numerics.Vectors" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<Compile Include="MainActivity.cs" />
64+
<Compile Include="Resources\Resource.designer.cs" />
65+
<Compile Include="Properties\AssemblyInfo.cs" />
66+
</ItemGroup>
67+
<ItemGroup>
68+
<None Include="Resources\AboutResources.txt" />
69+
<None Include="Properties\AndroidManifest.xml" />
70+
<None Include="Assets\AboutAssets.txt" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<AndroidResource Include="Resources\layout\activity_main.xml">
74+
<SubType>Designer</SubType>
75+
</AndroidResource>
76+
<AndroidResource Include="Resources\values\colors.xml" />
77+
<AndroidResource Include="Resources\values\ic_launcher_background.xml" />
78+
<AndroidResource Include="Resources\values\strings.xml" />
79+
<AndroidResource Include="Resources\values\styles.xml" />
80+
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" />
81+
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" />
82+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
83+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_foreground.png" />
84+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_round.png" />
85+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
86+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_foreground.png" />
87+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_round.png" />
88+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
89+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_foreground.png" />
90+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_round.png" />
91+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
92+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_foreground.png" />
93+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_round.png" />
94+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
95+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_foreground.png" />
96+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
97+
</ItemGroup>
98+
<ItemGroup />
99+
<ItemGroup>
100+
<PackageReference Include="Syncfusion.Xamarin.SfImageEditor.Android">
101+
<Version>*</Version>
102+
</PackageReference>
103+
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
104+
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
105+
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" />
106+
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
107+
</ItemGroup>
108+
<ItemGroup>
109+
<AndroidResource Include="Resources\drawable\Image.jpeg" />
110+
</ItemGroup>
111+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
112+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
113+
Other similar extension points exist, see Microsoft.Common.targets.
114+
<Target Name="BeforeBuild">
115+
</Target>
116+
<Target Name="AfterBuild">
117+
</Target>
118+
-->
119+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SelectedDevice>Xiaomi Mi A3</SelectedDevice>
5+
<DefaultDevice>pie_9_0_api_28</DefaultDevice>
6+
<ProjectView>ShowAllFiles</ProjectView>
7+
<AndroidDesignerPreferredTheme>AppTheme</AndroidDesignerPreferredTheme>
8+
</PropertyGroup>
9+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Android.App;
2+
using Android.OS;
3+
using Android.Support.V7.App;
4+
using Android.Runtime;
5+
using Android.Widget;
6+
using Syncfusion.SfImageEditor.Android;
7+
using Android.Graphics;
8+
9+
namespace EditorSample
10+
{
11+
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
12+
public class MainActivity : AppCompatActivity
13+
{
14+
protected override void OnCreate(Bundle savedInstanceState)
15+
{
16+
base.OnCreate(savedInstanceState);
17+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
18+
SfImageEditor editor = new SfImageEditor(this);
19+
editor.Bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.Image);
20+
SetContentView(editor);
21+
}
22+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
23+
{
24+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
25+
26+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
27+
}
28+
}
29+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:versionCode="1"
4+
android:versionName="1.0"
5+
package="com.companyname.editorsample">
6+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
7+
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
8+
</application>
9+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
10+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("EditorSample")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("EditorSample")]
14+
[assembly: AssemblyCopyright("Copyright © 2018")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.xml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable/
12+
icon.png
13+
14+
layout/
15+
main.xml
16+
17+
values/
18+
strings.xml
19+
20+
In order to get the build system to recognize Android resources, set the build action to
21+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
22+
instead operate on resource IDs. When you compile an Android application that uses resources,
23+
the build system will package the resources for distribution and generate a class called "R"
24+
(this is an Android convention) that contains the tokens for each one of the resources
25+
included. For example, for the above Resources layout, this is what the R class would expose:
26+
27+
public class R {
28+
public class drawable {
29+
public const int icon = 0x123;
30+
}
31+
32+
public class layout {
33+
public const int main = 0x456;
34+
}
35+
36+
public class strings {
37+
public const int first_string = 0xabc;
38+
public const int second_string = 0xbcd;
39+
}
40+
}
41+
42+
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43+
to reference the layout/main.xml file, or R.strings.first_string to reference the first
44+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)