Skip to content

Commit

Permalink
Merge pull request #125 from AvaloniaUI/android_update
Browse files Browse the repository at this point in the history
Update android templates
  • Loading branch information
maxkatz6 authored Nov 14, 2022
2 parents 324c79e + 3527eef commit 8a9bea1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20 deletions.
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pool:
vmImage: 'macOS-12'
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.0.400 SDK'
displayName: 'Use .NET 7.0.100 SDK'
inputs:
packageType: 'sdk'
version: 6.0.400
version: 7.0.100
- task: DotNetCoreCLI@2
displayName: 'Pack Templates'
inputs:
Expand All @@ -20,7 +20,7 @@ steps:
- task: CmdLine@2
displayName: 'Install WASM workload'
inputs:
script: 'dotnet workload install --no-cache --disable-parallel ios android wasm-tools --skip-manifest-update --source "https://api.nuget.org/v3/index.json"'
script: 'dotnet workload install --no-cache --disable-parallel ios android wasm-tools wasm-experimental'
- task: PowerShell@2
displayName: 'Run Tests'
inputs:
Expand Down
9 changes: 2 additions & 7 deletions templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using Android.App;
using Android.Content.PM;
using Avalonia.Android;
using Avalonia;

namespace AvaloniaTest.Android
{
[Activity(Label = "AvaloniaTest.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class MainActivity : AvaloniaActivity<App>
[Activity(Label = "AvaloniaTest.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class MainActivity : AvaloniaMainActivity
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder);
}
}
}
15 changes: 14 additions & 1 deletion templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
using Android.App;
using Android.Content;
using Android.OS;
using Application = Android.App.Application;
using Avalonia;
using Avalonia.Android;

namespace AvaloniaTest.Android
{
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : Activity
public class SplashActivity : AvaloniaSplashActivity<App>
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder);
}

protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
}

protected override void OnResume()
{
base.OnResume();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-ios</TargetFramework>
<TargetFramework>net6.0-ios16.0</TargetFramework>
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion>
<ProvisioningType>manual</ProvisioningType>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion templates/csharp/xplat/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.0-preview2</AvaloniaVersion>
<AvaloniaVersion>11.0.0-preview3</AvaloniaVersion>
</PropertyGroup>
</Project>
12 changes: 7 additions & 5 deletions templates/fsharp/xplat/AvaloniaTest.Android/Activities.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace AvaloniaTest.Android
open Android.App
open Android.Content
open Android.Content.PM
open Android.OS
type Application = Android.App.Application

open Avalonia.Android
Expand All @@ -11,17 +12,18 @@ open AvaloniaTest
Label = "AvaloniaTest.Android",
Theme = "@style/MyTheme.NoActionBar",
Icon = "@drawable/icon",
LaunchMode = LaunchMode.SingleInstance,
LaunchMode = LaunchMode.SingleTop,
ConfigurationChanges = (ConfigChanges.Orientation ||| ConfigChanges.ScreenSize))>]
type MainActivity() =
inherit AvaloniaActivity<App>()
inherit AvaloniaMainActivity()

override _.CustomizeAppBuilder(builder) =
base.CustomizeAppBuilder(builder);

[<Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)>]
type SplashActivity() =
inherit Activity()
inherit AvaloniaSplashActivity<App>()

override _.CustomizeAppBuilder(builder) =
base.CustomizeAppBuilder(builder);

override x.OnResume() =
base.OnResume()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-ios</TargetFramework>
<TargetFramework>net6.0-ios16.0</TargetFramework>
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion>
<ProvisioningType>manual</ProvisioningType>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion templates/fsharp/xplat/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.0-preview1</AvaloniaVersion>
<AvaloniaVersion>11.0.0-preview3</AvaloniaVersion>
</PropertyGroup>
</Project>

0 comments on commit 8a9bea1

Please sign in to comment.