Skip to content

Commit

Permalink
style: minor UI fixes (#464)
Browse files Browse the repository at this point in the history
* fix custom accent brushes

* remove xaml ui command

* fix artists page shuffle button minimal state

add scrollchaining to semantic zoom

* fix network page no content grid

* fix titlebar text theme switching

* improve player header and controls background

* reorder dropdown content property and simplify method

* revert AccentFillColorCustomBrush change

---------

Co-authored-by: Tung Huynh <tung75605@gmail.com>
  • Loading branch information
United600 and huynhsontung authored Oct 30, 2024
1 parent bd4e86b commit a84db69
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 88 deletions.
8 changes: 5 additions & 3 deletions Screenbox/Pages/AlbumsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
Margin="{StaticResource ContentPagePadding}"
HorizontalAlignment="Right"
AccessKey="{strings:KeyboardResources Key=CommandSortByKey}"
AutomationProperties.Name="{x:Bind SortByText.Text}"
Background="Transparent"
BorderBrush="Transparent">
<muxc:DropDownButton.Flyout>
Expand Down Expand Up @@ -107,7 +108,7 @@
</MenuFlyout>
</muxc:DropDownButton.Flyout>
<StackPanel Orientation="Horizontal">
<FontIcon Margin="0,0,8,0" Glyph="&#xE8cb;" />
<FontIcon Margin="0,0,8,0" Glyph="&#xE8CB;" />
<TextBlock x:Name="SortByText"><Run Text="{strings:Resources Key=SortBy}" /><Run Text=":&#160;" /></TextBlock>
<TextBlock Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}" Text="{x:Bind GetSortByText(ViewModel.SortBy), Mode=OneWay}" />
</StackPanel>
Expand All @@ -133,6 +134,7 @@
ItemTemplate="{StaticResource AlbumGridViewItemTemplate}"
ItemsSource="{x:Bind AlbumsSource.View}"
Loaded="AlbumGridView_OnLoaded"
ScrollViewer.IsHorizontalScrollChainingEnabled="False"
SelectionMode="None">
<GridView.GroupStyle>
<GroupStyle
Expand Down Expand Up @@ -190,11 +192,11 @@
</triggers:IsEqualStateTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="AlbumGridView.Padding" Value="{StaticResource GridViewContentPageMinimalPadding}" />
<Setter Target="GroupOverview.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="ShufflePlayButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="SortByButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="SortByText.Visibility" Value="Collapsed" />
<Setter Target="AlbumGridView.Padding" Value="{StaticResource GridViewContentPageMinimalPadding}" />
<Setter Target="GroupOverview.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
5 changes: 3 additions & 2 deletions Screenbox/Pages/ArtistsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
ItemTemplate="{StaticResource ArtistGridViewItemTemplate}"
ItemsSource="{x:Bind ArtistsSource.View}"
Loaded="ArtistGridView_OnLoaded"
ScrollViewer.IsHorizontalScrollChainingEnabled="False"
SelectionMode="None">
<GridView.GroupStyle>
<GroupStyle
Expand Down Expand Up @@ -134,10 +135,10 @@
</triggers:IsEqualStateTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ShufflePlayButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />
<!--<Setter Target="SortByButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />-->
<Setter Target="ArtistGridView.Padding" Value="{StaticResource GridViewContentPageMinimalPadding}" />
<Setter Target="GroupOverview.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="ShufflePlayButton.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="SortByButton.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
50 changes: 21 additions & 29 deletions Screenbox/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,29 @@
<ResourceDictionary Source="/Controls/Templates/GridViewItemTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>

<XamlUICommand
x:Key="PlayCommand"
Command="{x:Bind ViewModel.PlayCommand}"
IconSource="{ui:SymbolIconSource Symbol=Play}"
Label="{strings:Resources Key=Play}" />

<XamlUICommand
x:Key="PlayNextCommand"
Command="{x:Bind ViewModel.PlayNextCommand}"
IconSource="{ui:FontIconSource FontFamily={StaticResource ScreenboxSymbolThemeFontFamily},
Glyph=&#xF5EB;}"
Label="{strings:Resources Key=PlayNext}" />

