Skip to content

Commit

Permalink
UI: 优化UI
Browse files Browse the repository at this point in the history
  • Loading branch information
kengwang committed Feb 25, 2021
1 parent 54abd51 commit 2c92ae6
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 73 deletions.
3 changes: 3 additions & 0 deletions HyPlayer/Controls/LyricItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HyPlayer.Controls"
xmlns:hyclass="using:HyPlayer.Classes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:hyPlayer="using:HyPlayer"
mc:Ignorable="d"
d:DesignHeight="70"
VerticalAlignment="Stretch"
d:DesignWidth="500"
FocusVisualPrimaryThickness="3"
FocusVisualSecondaryThickness="1">
Expand Down
13 changes: 6 additions & 7 deletions HyPlayer/Controls/LyricItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ namespace HyPlayer.Controls
public sealed partial class LyricItem : UserControl
{
public readonly SongLyric Lrc;
private int showsize => Common.PageExpandedPlayer.showsize;
private int hidsize => Common.PageExpandedPlayer.hidsize;
public double showsize => Common.PageExpandedPlayer.showsize;
public double hidsize => Common.PageExpandedPlayer.hidsize;

private int actualsize => showing ? showsize : hidsize;
private double CopWidth => Common.PageExpandedPlayer.LyricWidth;
public double actualsize => showing ? showsize : hidsize;

private bool showing = false;
public bool showing = false;
public LyricItem(SongLyric lrc)
{

Expand All @@ -62,17 +61,17 @@ public void OnShow()
showing = true;
TextBoxPureLyric.FontWeight = FontWeights.ExtraBold;
TextBoxTranslation.FontWeight = FontWeights.ExtraBold;
TextBoxTranslation.FontSize = showsize;
TextBoxPureLyric.FontSize = showsize;
TextBoxTranslation.FontSize = showsize;
}

public void OnHind()
{
showing = false;
TextBoxPureLyric.FontWeight = FontWeights.Normal;
TextBoxTranslation.FontWeight = FontWeights.Normal;
TextBoxTranslation.FontSize = hidsize;
TextBoxPureLyric.FontSize = hidsize;
TextBoxTranslation.FontSize = hidsize;
}
}
}
74 changes: 44 additions & 30 deletions HyPlayer/Controls/PlayBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
</AdaptiveTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter
Target="MainControlGrid.(Grid.Column)"
Value="0" />
<Setter
Target="MainControlGrid.(Grid.ColumnSpan)"
Value="4" />
<Setter
Target="GridThis.Visibility"
Value="Collapsed"></Setter>
Expand All @@ -79,9 +85,12 @@
<Setter
Target="GridThis.Visibility"
Value="Visible"></Setter>
<Setter
Target="MainControlGrid.(Grid.Column)"
Value="0" />
<Setter
Target="MainControlGrid.(Grid.ColumnSpan)"
Value="2" />
Value="4" />
<Setter
Target="BtnLike.Visibility"
Value="Collapsed"></Setter>
Expand Down Expand Up @@ -112,9 +121,6 @@
<Setter
Target="SubControlGrid.Visibility"
Value="Collapsed" />
<Setter
Target="MainControlGrid.(Grid.ColumnSpan)"
Value="2" />
<Setter
Target="AlbumImage.Visibility"
Value="Collapsed" />
Expand Down Expand Up @@ -158,9 +164,12 @@
<Setter
Target="SubControlGrid.Visibility"
Value="Collapsed" />
<Setter
Target="MainControlGrid.(Grid.Column)"
Value="0" />
<Setter
Target="MainControlGrid.(Grid.ColumnSpan)"
Value="2" />
Value="4" />
<Setter
Target="AlbumImage.Visibility"
Value="Visible" />
Expand Down Expand Up @@ -319,6 +328,7 @@
</Grid>
<StackPanel
Orientation="Horizontal"
Margin="0,0,50,0"
HorizontalAlignment="Right"
Name="SubControlGrid"
Grid.Column="3">
Expand Down Expand Up @@ -407,31 +417,35 @@
</Flyout>
</Button.Flyout>
</Button>
<Button
Width="40"
Height="40"
Margin="10"
CornerRadius="20"
Click="ButtonExpand_OnClick"
Name="ButtonExpand"
Background="Transparent">
<FontIcon
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="&#xE971;" />
</Button>
<Button
Width="40"
Height="40"
Margin="10"
CornerRadius="20"
Click="ButtonCollapse_OnClick"
Name="ButtonCollapse"
Visibility="Collapsed"
Background="Transparent">
<FontIcon
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="&#xE972;" />
</Button>

