Infra changes
Moved projects around; API still builds successfully
This commit is contained in:
19
src/MyPrayerJournal.Mobile.Android/Assets/AboutAssets.txt
Normal file
19
src/MyPrayerJournal.Mobile.Android/Assets/AboutAssets.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with you package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
||||
33
src/MyPrayerJournal.Mobile.Android/MainActivity.fs
Normal file
33
src/MyPrayerJournal.Mobile.Android/MainActivity.fs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace MyPrayerJournal.Mobile.Android
|
||||
|
||||
open System
|
||||
|
||||
open Android.App
|
||||
open Android.Content
|
||||
open Android.OS
|
||||
open Android.Runtime
|
||||
open Android.Views
|
||||
open Android.Widget
|
||||
|
||||
type Resources = MyPrayerJournal.Mobile.Android.Resource
|
||||
|
||||
[<Activity (Label = "MyPrayerJournal.Mobile.Android", MainLauncher = true, Icon = "@mipmap/icon")>]
|
||||
type MainActivity () =
|
||||
inherit Activity ()
|
||||
|
||||
let mutable count:int = 1
|
||||
|
||||
override this.OnCreate (bundle) =
|
||||
|
||||
base.OnCreate (bundle)
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
this.SetContentView (Resources.Layout.Main)
|
||||
|
||||
// Get our button from the layout resource, and attach an event to it
|
||||
let button = this.FindViewById<Button>(Resources.Id.myButton)
|
||||
button.Click.Add (fun args ->
|
||||
button.Text <- sprintf "%d clicks!" count
|
||||
count <- count + 1
|
||||
)
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
|
||||
<ProjectGuid>49245e65-f905-4073-b057-3bceed076a1f</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>MyPrayerJournal.Mobile.Android</RootNamespace>
|
||||
<AssemblyName>MyPrayerJournal.Mobile.Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
|
||||
<Name>MyPrayerJournal.Mobile.Android</Name>
|
||||
<SelectedDevice>test-5x</SelectedDevice>
|
||||
<DefaultDevice>test-5x</DefaultDevice>
|
||||
</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>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<Tailcalls>False</Tailcalls>
|
||||
<PlatformTarget>
|
||||
</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>PdbOnly</DebugType>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<PlatformTarget>
|
||||
</PlatformTarget>
|
||||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<Tailcalls>True</Tailcalls>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.FSharp.targets" />
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
<Compile Include="Properties\AssemblyInfo.fs" />
|
||||
<Compile Include="MainActivity.fs" />
|
||||
<AndroidAsset Include="Assets\AboutAssets.txt" />
|
||||
<Content Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
<HintPath>..\packages\FSharp.Core.4.0.0.1\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Xamarin.Android.FSharp.ResourceProvider.Runtime">
|
||||
<HintPath>..\packages\Xamarin.Android.FSharp.ResourceProvider.1.0.0.13\lib\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MyPrayerJournal.Domain\MyPrayerJournal.Domain.fsproj">
|
||||
<Name>MyPrayerJournal.Domain</Name>
|
||||
<Project>{6236760d-b21e-4187-9d0b-7d5e1c6ad896}</Project>
|
||||
<Private>True</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MyPrayerJournal.Mobile.Core\MyPrayerJournal.Mobile.Core.fsproj">
|
||||
<Name>MyPrayerJournal.Mobile.Core</Name>
|
||||
<Project>{537d56c5-b55b-4f6c-af80-39f3bf4fd903}</Project>
|
||||
<Private>True</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
package="me.prayerjournal.android">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
|
||||
<application android:allowBackup="true" android:icon="@mipmap/icon" android:label="@string/app_name">
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace MyPrayerJournal.Mobile.Android
|
||||
module AssemblyInfo =
|
||||
|
||||
open System.Reflection
|
||||
open System.Runtime.CompilerServices
|
||||
open Android.App
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[<assembly: AssemblyTitle("MyPrayerJournal.Mobile.Android")>]
|
||||
[<assembly: AssemblyDescription("")>]
|
||||
[<assembly: AssemblyConfiguration("")>]
|
||||
[<assembly: AssemblyCompany("HP Inc.")>]
|
||||
[<assembly: AssemblyProduct("MyPrayerJournal.Mobile.Android")>]
|
||||
[<assembly: AssemblyCopyright("Copyright © HP Inc. 2019")>]
|
||||
[<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.0.0")>]
|
||||
|
||||
// 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("")>]
|
||||
|
||||
()
|
||||
@@ -0,0 +1,44 @@
|
||||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
||||
112
src/MyPrayerJournal.Mobile.Android/Resources/Resource.designer.cs
generated
Normal file
112
src/MyPrayerJournal.Mobile.Android/Resources/Resource.designer.cs
generated
Normal file
@@ -0,0 +1,112 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("MyPrayerJournal.Mobile.Android.Resource", IsApplication=true)]
|
||||
|
||||
namespace MyPrayerJournal.Mobile.Android
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
static Resource()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
static Attribute()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int myButton = 2131034112;
|
||||
|
||||
static Id()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Id()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Mipmap
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
static Mipmap()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Mipmap()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040001
|
||||
public const int app_name = 2130968577;
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int hello = 2130968576;
|
||||
|
||||
static String()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<Button android:id="@+id/myButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hello" />
|
||||
</LinearLayout>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Click Me!</string>
|
||||
<string name="app_name">MyPrayerJournal.Mobile.Android</string>
|
||||
</resources>
|
||||
5
src/MyPrayerJournal.Mobile.Android/packages.config
Normal file
5
src/MyPrayerJournal.Mobile.Android/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FSharp.Core" version="4.0.0.1" targetFramework="monoandroid60" />
|
||||
<package id="Xamarin.Android.FSharp.ResourceProvider" version="1.0.0.13" targetFramework="monoandroid60" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user