-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from AvaloniaUI/features/ios
XPlat template supports iOS and Android
- Loading branch information
Showing
32 changed files
with
333 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0-android</TargetFramework> | ||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion> | ||
<Nullable>enable</Nullable> | ||
<ApplicationId>com.CompanyName.AvaloniaTest</ApplicationId> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<AndroidPackageFormat>apk</AndroidPackageFormat> | ||
<MSBuildEnableWorkloadResolver>true</MSBuildEnableWorkloadResolver> | ||
<!--<RunAOTCompilation>true</RunAOTCompilation> | ||
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>--> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<AndroidResource Include="Icon.png"> | ||
<Link>Resources\drawable\Icon.png</Link> | ||
</AndroidResource> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)'=='Release' and '$(TF_BUILD)' == ''"> | ||
<RunAOTCompilation>True</RunAOTCompilation> | ||
<EnableLLVM>True</EnableLLVM> | ||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk> | ||
<RunAOTCompilation>False</RunAOTCompilation> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.1.3" /> | ||
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel" Version="2.3.1.3" /> | ||
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AvaloniaTest\AvaloniaTest.csproj" /> | ||
</ItemGroup> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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> | ||
{ | ||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) | ||
{ | ||
return base.CustomizeAppBuilder(builder); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
templates/csharp/xplat/AvaloniaTest.Android/Properties/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?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="AvaloniaTest" android:icon="@drawable/Icon" /> | ||
</manifest> |
13 changes: 13 additions & 0 deletions
13
templates/csharp/xplat/AvaloniaTest.Android/Resources/drawable/splash_screen.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
4
templates/csharp/xplat/AvaloniaTest.Android/Resources/values/colors.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
17 changes: 17 additions & 0 deletions
17
templates/csharp/xplat/AvaloniaTest.Android/Resources/values/styles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<resources> | ||
|
||
<style name="MyTheme"> | ||
</style> | ||
|
||
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar"> | ||
<item name="android:windowActionBar">false</item> | ||
<item name="android:windowNoTitle">true</item> | ||
</style> | ||
|
||
<style name="MyTheme.Splash" parent ="MyTheme.NoActionBar"> | ||
<item name="android:windowBackground">@drawable/splash_screen</item> | ||
<item name="android:windowContentOverlay">@null</item> | ||
</style> | ||
|
||
</resources> |
17 changes: 17 additions & 0 deletions
17
templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Android.App; | ||
using Android.Content; | ||
using Application = Android.App.Application; | ||
|
||
namespace AvaloniaTest.Android | ||
{ | ||
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] | ||
public class SplashActivity : Activity | ||
{ | ||
protected override void OnResume() | ||
{ | ||
base.OnResume(); | ||
|
||
StartActivity(new Intent(Application.Context, typeof(MainActivity))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Foundation; | ||
using UIKit; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.iOS; | ||
using Avalonia.Media; | ||
|
||
namespace AvaloniaTest.iOS | ||
{ | ||
// The UIApplicationDelegate for the application. This class is responsible for launching the | ||
// User Interface of the application, as well as listening (and optionally responding) to | ||
// application events from iOS. | ||
[Register("AppDelegate")] | ||
public partial class AppDelegate : AvaloniaAppDelegate<App> | ||
{ | ||
|
||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0-ios</TargetFramework> | ||
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion> | ||
<ProvisioningType>manual</ProvisioningType> | ||
<Nullable>enable</Nullable> | ||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> | ||
|
||
<!-- These properties need to be set in order to run on a real iDevice --> | ||
<!--<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>--> | ||
<!--<CodesignKey></CodesignKey>--> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia.iOS" Version="$(AvaloniaVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AvaloniaTest\AvaloniaTest.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDisplayName</key> | ||
<string>AvaloniaTest</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>companyName.AvaloniaTest</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>MinimumOSVersion</key> | ||
<string>10.0</string> | ||
<key>UIDeviceFamily</key> | ||
<array> | ||
<integer>1</integer> | ||
<integer>2</integer> | ||
</array> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UIStatusBarHidden</key> | ||
<true/> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<false/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using UIKit; | ||
|
||
namespace AvaloniaTest.iOS | ||
{ | ||
public class Application | ||
{ | ||
// This is the main entry point of the application. | ||
static void Main(string[] args) | ||
{ | ||
// if you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main(args, null, typeof(AppDelegate)); | ||
} | ||
} | ||
} |
Oops, something went wrong.