</StackPanel>
<Button Grid.Column="3"
HorizontalAlignment="Right"
Width="40"
Height="40"
Margin="10"
CornerRadius="20"
Click="ButtonExpand_OnClick"
Name="ButtonExpand"
Background="Transparent">
<FontIcon
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="&#xE971;" />
</Button>
<Button
HorizontalAlignment="Right"
Grid.Column="3"
Width="40"
Height="40"
Margin="10"
CornerRadius="20"
Click="ButtonCollapse_OnClick"
Name="ButtonCollapse"
Visibility="Collapsed"
Background="Transparent">
<FontIcon
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="&#xE972;" />
</Button>
</Grid>
</UserControl>
11 changes: 7 additions & 4 deletions HyPlayer/Controls/PlayBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public PlayBar()
this.InitializeComponent();
HyPlayList.OnPlayItemChange += LoadPlayingFile;
HyPlayList.OnPlayPositionChange += OnPlayPositionChange;
HyPlayList.OnPlayListAdd += HyPlayList_OnPlayListAdd;
HyPlayList.OnPlayListAdd += HyPlayList_OnPlayListAdd;
//TestFile();
}

Expand Down Expand Up @@ -184,7 +184,8 @@ private void ButtonExpand_OnClick(object sender, RoutedEventArgs e)
Common.PageMain.ExpandedPlayer.Navigate(typeof(ExpandedPlayer), null,
new EntranceNavigationTransitionInfo());
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("SongTitle", TbSongName);
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("SongImg", AlbumImage);
if (AlbumImage.Visibility == Visibility.Visible)
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("SongImg", AlbumImage);
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("SongArtist", TbSingerName);
Common.PageExpandedPlayer.StartExpandAnimation();
GridSongInfo.Visibility = Visibility.Collapsed;
Expand All @@ -198,11 +199,13 @@ private void ButtonCollapse_OnClick(object sender, RoutedEventArgs e)
var anim2 = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongImg");
var anim3 = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongArtist");
anim3.Configuration = new DirectConnectedAnimationConfiguration();
anim2.Configuration = new DirectConnectedAnimationConfiguration();
if (anim2 != null)
anim2.Configuration = new DirectConnectedAnimationConfiguration();
anim1.Configuration = new DirectConnectedAnimationConfiguration();
anim3?.TryStart(TbSingerName);
anim1?.TryStart(TbSongName);
anim2?.TryStart(AlbumImage);
if (AlbumImage.Visibility == Visibility.Visible)
anim2?.TryStart(AlbumImage);
ButtonExpand.Visibility = Visibility.Visible;
ButtonCollapse.Visibility = Visibility.Collapsed;
Common.PageMain.ExpandedPlayer.Navigate(typeof(BlankPage));
Expand Down
16 changes: 8 additions & 8 deletions HyPlayer/Controls/PlaylistItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
Height="300"
Width="250"
d:DesignHeight="300"
d:DesignWidth="250">
Height="250"
Width="200"
d:DesignHeight="250"
d:DesignWidth="200">
<Grid
CornerRadius="8">
<Grid
Expand All @@ -24,8 +24,8 @@
<Rectangle
x:Name="ImageContainer"
Grid.RowSpan="2"
Width="250"
Height="250"
Width="200"
Height="200"
RadiusX="8"
RadiusY="8">
<Rectangle.Fill>
Expand All @@ -44,15 +44,15 @@
Grid.Row="1"
CornerRadius="4">
<TextBlock
Width="250"
Width="200"
TextWrapping="WrapWholeWords"
x:Name="TextBlockPLAuthor"
Foreground="#FF262626"
Text="歌单创建者"
Margin="10,37,19,9"
FontSize="10" />
<TextBlock
Width="250"
Width="200"
x:Name="TextBlockPLName"
TextWrapping="WrapWholeWords"
Text="歌单名称"
Expand Down
29 changes: 25 additions & 4 deletions HyPlayer/Controls/SingleNCSong.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@
PointerExited="Grid1_OnPointerExited"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition />
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Grid.Column="0"
Text="0"
x:Name="OrderId" />
<Rectangle
RadiusX="4"
RadiusY="4"
Width="70"
Height="70"
Grid.Column="0">
Grid.Column="1">
<Rectangle.Fill>
<ImageBrush
x:Name="ImageRect"
Expand All @@ -39,13 +46,27 @@
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
<controls:DockPanel Dock="Top" Padding="7,0,0,0" Grid.Column="1">
<controls:DockPanel Dock="Top" Padding="7,0,0,0" Grid.Column="2">
<TextBlock controls:DockPanel.Dock="Top" Name="TextBlockSongname" FontSize="20" Text="歌曲名"/>
<TextBlock Foreground="Gray" Name="TextBlockArtist" controls:DockPanel.Dock="Bottom" Margin="0,7,0,0" FontSize="13" Text="歌手名"/>
<TextBlock
Foreground="Gray"
Name="TextBlockAlbum"
controls:DockPanel.Dock="Bottom"
Margin="0,7,0,0"
FontSize="13"
Text="专辑名" />
<TextBlock
Foreground="Gray"
Name="TextBlockArtist"
controls:DockPanel.Dock="Bottom"
Margin="0,7,0,0"
FontSize="13"
Text="歌手名" />