<XamlUICommand
x:Key="RemoveCommand"
Command="{x:Bind ViewModel.RemoveCommand}"
IconSource="{ui:SymbolIconSource Symbol=Clear}"
Label="{strings:Resources Key=Remove}" />

<XamlUICommand
x:Key="PropertiesCommand"
Command="{StaticResource ShowPropertiesCommand}"
IconSource="{ui:FontIconSource Glyph=&#xE946;}"
Label="{strings:Resources Key=Properties}" />

<MenuFlyout x:Name="ItemFlyout">
<MenuFlyoutItem Command="{StaticResource PlayCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem Command="{StaticResource PlayNextCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.PlayCommand}"
CommandParameter="{Binding}"
Icon="{ui:SymbolIcon Symbol=Play}"
Text="{strings:Resources Key=Play}" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.PlayNextCommand}"
CommandParameter="{Binding}"
Icon="{ui:FontIcon FontFamily={StaticResource ScreenboxSymbolThemeFontFamily},
Glyph=&#xF5EB;}"
Text="{strings:Resources Key=PlayNext}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem Command="{StaticResource RemoveCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem Command="{StaticResource PropertiesCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.RemoveCommand}"
CommandParameter="{Binding}"
Icon="{ui:SymbolIcon Symbol=Clear}"
Text="{strings:Resources Key=Remove}" />
<MenuFlyoutItem
Command="{StaticResource ShowPropertiesCommand}"
CommandParameter="{Binding}"
Icon="{ui:FontIcon Glyph=&#xE946;}"
Text="{strings:Resources Key=Properties}" />
<MenuFlyoutSeparator Visibility="{x:Bind Common.IsAdvancedModeEnabled}" />
<MenuFlyoutItem
CommandParameter="{Binding}"
Expand Down
10 changes: 10 additions & 0 deletions Screenbox/Pages/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@
</Grid>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowActivationStates">
<VisualState x:Name="Activated" />

<VisualState x:Name="Deactivated">
<VisualState.Setters>
<Setter Target="AppTitleText.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>

<VisualStateGroup x:Name="CriticalErrorStates">
<VisualState x:Name="CriticalErrorVisible">
<VisualState.StateTriggers>
Expand Down
11 changes: 5 additions & 6 deletions Screenbox/Pages/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,18 @@ private void CoreTitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sende
RightPaddingColumn.Width = new GridLength(Math.Max(sender.SystemOverlayLeftInset, sender.SystemOverlayRightInset));
}

// Update the TitleBar based on the inactive/active state of the app
/// <summary>
/// Change the <see cref="VisualState"/> depending on whether the app is active or inactive.
/// </summary>
private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs args)
{
SolidColorBrush defaultForegroundBrush = (SolidColorBrush)Application.Current.Resources["TextFillColorPrimaryBrush"];
SolidColorBrush inactiveForegroundBrush = (SolidColorBrush)Application.Current.Resources["TextFillColorDisabledBrush"];

if (args.WindowActivationState == CoreWindowActivationState.Deactivated)
{
AppTitleText.Foreground = inactiveForegroundBrush;
VisualStateManager.GoToState(this, "Deactivated", true);
}
else
{
AppTitleText.Foreground = defaultForegroundBrush;
VisualStateManager.GoToState(this, "Activated", true);
}
}

