Skip to content

Commit

Permalink
Add Android project
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed Nov 24, 2024
1 parent 5e7c86b commit 43d1d91
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 2 deletions.
27 changes: 27 additions & 0 deletions Vocup.sln
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vocup", "src\Vocup\Vocup.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vocup.Desktop", "src\Vocup.Desktop\Vocup.Desktop.csproj", "{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vocup.Android", "src\Vocup.Android\Vocup.Android.csproj", "{B62B6DEC-24F5-411A-A9E0-A81AA143434D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -143,6 +145,30 @@ Global
{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA}.Release|x64.Build.0 = Release|Any CPU
{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA}.Release|x86.ActiveCfg = Release|Any CPU
{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA}.Release|x86.Build.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|ARM64.Build.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|ARM64.Deploy.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x64.ActiveCfg = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x64.Build.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x64.Deploy.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x86.ActiveCfg = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x86.Build.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Debug|x86.Deploy.0 = Debug|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|Any CPU.Build.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|ARM64.ActiveCfg = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|ARM64.Build.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|ARM64.Deploy.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x64.ActiveCfg = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x64.Build.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x64.Deploy.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x86.ActiveCfg = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x86.Build.0 = Release|Any CPU
{B62B6DEC-24F5-411A-A9E0-A81AA143434D}.Release|x86.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -153,6 +179,7 @@ Global
{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240} = {DB3F9D1B-E719-4A4B-8953-5FB027887083}
{3A27DC34-46FB-44FB-B169-C3AAC746AC9B} = {C15174B9-657C-4871-BD70-E367286C3A48}
{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA} = {C15174B9-657C-4871-BD70-E367286C3A48}
{B62B6DEC-24F5-411A-A9E0-A81AA143434D} = {C15174B9-657C-4871-BD70-E367286C3A48}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB786307-C66E-4F63-BF9D-639CCBE07497}
Expand Down
Binary file added src/Vocup.Android/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/Vocup.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Android.App;
using Android.Content.PM;

using Avalonia;
using Avalonia.Android;
using Avalonia.ReactiveUI;

namespace Vocup.Android;

[Activity(
Label = "Vocup.Android",
Theme = "@style/MyTheme.NoActionBar",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity<App>
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.WithInterFont()
.UseReactiveUI();
}
}
12 changes: 12 additions & 0 deletions src/Vocup.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Vocup" android:icon="@drawable/Icon" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
</manifest>
13 changes: 13 additions & 0 deletions src/Vocup.Android/Resources/drawable/splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item>
<color android:color="@color/splash_background"/>
</item>

<item android:drawable="@drawable/icon"
android:width="120dp"
android:height="120dp"
android:gravity="center" />

</layer-list>
4 changes: 4 additions & 0 deletions src/Vocup.Android/Resources/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#212121</color>
</resources>
4 changes: 4 additions & 0 deletions src/Vocup.Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#FFFFFF</color>
</resources>
12 changes: 12 additions & 0 deletions src/Vocup.Android/Resources/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>

<style name="MyTheme">
</style>

<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
27 changes: 27 additions & 0 deletions src/Vocup.Android/Vocup.Android.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<ApplicationId>org.vocup</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
</PropertyGroup>

<ItemGroup>
<AndroidResource Include="Icon.png">
<Link>Resources\drawable\Icon.png</Link>
</AndroidResource>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Vocup\Vocup.csproj" />
</ItemGroup>
</Project>
2 changes: 0 additions & 2 deletions src/Vocup/Vocup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<AssemblyName>Vocup.Avalonia</AssemblyName>
<Platforms>AnyCPU;x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>

Expand Down

0 comments on commit 43d1d91

Please sign in to comment.