</controls:DockPanel>
<Button
Click="ButtonBase_OnClick"
Grid.Column="3">
Grid.Column="4">
<FontIcon
Name="PlayStateIcon"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand Down
4 changes: 3 additions & 1 deletion HyPlayer/Controls/SingleNCSong.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ namespace HyPlayer.Controls
public sealed partial class SingleNCSong : UserControl
{
private NCSong ncsong;
public SingleNCSong(NCSong song)
public SingleNCSong(NCSong song,int order)
{
this.InitializeComponent();
ncsong = song;
ImageRect.ImageSource = new BitmapImage(new Uri(song.Album.cover+ "?param="+StaticSource.PICSIZE_SINGLENCSONG_COVER));
TextBlockSongname.Text = song.songname;
TextBlockAlbum.Text = song.Album.name;
OrderId.Text = order.ToString();
TextBlockArtist.Text = string.Join(" / ", song.Artist.Select(ar => ar.name));
}

Expand Down
11 changes: 11 additions & 0 deletions HyPlayer/HyPlayControl/HyPlayList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ public static List<SongLyric> ConvertPureLyric(string LyricAllText)
if (!TimeSpan.TryParse("00:" + prefix, out TimeSpan time))
continue;
string lrctxt = LyricTextLine.Substring(LyricTextLine.IndexOf(']') + 1);
while (lrctxt.Trim().StartsWith('['))
{
//一句双时间
Lyrics = Lyrics.Union(ConvertPureLyric(lrctxt)).ToList();
lrctxt = lrctxt.Substring(LyricTextLine.IndexOf(']') + 1);
}
//NLyric 的双语歌词 - 夹带私货
string translation = null;
if (LyricTextLine.IndexOf('「') != -1 && LyricTextLine.IndexOf('」') != -1)
Expand Down Expand Up @@ -455,6 +461,11 @@ public static void ConvertTranslation(string LyricAllText, List<SongLyric> Lyric
if (!TimeSpan.TryParse("00:" + prefix, out TimeSpan time))
continue;
string lrctxt = LyricTextLine.Substring(LyricTextLine.IndexOf(']') + 1);
while (lrctxt.Trim().StartsWith('['))
{
//一句双时间
ConvertTranslation(lrctxt,Lyrics);
}
for (int i = 0; i < Lyrics.Count; i++)
{
var songLyric = Lyrics[i];
Expand Down
33 changes: 31 additions & 2 deletions HyPlayer/Pages/ExpandedPlayer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger
MinWindowWidth="300">
<!--正常模式 -->
MinWindowWidth="800">
<!--宽屏模式 -->
</AdaptiveTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
Expand All @@ -65,6 +65,35 @@
<Setter
Target="ImageAlbum.(Grid.RowSpan)"
Value="8" />

<Setter
Target="DockPanelRight.Visibility"
Value="Visible" />
<Setter
Target="StackPanelTiny.Visibility"
Value="Collapsed" />
<Setter
Target="ProgressBarPlayProg.Visibility"
Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger
MinWindowWidth="300">
<!--正常模式 -->
</AdaptiveTrigger>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter
Target="ImageAlbum.Visibility"
Value="Collapsed" />
<Setter
Target="DockPanelRight.(Grid.Column)"
Value="0" />
<Setter
Target="DockPanelRight.(Grid.ColumnSpan)"
Value="12" />
<Setter
Target="DockPanelRight.Visibility"
Value="Visible" />
Expand Down
Loading

0 comments on commit 2c92ae6

Please sign in to comment.