Skip to content

Commit

Permalink
Rename Samples to Playground (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
albi005 authored Jun 9, 2022
1 parent 2a48c13 commit 52ffb89
Show file tree
Hide file tree
Showing 71 changed files with 128 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main
paths:
- MaterialColorUtilities**
- Samples**
- Playground**
- .github/workflows/ci.yml

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: dotnet workload install wasm-tools

- name: Publish .NET Core Project
run: dotnet publish "Samples\MaterialColorUtilities.Samples.Wasm\MaterialColorUtilities.Samples.Wasm.csproj" -c Release -o release --nologo
run: dotnet publish "Playground\Playground.Wasm\Playground.Wasm.csproj" -c Release -o release --nologo

# change the base-tag in index.html from '/' to 'MaterialColorUtilities' to match GitHub Pages repository subdirectory
- name: Change base-tag in index.html from / to MaterialColorUtilities
Expand Down
10 changes: 5 additions & 5 deletions MaterialColorUtilities.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.SourceGenerators", "MaterialColorUtilities.SourceGenerators\MaterialColorUtilities.SourceGenerators.csproj", "{13AF7E9C-9F4A-4D9C-BA64-0A7BAA23C0A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.Samples.Console", "Samples\MaterialColorUtilities.Samples.Console\MaterialColorUtilities.Samples.Console.csproj", "{14D6A693-7174-4A4C-B1EF-3528B98041B2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground.Console", "Playground\Playground.Console\Playground.Console.csproj", "{14D6A693-7174-4A4C-B1EF-3528B98041B2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.Samples.Maui", "Samples\MaterialColorUtilities.Samples.Maui\MaterialColorUtilities.Samples.Maui.csproj", "{1A4BD9E1-4EC5-4D39-B643-08EEDCA3F59E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground.Maui", "Playground\Playground.Maui\Playground.Maui.csproj", "{1A4BD9E1-4EC5-4D39-B643-08EEDCA3F59E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.Samples.Shared", "Samples\MaterialColorUtilities.Samples.Shared\MaterialColorUtilities.Samples.Shared.csproj", "{18275535-E672-4C50-A459-CF768116B544}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground.Shared", "Playground\Playground.Shared\Playground.Shared.csproj", "{18275535-E672-4C50-A459-CF768116B544}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaterialColorUtilities.Samples.Wasm", "Samples\MaterialColorUtilities.Samples.Wasm\MaterialColorUtilities.Samples.Wasm.csproj", "{C3E52F2E-BA86-4BA2-A4F4-C88C50516B68}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground.Wasm", "Playground\Playground.Wasm\Playground.Wasm.csproj", "{C3E52F2E-BA86-4BA2-A4F4-C88C50516B68}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{097D3E8C-2CB9-49CE-B4D8-2F4BC94A78A5}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Playground", "Playground", "{097D3E8C-2CB9-49CE-B4D8-2F4BC94A78A5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{37DE3A3E-58B3-41FD-8DFB-231209ACCBC2}"
ProjectSection(SolutionItems) = preProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MaterialColorUtilities.Samples.Console
namespace Playground.Console
{
public class ConsoleHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using MaterialColorUtilities.Blend;
using MaterialColorUtilities.Palettes;
using MaterialColorUtilities.Samples.Console;
using MaterialColorUtilities.Schemes;
using MaterialColorUtilities.Utils;
using Playground.Console;
using SkiaSharp;
using System.Drawing;
using System.Reflection;

// Extract a seed color from an image:
// Load the image into an int[].
// The image is stored in an embedded resource, and then decoded and resized using SkiaSharp.
string imageResourceId = "MaterialColorUtilities.Samples.Console.Resources.wallpaper.webp";
string imageResourceId = "Playground.Console.Resources.wallpaper.webp";
using Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(imageResourceId);
SKBitmap bitmap = SKBitmap.Decode(resourceStream).Resize(new SKImageInfo(112, 112), SKFilterQuality.Medium);
int[] pixels = bitmap.Pixels.Select(p => (int)(uint)p).ToArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MaterialColorUtilities.Samples.Maui"
x:Class="MaterialColorUtilities.Samples.Maui.App">
xmlns:local="clr-namespace:Playground.Maui"
x:Class="Playground.Maui.App">
<Application.Resources>
<!--Placeholders for IntelliSense-->
<Color x:Key="Primary" />
Expand Down
16 changes: 16 additions & 0 deletions Playground/Playground.Maui/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Playground.Maui.Services;

namespace Playground.Maui;

public partial class App : Application
{
public App(ThemeService themeService)
{
InitializeComponent();

themeService.Apply();
RequestedThemeChanged += (sender, args) => themeService.Apply();

MainPage = new AppShell();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MaterialColorUtilities.Samples.Maui.AppShell"
x:Class="Playground.Maui.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MaterialColorUtilities.Samples.Maui"
xmlns:local="clr-namespace:Playground.Maui"
Shell.FlyoutBehavior="Flyout"
>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui
{
public partial class AppShell : Shell
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
namespace MaterialColorUtilities.Samples.Maui.Components;
namespace Playground.Maui.Components;

public class ColorPlot : GraphicsView
{
private readonly Func<double, double, int> _func;
private readonly double _xMax;
private readonly double _yMax;
private readonly Color[,] _pixels = new Color[400,200];
private readonly Color[,] _pixels = new Color[400, 200];

public ColorPlot(Func<double, double, int> func, string xLabel, double xMax, string yLabel, double yMax)
{
_func = func;
_xMax = xMax;
_yMax = yMax;

HeightRequest = 240;
WidthRequest = 460;
HorizontalOptions = LayoutOptions.Start;

_ = Task.Run(Calculate).ContinueWith(t =>
{
MainThread.BeginInvokeOnMainThread(() =>
Expand Down Expand Up @@ -78,6 +78,6 @@ public void Draw(ICanvas canvas, RectF dirtyRect)
canvas.DrawString(yMax.ToString(), 2, 234, HorizontalAlignment.Left);
canvas.Rotate(-90);
canvas.DrawString(yLabel, -120, 12, HorizontalAlignment.Center);
}
}
}
}
20 changes: 20 additions & 0 deletions Playground/Playground.Maui/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Playground.Maui.Services;
using Playground.Maui.ViewModels;

namespace Playground.Maui;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
MauiAppBuilder builder = MauiApp
.CreateBuilder()
.UseMauiApp<App>();

builder.Services.AddSingleton<ThemeService>();
builder.Services.AddTransient<ThemeViewModel>();
builder.Services.AddTransient<ThemePage>();

return builder.Build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Android.Content.PM;
using Android.OS;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.Android
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Android.App;
using Android.Runtime;
using Playground.Maui;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.Android
{
[Application]
public class MainApplication : MauiApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Foundation;
using Playground.Maui;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.MacCatalyst
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ObjCRuntime;
using UIKit;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.MacCatalyst
{
public class Program
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Maui.Hosting;
using System;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui
{
internal class Program : MauiApplication
{
Expand Down
15 changes: 15 additions & 0 deletions Playground/Playground.Maui/Platforms/Tizen/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.materialcolorutilities.playground.maui" version="1.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="com.materialcolorutilities.playground.maui" exec="Playground.Maui.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>Material Color Utilities</label>
<icon>appicon.xhigh.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<maui:MauiWinUIApplication
x:Class="MaterialColorUtilities.Samples.Maui.WinUI.App"
x:Class="Playground.Maui.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:MaterialColorUtilities.Samples.Maui.WinUI">
xmlns:local="using:Playground.Maui.WinUI">

</maui:MauiWinUIApplication>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Microsoft.UI.Xaml;
using Playground.Maui;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace MaterialColorUtilities.Samples.Maui.WinUI
namespace Playground.Maui.WinUI
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MaterialColorUtilities.Samples.Maui.WinUI.app"/>
<assemblyIdentity version="1.0.0.0" name="Playground.Maui.WinUI.app"/>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Foundation;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.iOS
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ObjCRuntime;
using UIKit;

namespace MaterialColorUtilities.Samples.Maui
namespace Playground.Maui.Platforms.iOS
{
public class Program
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>MaterialColorUtilities.Samples.Maui</RootNamespace>
<RootNamespace>Playground.Maui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>MaterialColorUtilities.Samples.Maui</ApplicationTitle>
<ApplicationTitle>Material Color Utilities</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.materialcolorutilities.samples.maui</ApplicationId>
<ApplicationId>com.materialcolorutilities.playground.maui</ApplicationId>
<ApplicationIdGuid>94280315-BFE7-40F5-9EC9-A06EFDB9576F</ApplicationIdGuid>

<!-- Versions -->
Expand Down Expand Up @@ -59,7 +59,7 @@
<ItemGroup>
<ProjectReference Include="..\..\MaterialColorUtilities.SourceGenerators\MaterialColorUtilities.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\MaterialColorUtilities\MaterialColorUtilities.csproj" />
<ProjectReference Include="..\MaterialColorUtilities.Samples.Shared\MaterialColorUtilities.Samples.Shared.csproj" />
<ProjectReference Include="..\Playground.Shared\Playground.Shared.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using MaterialColorUtilities.Palettes;
using MaterialColorUtilities.Samples.Shared;
using MaterialColorUtilities.Schemes;
using MaterialColorUtilities.Score;
using Playground.Shared;

namespace MaterialColorUtilities.Samples.Maui.Services;
namespace Playground.Maui.Services;

public class ThemeService
{
private int seed = Score.Scorer.Default;
private int seed = Scorer.Default;

public int Seed
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using MaterialColorUtilities.ColorAppearance;
using MaterialColorUtilities.Samples.Maui.Services;
using Playground.Maui.Services;

namespace MaterialColorUtilities.Samples.Maui.ViewModels;
namespace Playground.Maui.ViewModels;

public partial class ThemeViewModel : ObservableObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MaterialColorUtilities.Samples.Maui.GraphsPage"
x:Class="Playground.Maui.GraphsPage"
Title="Graphs"
BackgroundColor="{DynamicResource Primary}">
<ScrollView>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using MaterialColorUtilities.ColorAppearance;
using MaterialColorUtilities.Samples.Maui.Components;
using Playground.Maui.Components;

namespace MaterialColorUtilities.Samples.Maui;
namespace Playground.Maui;

public partial class GraphsPage : ContentPage
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:viewModels="clr-namespace:MaterialColorUtilities.Samples.Maui.ViewModels"
xmlns:viewModels="clr-namespace:Playground.Maui.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MaterialColorUtilities.Samples.Maui.ThemePage"
x:Class="Playground.Maui.ThemePage"
Title="Theme"
x:DataType="viewModels:ThemeViewModel">
<StackLayout Padding="16" Spacing="8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using MaterialColorUtilities.Samples.Maui.Services;
using MaterialColorUtilities.Samples.Maui.ViewModels;
using Playground.Maui.ViewModels;

namespace MaterialColorUtilities.Samples.Maui;
namespace Playground.Maui;

public partial class ThemePage : ContentPage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using MaterialColorUtilities.Palettes;
using MaterialColorUtilities.Schemes;

namespace MaterialColorUtilities.Samples.Shared;
namespace Playground.Shared;

public partial class AppScheme<TColor> : Scheme<TColor>
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using MaterialColorUtilities.Utils;
using MudBlazor.Utilities;

namespace MaterialColorUtilities.Samples.Wasm.Extensions
namespace Playground.Wasm.Extensions
{
public static class IntExtensions
{
Expand Down
Loading

0 comments on commit 52ffb89

Please sign in to comment.