diff --git a/Meio.App/App.axaml b/Meio.App/App.axaml index fce12ed..5c9ebf7 100644 --- a/Meio.App/App.axaml +++ b/Meio.App/App.axaml @@ -5,6 +5,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Meio.App/App.axaml.cs b/Meio.App/App.axaml.cs index 23be316..61c924d 100644 --- a/Meio.App/App.axaml.cs +++ b/Meio.App/App.axaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using Meio.app.Views; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; using PrettyLogging.Console; diff --git a/Meio.App/Assets/playlistbanner.jpg b/Meio.App/Assets/playlistbanner.jpg new file mode 100644 index 0000000..84d5d87 Binary files /dev/null and b/Meio.App/Assets/playlistbanner.jpg differ diff --git a/Meio.App/Assets/svg/PlayerWidget/playerWidget_backward.svg b/Meio.App/Assets/svg/PlayerWidget/playerWidget_backward.svg new file mode 100644 index 0000000..8a4857c --- /dev/null +++ b/Meio.App/Assets/svg/PlayerWidget/playerWidget_backward.svg @@ -0,0 +1,4 @@ + + + diff --git a/Meio.App/Assets/svg/PlayerWidget/playerWidget_forward.svg b/Meio.App/Assets/svg/PlayerWidget/playerWidget_forward.svg new file mode 100644 index 0000000..eb6003e --- /dev/null +++ b/Meio.App/Assets/svg/PlayerWidget/playerWidget_forward.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/Meio.App/Assets/svg/PlayerWidget/playerWidget_play.svg b/Meio.App/Assets/svg/PlayerWidget/playerWidget_play.svg new file mode 100644 index 0000000..fe1b12f --- /dev/null +++ b/Meio.App/Assets/svg/PlayerWidget/playerWidget_play.svg @@ -0,0 +1,4 @@ + + + diff --git a/Meio.App/Assets/svg/PlayerWidget/playerWidget_spectre.svg b/Meio.App/Assets/svg/PlayerWidget/playerWidget_spectre.svg new file mode 100644 index 0000000..99f024d --- /dev/null +++ b/Meio.App/Assets/svg/PlayerWidget/playerWidget_spectre.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Meio.App/Assets/svg/PlayerWidget/playerWidget_volume.svg b/Meio.App/Assets/svg/PlayerWidget/playerWidget_volume.svg new file mode 100644 index 0000000..ea1c9f5 --- /dev/null +++ b/Meio.App/Assets/svg/PlayerWidget/playerWidget_volume.svg @@ -0,0 +1,4 @@ + + + diff --git a/Meio.App/Assets/svg/Playlist/playlist_like.svg b/Meio.App/Assets/svg/Playlist/playlist_like.svg new file mode 100644 index 0000000..ca16a0d --- /dev/null +++ b/Meio.App/Assets/svg/Playlist/playlist_like.svg @@ -0,0 +1,3 @@ + + + diff --git a/Meio.App/Assets/svg/Playlist/playlist_play.svg b/Meio.App/Assets/svg/Playlist/playlist_play.svg new file mode 100644 index 0000000..2959ec4 --- /dev/null +++ b/Meio.App/Assets/svg/Playlist/playlist_play.svg @@ -0,0 +1,6 @@ + + + + diff --git a/Meio.App/Assets/svg/hamburger_md.svg b/Meio.App/Assets/svg/hamburger_md.svg new file mode 100644 index 0000000..3583a8c --- /dev/null +++ b/Meio.App/Assets/svg/hamburger_md.svg @@ -0,0 +1,6 @@ + + + + + diff --git a/Meio.App/Assets/svg/other.svg b/Meio.App/Assets/svg/other.svg new file mode 100644 index 0000000..fd566b3 --- /dev/null +++ b/Meio.App/Assets/svg/other.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/Meio.App/Assets/svg/searchWidget_icon.svg b/Meio.App/Assets/svg/searchWidget_icon.svg new file mode 100644 index 0000000..0b5e9dc --- /dev/null +++ b/Meio.App/Assets/svg/searchWidget_icon.svg @@ -0,0 +1,7 @@ + + + + diff --git a/Meio.App/Assets/svg/shuffle.svg b/Meio.App/Assets/svg/shuffle.svg new file mode 100644 index 0000000..3d61a82 --- /dev/null +++ b/Meio.App/Assets/svg/shuffle.svg @@ -0,0 +1,4 @@ + + + diff --git a/Meio.App/Controls/Background.axaml b/Meio.App/Controls/Background.axaml new file mode 100644 index 0000000..47656e1 --- /dev/null +++ b/Meio.App/Controls/Background.axaml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/Meio.App/Controls/Background.axaml.cs b/Meio.App/Controls/Background.axaml.cs new file mode 100644 index 0000000..4bd5752 --- /dev/null +++ b/Meio.App/Controls/Background.axaml.cs @@ -0,0 +1,99 @@ +using System; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Controls.Shapes; +using Avalonia.Input; +using Avalonia.Media; + +namespace Meio.app.Controls; + +public class Background : TemplatedControl +{ + private new const int Width = 1366; + private new const int Height = 768; + private new const int MinEllipseSize = 50; + private static readonly Ellipse[] Shapes = []; + private Canvas? _canvas; + private static readonly Random Random = new(); // TODO: Better randomisation + + // TODO: variable ellipse count and brushes via settings + // TODO: Convenient ellipse count according to window size + private const int Count = 20; + + private readonly IBrush[] _brushes = + [ + new SolidColorBrush(Color.Parse("#BFA83939")), + new SolidColorBrush(Color.Parse("#BFFFCACA")), + new SolidColorBrush(Color.Parse("#BF772727")) + ]; + + private static void GenerateEllipses(int count, IBrush[] brushes, Canvas canvas) + { + for (var i = 0; i < count; i++) + { + var posX = Random.NextDouble() * Width; + var posY = Random.NextDouble() * Height; + var size = Random.Next(MinEllipseSize, Height / 2); + var color = brushes[Random.Next(0, brushes.Length)]; + + var ellipse = new Ellipse + { + Width = size, + Height = size, + Fill = color, + ZIndex = 0 + }; + + Shapes.Append(ellipse); + + ellipse.SetValue(Canvas.LeftProperty, posX); + ellipse.SetValue(Canvas.TopProperty, posY); + + canvas.Children.Add(ellipse); + } + } + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + // e.NameScope.FindResource("PrimaryBrush") as IBrush; + base.OnApplyTemplate(e); + _canvas = e.NameScope.Get("Background"); + _canvas.PointerMoved += (s, e) => Console.WriteLine("Pointer moved!"); // TODO: not working car pas focus? + + GenerateEllipses(Count, _brushes, _canvas); + } + + /*private static double[] GenerateMoveSpeeds() + { + var speeds = new double[Shapes.Length]; + + for (var i = 0; i < Shapes.Length; i++) + { + speeds.Append(Random.NextDouble()); + } + + return speeds; + } + + private void Canvas_PointerMoved(object? sender, PointerEventArgs e) + { + if (_canvas == null) return; + + var speeds = GenerateMoveSpeeds(); + Console.WriteLine(speeds); + + var pos = e.GetPosition(this); + var centerX = _canvas.Bounds.Width / 2; + var centerY = _canvas.Bounds.Height / 2; + + var offsetX = pos.X - centerX; + var offsetY = pos.Y - centerY; + + for (var i = 0; i < Shapes.Length; i++) + { + Shapes[i].SetValue(Canvas.LeftProperty, centerX + offsetX * speeds[i]); + Shapes[i].SetValue(Canvas.TopProperty, centerY + offsetY * speeds[i]); + } + }*/ +} \ No newline at end of file diff --git a/Meio.App/Controls/Card.axaml b/Meio.App/Controls/Card.axaml new file mode 100644 index 0000000..19c8a8a --- /dev/null +++ b/Meio.App/Controls/Card.axaml @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file diff --git a/Meio.App/Controls/Card.axaml.cs b/Meio.App/Controls/Card.axaml.cs new file mode 100644 index 0000000..524565c --- /dev/null +++ b/Meio.App/Controls/Card.axaml.cs @@ -0,0 +1,44 @@ +using System.Windows.Input; +using Avalonia; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Media; + +namespace Meio.app.Controls; + +public class Card : TemplatedControl +{ + public static readonly StyledProperty TitleProperty = + AvaloniaProperty.Register(nameof(Title)); + + public static readonly StyledProperty CoverBrushProperty = + AvaloniaProperty.Register(nameof(CoverBrush)); + + public static readonly StyledProperty CommandProperty = + AvaloniaProperty.Register(nameof(Command)); + + public string Title + { + get => GetValue(TitleProperty); + set => SetValue(TitleProperty, value); + } + + public IBrush? CoverBrush + { + get => GetValue(CoverBrushProperty); + set => SetValue(CoverBrushProperty, value); + } + + public ICommand? Command + { + get => GetValue(CommandProperty); + set => SetValue(CommandProperty, value); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + if (Command?.CanExecute(null) == true) + Command.Execute(null); + } +} \ No newline at end of file diff --git a/Meio.App/Controls/HomeBar.axaml b/Meio.App/Controls/HomeBar.axaml new file mode 100644 index 0000000..2b13fd6 --- /dev/null +++ b/Meio.App/Controls/HomeBar.axaml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/Meio.App/Controls/HomeBar.axaml.cs b/Meio.App/Controls/HomeBar.axaml.cs new file mode 100644 index 0000000..8a04b2b --- /dev/null +++ b/Meio.App/Controls/HomeBar.axaml.cs @@ -0,0 +1,7 @@ +using Avalonia.Controls.Primitives; + +namespace Meio.app.Controls; + +public class HomeBar : TemplatedControl +{ +} \ No newline at end of file diff --git a/Meio.App/Controls/PlayingWidget.axaml b/Meio.App/Controls/PlayingWidget.axaml new file mode 100644 index 0000000..968a3b0 --- /dev/null +++ b/Meio.App/Controls/PlayingWidget.axaml @@ -0,0 +1,62 @@ + + + + + + + \ No newline at end of file diff --git a/Meio.App/Controls/PlayingWidget.axaml.cs b/Meio.App/Controls/PlayingWidget.axaml.cs new file mode 100644 index 0000000..4d69f5c --- /dev/null +++ b/Meio.App/Controls/PlayingWidget.axaml.cs @@ -0,0 +1,7 @@ +using Avalonia.Controls.Primitives; + +namespace Meio.app.Controls; + +public class PlayingWidget : TemplatedControl +{ +} \ No newline at end of file diff --git a/Meio.App/Controls/PlaylistCard.axaml b/Meio.App/Controls/PlaylistCard.axaml new file mode 100644 index 0000000..a0f51c1 --- /dev/null +++ b/Meio.App/Controls/PlaylistCard.axaml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/Meio.App/Controls/PlaylistCard.axaml.cs b/Meio.App/Controls/PlaylistCard.axaml.cs new file mode 100644 index 0000000..b320fd3 --- /dev/null +++ b/Meio.App/Controls/PlaylistCard.axaml.cs @@ -0,0 +1,35 @@ +using System.Windows.Input; +using Avalonia; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Media; + +namespace Meio.app.Controls; + +public class PlaylistCard : TemplatedControl +{ + public static readonly StyledProperty CoverBrushProperty = + AvaloniaProperty.Register(nameof(CoverBrush)); + + public static readonly StyledProperty CommandProperty = + AvaloniaProperty.Register(nameof(Command)); + + public IBrush? CoverBrush + { + get => GetValue(CoverBrushProperty); + set => SetValue(CoverBrushProperty, value); + } + + public ICommand? Command + { + get => GetValue(CommandProperty); + set => SetValue(CommandProperty, value); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + base.OnPointerPressed(e); + if (Command?.CanExecute(null) == true) + Command.Execute(null); + } +} \ No newline at end of file diff --git a/Meio.App/MainWindow.axaml b/Meio.App/MainWindow.axaml deleted file mode 100644 index e61780c..0000000 --- a/Meio.App/MainWindow.axaml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - Currently reading - - - - - + + + + + + + + + Meio v ( | ) + License: MIT + Made with ❤️ by nodeSoftwares and its contributors + + + + \ No newline at end of file diff --git a/Meio.App/Views/SettingsView.axaml.cs b/Meio.App/Views/SettingsView.axaml.cs new file mode 100644 index 0000000..17587b5 --- /dev/null +++ b/Meio.App/Views/SettingsView.axaml.cs @@ -0,0 +1,19 @@ +using Avalonia.Controls; +using Meio.app.Services; +using Microsoft.Extensions.Logging; + +namespace Meio.app.Views; + +public partial class SettingsView : UserControl, INavigable +{ + public SettingsView() + { + InitializeComponent(); + } + + + public void OnNavigateTo(object? parameter) + { + App.Logger!.LogTrace("Navigated to the settings page."); + } +} \ No newline at end of file