Expand Down
3 changes: 1 addition & 2 deletions Screenbox/Pages/NetworkPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
<!-- Network-Drive-is-empty content -->
<Grid
x:Name="NoNetworkDrivePanel"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Row="2"
Margin="{x:Bind Common.FooterBottomPaddingMargin, Mode=OneWay}"
Padding="{StaticResource ContentPagePadding}"
HorizontalAlignment="Center"
Expand Down
55 changes: 34 additions & 21 deletions Screenbox/Pages/PlayerPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,53 @@
<Color x:Key="BackgroundAcrylicTintColor">#202020</Color>
<Color x:Key="BackgroundAcrylicTintFallbackColor">#C92C2C2C</Color>
<x:Double x:Key="BackgroundAcrylicTintOpacity">0.5</x:Double>
<StaticResource x:Key="HeaderBackgroundGradientBrush" ResourceKey="HeaderBackgroundLinearGradient" />
<StaticResource x:Key="ControlsBackgroundGradientBrush" ResourceKey="ControlsBackgroundLinearGradient" />

<LinearGradientBrush x:Key="HeaderBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="{StaticResource SystemAltMediumColor}" />
<GradientStop Offset="0.5" Color="{StaticResource SystemAltLowColor}" />
<GradientStop Offset="1" Color="#00000000" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PlayerControlsBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="#00000000" />
<GradientStop Offset="1" Color="{StaticResource SystemAltMediumColor}" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Color x:Key="BackgroundAcrylicTintColor">#FCFCFC</Color>
<Color x:Key="BackgroundAcrylicTintFallbackColor">#C9F9F9F9</Color>
<x:Double x:Key="BackgroundAcrylicTintOpacity">0.45</x:Double>
<StaticResource x:Key="HeaderBackgroundGradientBrush" ResourceKey="HeaderBackgroundLinearGradient" />
<StaticResource x:Key="ControlsBackgroundGradientBrush" ResourceKey="ControlsBackgroundLinearGradient" />

<LinearGradientBrush x:Key="HeaderBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="{StaticResource SystemAltMediumColor}" />
<GradientStop Offset="0.5" Color="{StaticResource SystemAltLowColor}" />
<GradientStop Offset="1" Color="#00FFFFFF" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PlayerControlsBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="#00FFFFFF" />
<GradientStop Offset="1" Color="{StaticResource SystemAltMediumColor}" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="BackgroundAcrylicTintColor" ResourceKey="SystemColorWindowColor" />
<StaticResource x:Key="BackgroundAcrylicTintFallbackColor" ResourceKey="SystemColorWindowColor" />
<x:Double x:Key="BackgroundAcrylicTintOpacity">1</x:Double>
<StaticResource x:Key="HeaderBackgroundGradientBrush" ResourceKey="SystemColorWindowColorBrush" />
<StaticResource x:Key="ControlsBackgroundGradientBrush" ResourceKey="SystemColorWindowColorBrush" />

<StaticResource x:Key="ProgressBarBackground" ResourceKey="SystemColorButtonTextColorBrush" />
<Thickness x:Key="ProgressBarBorderThemeThickness">0</Thickness>

<StaticResource x:Key="HeaderBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
<StaticResource x:Key="PlayerControlsBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<LinearGradientBrush x:Key="HeaderBackgroundLinearGradient" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="{StaticResource SystemChromeBlackMediumLowColor}" />
<GradientStop Offset="1" Color="#00000000" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Name="ControlsBackgroundLinearGradient" StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="#00000000" />
<GradientStop Offset="1" Color="{StaticResource SystemChromeBlackMediumLowColor}" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>

<ctConverters:BoolToObjectConverter
x:Key="FilledPlayPauseGlyphConverter"
FalseValue="&#xE62E;"
Expand Down Expand Up @@ -161,7 +174,7 @@
Grid.Column="0"
Height="72"
MinHeight="32"
Background="{ThemeResource HeaderBackgroundGradientBrush}"
Background="{ThemeResource HeaderBackgroundBrush}"
Canvas.ZIndex="3" />

<Grid
Expand Down Expand Up @@ -580,7 +593,7 @@
x:Name="PlayerControlsBackground"
Grid.Row="2"
Grid.Column="0"
Background="{ThemeResource ControlsBackgroundGradientBrush}"
Background="{ThemeResource PlayerControlsBackgroundBrush}"
Tapped="PlayerControlsBackground_OnTapped" />

