-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chenjz
authored and
chenjz
committed
Apr 25, 2024
1 parent
abfe88f
commit 1311ac2
Showing
111 changed files
with
5,928 additions
and
3,440 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
|
||
using Avalonia; | ||
using Avalonia.Android; | ||
using Avalonia.ReactiveUI; | ||
|
||
namespace PeachPlayer.Android; | ||
|
||
[Activity( | ||
Label = "PeachPlayer.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(); | ||
} | ||
} |
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,28 @@ | ||
<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> | ||
<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="..\PeachPlayer\PeachPlayer.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"?> | ||
<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> |
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,8 @@ | ||
{ | ||
"profiles": { | ||
"WSL": { | ||
"commandName": "WSL2", | ||
"distributionName": "" | ||
} | ||
} | ||
} |
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> |
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">#212121</color> | ||
</resources> |
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> |
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,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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,74 @@ | ||
:root { | ||
--sat: env(safe-area-inset-top); | ||
--sar: env(safe-area-inset-right); | ||
--sab: env(safe-area-inset-bottom); | ||
--sal: env(safe-area-inset-left); | ||
} | ||
|
||
/* HTML styles for the splash screen */ | ||
|
||
.highlight { | ||
color: white; | ||
font-size: 2.5rem; | ||
display: block; | ||
} | ||
|
||
.purple { | ||
color: #8b44ac; | ||
} | ||
|
||
.icon { | ||
opacity: 0.05; | ||
height: 35%; | ||
width: 35%; | ||
position: absolute; | ||
background-repeat: no-repeat; | ||
right: 0px; | ||
bottom: 0px; | ||
margin-right: 3%; | ||
margin-bottom: 5%; | ||
z-index: 5000; | ||
background-position: right bottom; | ||
pointer-events: none; | ||
} | ||
|
||
#avalonia-splash a { | ||
color: whitesmoke; | ||
text-decoration: none; | ||
} | ||
|
||
.center { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
|
||
#avalonia-splash { | ||
position: relative; | ||
height: 100%; | ||
width: 100%; | ||
color: whitesmoke; | ||
background: #1b2a4e; | ||
font-family: 'Nunito', sans-serif; | ||
background-position: center; | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.splash-close { | ||
animation: fadeout 0.25s linear forwards; | ||
} | ||
|
||
@keyframes fadeout { | ||
0% { | ||
opacity: 100%; | ||
} | ||
|
||
100% { | ||
opacity: 0; | ||
visibility: collapse; | ||
} | ||
} |
Binary file not shown.
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,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>AvaloniaTest.Browser</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<base href="/" /> | ||
<link rel="modulepreload" href="./main.js" /> | ||
<link rel="modulepreload" href="./dotnet.js" /> | ||
<link rel="modulepreload" href="./avalonia.js" /> | ||
<link rel="stylesheet" href="./app.css" /> | ||
</head> | ||
|
||
<body style="margin: 0px; overflow: hidden"> | ||
<div id="out"> | ||
<div id="avalonia-splash"> | ||
<div class="center"> | ||
<h2 class="purple"> | ||
Powered by | ||
<a class="highlight" href="https://www.avaloniaui.net/" target="_blank">Avalonia UI</a> | ||
</h2> | ||
</div> | ||
<img class="icon" src="Logo.svg" alt="Avalonia Logo" /> | ||
</div> | ||
</div> | ||
<script type='module' src="./main.js"></script> | ||
</body> | ||
|
||
</html> |
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 @@ | ||
import { dotnet } from './dotnet.js' | ||
|
||
const is_browser = typeof window != "undefined"; | ||
if (!is_browser) throw new Error(`Expected to be running in a browser`); | ||
|
||
const dotnetRuntime = await dotnet | ||
.withDiagnosticTracing(false) | ||
.withApplicationArgumentsFromQuery() | ||
.create(); | ||
|
||
const config = dotnetRuntime.getConfig(); | ||
|
||
await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]); |
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,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier> | ||
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<WasmExtraFilesToDeploy Include="AppBundle\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\PeachPlayer\PeachPlayer.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,20 @@ | ||
using System.Runtime.Versioning; | ||
using System.Threading.Tasks; | ||
using Avalonia; | ||
using Avalonia.Browser; | ||
using Avalonia.ReactiveUI; | ||
|
||
using PeachPlayer; | ||
|
||
[assembly: SupportedOSPlatform("browser")] | ||
|
||
internal partial class Program | ||
{ | ||
private static async Task Main(string[] args) => await BuildAvaloniaApp() | ||
.WithInterFont() | ||
.UseReactiveUI() | ||
.StartBrowserAppAsync("out"); | ||
|
||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure<App>(); | ||
} |
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 @@ | ||
{ | ||
"profiles": { | ||
"PeachPlayer.Browser": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:5001;http://localhost:5000", | ||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}" | ||
} | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"wasmHostProperties": { | ||
"perHostConfig": [ | ||
{ | ||
"name": "browser", | ||
"html-path": "index.html", | ||
"Host": "browser" | ||
} | ||
] | ||
} | ||
} |
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects. | ||
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.--> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\PeachPlayer\PeachPlayer.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,24 @@ | ||
using System; | ||
|
||
using Avalonia; | ||
using Avalonia.ReactiveUI; | ||
|
||
namespace PeachPlayer.Desktop; | ||
|
||
class Program | ||
{ | ||
// Initialization code. Don't use any Avalonia, third-party APIs or any | ||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized | ||
// yet and stuff might break. | ||
[STAThread] | ||
public static void Main(string[] args) => BuildAvaloniaApp() | ||
.StartWithClassicDesktopLifetime(args); | ||
|
||
// Avalonia configuration, don't remove; also used by visual designer. | ||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
.WithInterFont() | ||
.LogToTrace() | ||
.UseReactiveUI(); | ||
} |
Oops, something went wrong.