Skip to content

Commit 5ac0884

Browse files
committed
Add project files.
1 parent 169e5a9 commit 5ac0884

File tree

126 files changed

+9212
-0
lines changed

Some content is hidden

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

126 files changed

+9212
-0
lines changed
+19
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");

NotesApp.Android/MainActivity.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.OS;
7+
8+
namespace NotesApp.Droid
9+
{
10+
[Activity(Label = "NotesApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
11+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
12+
{
13+
protected override void OnCreate(Bundle savedInstanceState)
14+
{
15+
base.OnCreate(savedInstanceState);
16+
17+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
18+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
19+
LoadApplication(new App());
20+
}
21+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
22+
{
23+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
24+
25+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
26+
}
27+
}
28+
}
+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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>{7471CDE7-133B-441F-8C25-6FBA5EF7C9ED}</ProjectGuid>
7+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<TemplateGuid>{6968b3a4-1835-46a3-ac5c-1ae33b475983}</TemplateGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>NotesApp.Droid</RootNamespace>
11+
<AssemblyName>NotesApp.Android</AssemblyName>
12+
<Deterministic>True</Deterministic>
13+
<AndroidApplication>True</AndroidApplication>
14+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
15+
<AndroidResgenClass>Resource</AndroidResgenClass>
16+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
17+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
18+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
19+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
20+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
21+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
22+
<AndroidUseAapt2>true</AndroidUseAapt2>
23+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
24+
<NuGetPackageImportStamp>
25+
</NuGetPackageImportStamp>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28+
<DebugSymbols>true</DebugSymbols>
29+
<DebugType>portable</DebugType>
30+
<Optimize>false</Optimize>
31+
<OutputPath>bin\Debug</OutputPath>
32+
<DefineConstants>DEBUG;</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
<AndroidLinkMode>None</AndroidLinkMode>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<DebugSymbols>true</DebugSymbols>
39+
<DebugType>portable</DebugType>
40+
<Optimize>true</Optimize>
41+
<OutputPath>bin\Release</OutputPath>
42+
<ErrorReport>prompt</ErrorReport>
43+
<WarningLevel>4</WarningLevel>
44+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
45+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
46+
</PropertyGroup>
47+
<ItemGroup>
48+
<Reference Include="Mono.Android" />
49+
<Reference Include="System" />
50+
<Reference Include="System.Core" />
51+
<Reference Include="System.Numerics" />
52+
<Reference Include="System.Numerics.Vectors" />
53+
<Reference Include="System.Xml.Linq" />
54+
<Reference Include="System.Xml" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
58+
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
59+
</ItemGroup>
60+
<ItemGroup>
61+
<Compile Include="MainActivity.cs" />
62+
<Compile Include="Resources\Resource.designer.cs" />
63+
<Compile Include="Properties\AssemblyInfo.cs" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<None Include="Resources\AboutResources.txt" />
67+
<None Include="Assets\AboutAssets.txt" />
68+
<None Include="Properties\AndroidManifest.xml" />
69+
</ItemGroup>
70+
<ItemGroup>
71+
<AndroidResource Include="Resources\values\styles.xml" />
72+
<AndroidResource Include="Resources\values\colors.xml" />
73+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
74+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
75+
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
76+
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
77+
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
78+
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
79+
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
80+
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
81+
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
82+
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
83+
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
84+
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
85+
<AndroidResource Include="Resources\drawable\xamarin_logo.png" />
86+
<AndroidResource Include="Resources\drawable\icon_about.png" />
87+
<AndroidResource Include="Resources\drawable\icon_feed.png" />
88+
</ItemGroup>
89+
<ItemGroup>
90+
<ProjectReference Include="..\NotesApp\NotesApp.csproj">
91+
<Project>{8C1BC0B6-38AF-4C3F-8713-E1E0CA89D3A7}</Project>
92+
<Name>NotesApp</Name>
93+
</ProjectReference>
94+
</ItemGroup>
95+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
96+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.notesapp">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
4+
<application android:label="NotesApp.Android" android:theme="@style/MainTheme"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
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("NotesApp.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("NotesApp.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
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+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
27+
28+
// Add some common permissions, these can be removed if not needed
29+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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-hdpi/
12+
icon.png
13+
14+
drawable-ldpi/
15+
icon.png
16+
17+
drawable-mdpi/
18+
icon.png
19+
20+
layout/
21+
main.xml
22+
23+
values/
24+
strings.xml
25+
26+
In order to get the build system to recognize Android resources, set the build action to
27+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
28+
instead operate on resource IDs. When you compile an Android application that uses resources,
29+
the build system will package the resources for distribution and generate a class called
30+
"Resource" that contains the tokens for each one of the resources included. For example,
31+
for the above Resources layout, this is what the Resource class would expose:
32+
33+
public class Resource {
34+
public class drawable {
35+
public const int icon = 0x123;
36+
}
37+
38+
public class layout {
39+
public const int main = 0x456;
40+
}
41+
42+
public class strings {
43+
public const int first_string = 0xabc;
44+
public const int second_string = 0xbcd;
45+
}
46+
}
47+
48+
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49+
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)