genesis/ui/tidbits (#3)
## Contents * Add bottom bar façade * Apply good practices re. separation of concerns * Generally clean things up Co-authored-by: Alexis DRAI <alexis.drai@etu.uca.fr> Reviewed-on: #3
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:strings="clr-namespace:AMC.View.Resources.Strings"
|
||||||
|
xmlns:ctl="clr-namespace:AMC.View.Controls"
|
||||||
|
x:Class="AMC.View.Controls.BottomBar">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Vertical"
|
||||||
|
BackgroundColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray900}}">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Horizontal"
|
||||||
|
HeightRequest="{StaticResource SpaceXL}">
|
||||||
|
|
||||||
|
<Frame Margin="{StaticResource HSpaceLittleVSpaceVeryLittle}"
|
||||||
|
BackgroundColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray750}}"
|
||||||
|
BorderColor="Transparent"
|
||||||
|
HorizontalOptions="Start"
|
||||||
|
VerticalOptions="Center">
|
||||||
|
<Image Source="icon_default_song.png"
|
||||||
|
Aspect="AspectFill"/>
|
||||||
|
</Frame>
|
||||||
|
|
||||||
|
<Label Text="{x:Static strings:Strings.DefaultPlayingSongLabel}"
|
||||||
|
HorizontalOptions="StartAndExpand"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
TextColor="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
|
||||||
|
|
||||||
|
<ImageButton Source="{AppThemeBinding Light='icon_play.png', Dark='icon_play_dark.png'}"
|
||||||
|
Margin="{StaticResource SpaceS}"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
|
||||||
|
<ImageButton Source="{AppThemeBinding Light='icon_next.png', Dark='icon_next_dark.png'}"
|
||||||
|
Margin="{StaticResource SpaceS}"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<BoxView Style="{StaticResource BottomBarGraySeparator}" />
|
||||||
|
|
||||||
|
|
||||||
|
<FlexLayout Direction="Row"
|
||||||
|
HeightRequest="{StaticResource SpaceXL}"
|
||||||
|
JustifyContent="SpaceAround"
|
||||||
|
AlignItems="Center">
|
||||||
|
|
||||||
|
<ctl:IconLabelButton ButtonSource="icon_bottom_play_gray.png"
|
||||||
|
ButtonLabelText="{x:Static strings:Strings.ListenNowTitle}"
|
||||||
|
LabelTextColor="{StaticResource Gray}"/>
|
||||||
|
|
||||||
|
<ctl:IconLabelButton ButtonSource="icon_bottom_browse_gray.png"
|
||||||
|
ButtonLabelText="{x:Static strings:Strings.BrowseTitle}"
|
||||||
|
LabelTextColor="{StaticResource Gray}"/>
|
||||||
|
|
||||||
|
<ctl:IconLabelButton ButtonSource="icon_bottom_radio_gray.png"
|
||||||
|
ButtonLabelText="{x:Static strings:Strings.RadioTitle}"
|
||||||
|
LabelTextColor="{StaticResource Gray}"/>
|
||||||
|
|
||||||
|
<ctl:IconLabelButton ButtonSource="icon_bottom_library_red.png"
|
||||||
|
ButtonLabelText="{x:Static strings:Strings.LibraryTitle}"
|
||||||
|
LabelTextColor="{StaticResource Secondary}"/>
|
||||||
|
|
||||||
|
<ctl:IconLabelButton ButtonSource="icon_bottom_search_gray.png"
|
||||||
|
ButtonLabelText="{x:Static strings:Strings.SearchTitle}"
|
||||||
|
LabelTextColor="{StaticResource Gray}"/>
|
||||||
|
|
||||||
|
</FlexLayout>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</ContentView>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="AMC.View.Controls.IconLabelButton">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Vertical"
|
||||||
|
Margin="{StaticResource SpaceXS}">
|
||||||
|
|
||||||
|
<ImageButton x:Name="Button"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
|
||||||
|
<Label x:Name="ButtonLabel"
|
||||||
|
FontSize="{StaticResource TinyFontSize}"
|
||||||
|
Margin="{StaticResource SpaceXXS}"/>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</ContentView>
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="AMC.View.Controls.IconLabelButtonWide">
|
||||||
|
|
||||||
|
<Frame HeightRequest="{StaticResource SpaceLXL}"
|
||||||
|
WidthRequest="{StaticResource SpaceXXXL}"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
BackgroundColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray750}}"
|
||||||
|
Margin="{StaticResource SpaceXS}"
|
||||||
|
Padding="{StaticResource SpaceXS}"
|
||||||
|
CornerRadius="{StaticResource SlightlyRoundedCorners}">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Horizontal"
|
||||||
|
HorizontalOptions="CenterAndExpand"
|
||||||
|
VerticalOptions="CenterAndExpand"
|
||||||
|
Spacing="{StaticResource SpaceXXS}">
|
||||||
|
|
||||||
|
<ImageButton x:Name="Button"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
|
||||||
|
<Label x:Name="ButtonLabel"
|
||||||
|
FontSize="{StaticResource SubSubtitleFontSize}"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
TextColor="{StaticResource Secondary}"/>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</Frame>
|
||||||
|
|
||||||
|
</ContentView>
|
Before Width: | Height: | Size: 414 KiB After Width: | Height: | Size: 414 KiB |
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 8.7 KiB |
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<?xaml-comp compile="true" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
|
||||||
|
<x:Double x:Key="SpaceXXS">4</x:Double>
|
||||||
|
<x:Double x:Key="SpaceXS">8</x:Double>
|
||||||
|
<x:Double x:Key="SpaceS">12</x:Double>
|
||||||
|
<x:Double x:Key="SpaceM">16</x:Double>
|
||||||
|
<x:Double x:Key="SpaceML">24</x:Double>
|
||||||
|
<x:Double x:Key="SpaceL">32</x:Double>
|
||||||
|
<x:Double x:Key="SpaceLXL">48</x:Double>
|
||||||
|
<x:Double x:Key="SpaceXL">64</x:Double>
|
||||||
|
<x:Double x:Key="SpaceXXL">128</x:Double>
|
||||||
|
<x:Double x:Key="SpaceXXXL">144</x:Double>
|
||||||
|
<x:Double x:Key="AlbumPageCoverHeight">320</x:Double>
|
||||||
|
|
||||||
|
<Thickness x:Key="BottomBarSpace">0, 0, 0, 128</Thickness>
|
||||||
|
<Thickness x:Key="TopSpaceSome">0, 24, 0, 0</Thickness>
|
||||||
|
<Thickness x:Key="TopBottomSpaceLittle">0, 8, 0, 8</Thickness>
|
||||||
|
<Thickness x:Key="RightSpaceLittle">0, 0, 8, 0</Thickness>
|
||||||
|
<Thickness x:Key="LeftSpaceLittle">8, 0, 0, 0</Thickness>
|
||||||
|
<Thickness x:Key="BottomSpaceLittle">0, 0, 0, 8</Thickness>
|
||||||
|
<Thickness x:Key="LeftRightSpaceLarge">32, 0, 32, 0</Thickness>
|
||||||
|
<Thickness x:Key="WideButtonLeft">16, 16, 8, 16</Thickness>
|
||||||
|
<Thickness x:Key="WideButtonRight">8, 16, 16, 16</Thickness>
|
||||||
|
<Thickness x:Key="HSpaceLittleVSpaceVeryLittle">8, 4, 8, 4</Thickness>
|
||||||
|
|
||||||
|
<CornerRadius x:Key="SlightlyRoundedCorners">8</CornerRadius>
|
||||||
|
|
||||||
|
<x:Double x:Key="TitleFontSize">32</x:Double>
|
||||||
|
<x:Double x:Key="SubtitleFontSize">24</x:Double>
|
||||||
|
<x:Double x:Key="SubSubtitleFontSize">16</x:Double>
|
||||||
|
<x:Double x:Key="DetailsFontSize">12</x:Double>
|
||||||
|
<x:Double x:Key="TinyFontSize">8</x:Double>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
@ -1,7 +1,94 @@
|
|||||||
# AD_MAUI
|
# Apple Music Clone
|
||||||
|
|
||||||
A MAUI Apple Music mini-clone based on [these instructions](https://codefirst.iut.uca.fr/git/mchSamples_.NET/MAUI_TP1_2023)
|
## Project Overview
|
||||||
|
|
||||||
## README stuff
|
Apple Music allows users to listen to music, browse playlists, and interact with a
|
||||||
|
sophisticated UI to control their playback.
|
||||||
|
|
||||||
It goes here...
|
This clone does not.
|
||||||
|
|
||||||
|
Apple Music Clone is an application built on the .NET MAUI (Multi-platform App UI)
|
||||||
|
framework. It focuses on the `Library` "master-detail". As of the 20th of May 2023,
|
||||||
|
it is a _façade_: only the View part of the project is serviceable.
|
||||||
|
|
||||||
|
## The View
|
||||||
|
|
||||||
|
* ### Library ("master")
|
||||||
|
|
||||||
|
Users can browse a `Library` of `Album` and select any album to inspect.
|
||||||
|
|
||||||
|
* ### Album ("detail")
|
||||||
|
|
||||||
|
Users can browse an `Album` of `Songs`.
|
||||||
|
|
||||||
|
* ### Dark/Light theme
|
||||||
|
|
||||||
|
This clone replicates the original dark/light themes by Apple music.
|
||||||
|
|
||||||
|
To test this, you can change your device's (or your emulator's) display
|
||||||
|
setting to dark/light theme.
|
||||||
|
|
||||||
|
* ### `i18n`: `en`, `fr`
|
||||||
|
|
||||||
|
This clone supports two locales: English (by default), and French.
|
||||||
|
|
||||||
|
To test this, you can change your device's (or your emulator's) primary language
|
||||||
|
settings to English/French.
|
||||||
|
|
||||||
|
* ### Bottom bar
|
||||||
|
|
||||||
|
In Apple Music, a consistent, stylish, slightly transparent bottom bar allows
|
||||||
|
navigation between different views, and paying songs.
|
||||||
|
|
||||||
|
In this clone, the bar is just eye-candy, and not even a little bit transparent.
|
||||||
|
|
||||||
|
* ### Top bar
|
||||||
|
|
||||||
|
In Apple Music, a stylish, slightly transparent top bar contains certain menu
|
||||||
|
options, and displays the name of the current
|
||||||
|
section once the user has scrolled past the corresponding header.
|
||||||
|
|
||||||
|
In this clone, the top bar is left at the OS default.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To run the Apple Music Clone, you must first install .NET MAUI. You can follow
|
||||||
|
[the official guide](https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation)
|
||||||
|
for the same.
|
||||||
|
|
||||||
|
Once MAUI is installed, clone this repository and open the `AD_MAUI.sln` Solution in
|
||||||
|
*Visual Studio*.
|
||||||
|
|
||||||
|
If you don't have an Android emulator installed for *Visual Studio* already, open the
|
||||||
|
*Android Device Manager* to take care of that. For reference, this project was tested on a
|
||||||
|
`Pixel 5 - API 33 (Android 13.0 - API 33)`.
|
||||||
|
|
||||||
|
When you're ready to run the project, please make sure you launch the `AMC.View` project as a
|
||||||
|
`Single startup project`, if *Visual Studio* hasn't configured it that way automatically.
|
||||||
|
|
||||||
|
## Some known limitations and shortcomings
|
||||||
|
|
||||||
|
Concerning the View part of this project:
|
||||||
|
* the bottom bar is inserted once in the `Library` view, and once in the `Album` view
|
||||||
|
* instead, it should be incorporated in a main layout.
|
||||||
|
* the bottom bar's "top" part, AKA the player, has some repeated code.
|
||||||
|
```csharp
|
||||||
|
<ImageButton Source="{AppThemeBinding Light='icon_play.png', Dark='icon_play_dark.png'}"
|
||||||
|
Margin="{StaticResource SpaceS}"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
|
||||||
|
<ImageButton Source="{AppThemeBinding Light='icon_next.png', Dark='icon_next_dark.png'}"
|
||||||
|
Margin="{StaticResource SpaceS}"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HeightRequest="{StaticResource SpaceML}"
|
||||||
|
WidthRequest="{StaticResource SpaceML}" />
|
||||||
|
```
|
||||||
|
* instead, it should have been extracted into another reusable component, but there were
|
||||||
|
difficulties in doing that -- having to do with the dark/light themes.
|
||||||
|
* the bottom bar is not as stylish as the original.
|
||||||
|
* the top bar was left to the OS default.
|
||||||
|
* and many others will join this list, no doubt.
|