<controls:PlayerControls
Expand Down
46 changes: 21 additions & 25 deletions Screenbox/Pages/SongsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,24 @@
<TextBlock Text="{Binding Key}" TextTrimming="CharacterEllipsis" />
</DataTemplate>

<XamlUICommand
x:Key="PlayCommand"
Command="{x:Bind ViewModel.PlayCommand}"
IconSource="{ui:SymbolIconSource Symbol=Play}"
Label="{strings:Resources Key=Play}" />

<XamlUICommand
x:Key="PlayNextCommand"
Command="{x:Bind ViewModel.PlayNextCommand}"
IconSource="{ui:FontIconSource FontFamily={StaticResource ScreenboxSymbolThemeFontFamily},
Glyph=&#xF5EB;}"
Label="{strings:Resources Key=PlayNext}" />

<XamlUICommand
x:Key="PropertiesCommand"
Command="{StaticResource ShowPropertiesCommand}"
IconSource="{ui:FontIconSource Glyph=&#xE946;}"
Label="{strings:Resources Key=Properties}" />

<MenuFlyout x:Name="ItemFlyout">
<MenuFlyoutItem Command="{StaticResource PlayCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem Command="{StaticResource PlayNextCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.PlayCommand}"
CommandParameter="{Binding}"
Icon="{ui:SymbolIcon Symbol=Play}"
Text="{strings:Resources Key=Play}" />
<MenuFlyoutItem
Command="{x:Bind ViewModel.PlayNextCommand}"
CommandParameter="{Binding}"
Icon="{ui:FontIcon FontFamily={StaticResource ScreenboxSymbolThemeFontFamily},
Glyph=&#xF5EB;}"
Text="{strings:Resources Key=PlayNext}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem Command="{StaticResource PropertiesCommand}" CommandParameter="{Binding}" />
<MenuFlyoutItem
Command="{StaticResource ShowPropertiesCommand}"
CommandParameter="{Binding}"
Icon="{ui:FontIcon Glyph=&#xE946;}"
Text="{strings:Resources Key=Properties}" />
<MenuFlyoutSeparator Visibility="{x:Bind Common.IsAdvancedModeEnabled}" />
<MenuFlyoutItem
CommandParameter="{Binding}"
Expand Down Expand Up @@ -94,6 +88,7 @@
Margin="{StaticResource ContentPagePadding}"
HorizontalAlignment="Right"
AccessKey="{strings:KeyboardResources Key=CommandSortByKey}"
AutomationProperties.Name="{x:Bind SortByText.Text}"
Background="Transparent"
BorderBrush="Transparent">
<muxc:DropDownButton.Flyout>
Expand Down Expand Up @@ -132,7 +127,7 @@
</MenuFlyout>
</muxc:DropDownButton.Flyout>
<StackPanel Orientation="Horizontal">
<FontIcon Margin="0,0,8,0" Glyph="&#xE8cb;" />
<FontIcon Margin="0,0,8,0" Glyph="&#xE8CB;" />
<TextBlock x:Name="SortByText"><Run Text="{strings:Resources Key=SortBy}" /><Run Text=":&#160;" /></TextBlock>
<TextBlock Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}" Text="{x:Bind GetSortByText(ViewModel.SortBy), Mode=OneWay}" />
</StackPanel>
Expand All @@ -158,6 +153,7 @@
ItemContainerStyle="{StaticResource ListViewItemFocusEngagementStyle}"
ItemsSource="{x:Bind SongsSource.View, Mode=OneWay}"
Loaded="SongListView_OnLoaded"
ScrollViewer.IsVerticalScrollChainingEnabled="False"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
Expand Down Expand Up @@ -225,11 +221,11 @@
</triggers:IsEqualStateTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SongListView.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="GroupOverview.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="ShufflePlayButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="SortByButton.Margin" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="SortByText.Visibility" Value="Collapsed" />
<Setter Target="SongListView.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
<Setter Target="GroupOverview.Padding" Value="{StaticResource ContentPageMinimalPadding}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down

0 comments on commit a84db69

Please sign in to comment.