Skip to content

Commit a868a60

Browse files
authored
Merge pull request #67 from dansiegel/auto-load
Fixing Autoload
2 parents 8629502 + 2397def commit a868a60

File tree

115 files changed

+1982
-6
lines changed

Some content is hidden

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

115 files changed

+1982
-6
lines changed

Prism.Container.Extensions.sln

Lines changed: 378 additions & 0 deletions
Large diffs are not rendered by default.

sample/.editorconfig

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Suppress: EC112
2+
# top-most EditorConfig file
3+
root = true
4+
5+
# Don't use tabs for indentation.
6+
[*]
7+
indent_style = space
8+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
9+
10+
[*.yml]
11+
indent_size = 2
12+
13+
# Code files
14+
[*.{cs,csx,vb,vbx}]
15+
indent_size = 4
16+
17+
# Code files
18+
[*.sln]
19+
indent_size = 4
20+
21+
# Xml project files
22+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
23+
indent_size = 2
24+
25+
# Xml config files
26+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
27+
indent_size = 2
28+
29+
# XAML files
30+
[*.xaml]
31+
indent_size = 2
32+
33+
# JSON files
34+
[*.json]
35+
indent_size = 2
36+
37+
# XML files
38+
[*.xml]
39+
indent_size = 2
40+
41+
# PList Files
42+
[*.plist]
43+
indent_size = 2
44+
45+
# YAML files
46+
[*.{yaml,yml}]
47+
indent_size = 2
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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
5+
namespace PrismSample.Droid
6+
{
7+
[Activity(Theme = "@style/MainTheme",
8+
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
9+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
10+
{
11+
protected override void OnCreate(Bundle savedInstanceState)
12+
{
13+
TabLayoutResource = Resource.Layout.Tabbar;
14+
ToolbarResource = Resource.Layout.Toolbar;
15+
16+
base.OnCreate(savedInstanceState);
17+
18+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
19+
LoadApplication(new App());
20+
}
21+
}
22+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using Android.App;
3+
using Android.Runtime;
4+
using Shiny;
5+
using PrismSample.Shiny;
6+
7+
namespace PrismSample.Droid
8+
{
9+
[Application(
10+
Label = "Prism Sample",
11+
Icon = "@mipmap/icon"
12+
)]
13+
public class MainApplication : Application
14+
{
15+
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
16+
: base(javaReference, transfer)
17+
{
18+
}
19+
20+
public override void OnCreate()
21+
{
22+
base.OnCreate();
23+
AndroidShinyHost.Init(this, new Startup());
24+
}
25+
}
26+
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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>{4E987D86-4E13-4BBC-9C3A-69006801D049}</ProjectGuid>
7+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>PrismSample.Droid</RootNamespace>
11+
<AssemblyName>PrismSample.Android</AssemblyName>
12+
<AndroidApplication>True</AndroidApplication>
13+
<AndroidUseIntermediateDesignerFile>true</AndroidUseIntermediateDesignerFile>
14+
<AndroidResgenClass>Resource</AndroidResgenClass>
15+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
16+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
17+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
18+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
19+
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
20+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
21+
<AndroidUseAapt2>true</AndroidUseAapt2>
22+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
23+
<NuGetPackageImportStamp>
24+
</NuGetPackageImportStamp>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
<DebugType>portable</DebugType>
29+
<Optimize>false</Optimize>
30+
<OutputPath>bin\Debug</OutputPath>
31+
<DefineConstants>DEBUG;</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<AndroidLinkMode>None</AndroidLinkMode>
35+
</PropertyGroup>
36+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
37+
<DebugSymbols>true</DebugSymbols>
38+
<DebugType>portable</DebugType>
39+
<Optimize>true</Optimize>
40+
<OutputPath>bin\Release</OutputPath>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
44+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
45+
</PropertyGroup>
46+
<ItemGroup>
47+
<Reference Include="Mono.Android" />
48+
<Reference Include="System" />
49+
<Reference Include="System.Core" />
50+
<Reference Include="System.Xml.Linq" />
51+
<Reference Include="System.Xml" />
52+
<Reference Include="System.Numerics" />
53+
<Reference Include="System.Numerics.Vectors" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<PackageReference Include="Xamarin.Forms" Version="4.3.0.991211" />
57+
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Include="MainActivity.cs" />
61+
<Compile Include="MainApplication.cs" />
62+
<Compile Include="Properties\AssemblyInfo.cs" />
63+
<Compile Include="SplashActivity.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\layout\Tabbar.xml" />
72+
<AndroidResource Include="Resources\layout\Toolbar.xml" />
73+
<AndroidResource Include="Resources\values\styles.xml" />
74+
<AndroidResource Include="Resources\values\colors.xml" />
75+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
76+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
77+
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
78+
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
79+
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
80+
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
81+
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
82+
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
83+
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
84+
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
85+
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
86+
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
87+
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
88+
<AndroidResource Include="Resources\drawable-mdpi\icon.png" />
89+
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
90+
<AndroidResource Include="Resources\drawable-xxxhdpi\icon.png" />
91+
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
92+
</ItemGroup>
93+
<ItemGroup />
94+
<ItemGroup>
95+
<ProjectReference Include="..\..\src\Prism.Container.Extensions\Prism.Container.Extensions.csproj">
96+
<Project>{940ca2d8-b9a8-499a-9ed3-ecee9758073f}</Project>
97+
<Name>Prism.Container.Extensions</Name>
98+
</ProjectReference>
99+
<ProjectReference Include="..\..\src\Prism.DryIoc.Extensions\Prism.DryIoc.Extensions.csproj">
100+
<Project>{3a82a96a-f3fc-4244-87c3-28706494f614}</Project>
101+
<Name>Prism.DryIoc.Extensions</Name>
102+
</ProjectReference>
103+
<ProjectReference Include="..\..\src\Prism.Forms.Extended\Prism.Forms.Extended.csproj">
104+
<Project>{771a0fd7-7877-4ab7-8528-7fb07054393d}</Project>
105+
<Name>Prism.Forms.Extended</Name>
106+
</ProjectReference>
107+
<ProjectReference Include="..\..\src\Shiny.Prism\Shiny.Prism.csproj">
108+
<Project>{fd30086e-fa39-408e-935f-8921b454d282}</Project>
109+
<Name>Shiny.Prism</Name>
110+
</ProjectReference>
111+
<ProjectReference Include="..\PrismSample\PrismSample.csproj">
112+
<Project>{0C2D6820-FA64-4050-9546-BF034329D363}</Project>
113+
<Name>PrismSample</Name>
114+
</ProjectReference>
115+
</ItemGroup>
116+
<ItemGroup>
117+
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
118+
</ItemGroup>
119+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
120+
</Project>
Lines changed: 6 additions & 0 deletions
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.prismlibrary.prismsample">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
4+
<application android:label="Prism Sample"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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("PrismSample.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("PrismSample.Android")]
14+
[assembly: AssemblyCopyright("Copyright © Prism Library 2019")]
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")]
31+
32+
// Add some common permissions, these can be removed if not needed
33+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Lines changed: 50 additions & 0 deletions
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.
26 KB
Loading

0 commit comments

Comments
 (0)