From 1dbdce841bd0d287138f8d5d4aee31de6bbf7d17 Mon Sep 17 00:00:00 2001 From: Richasy Date: Wed, 16 Jun 2021 22:37:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=A1=E7=89=87=E5=AE=B9?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App/App.csproj | 11 +- .../Bili/{ => BannerItem}/BannerItem.cs | 0 .../Controls/Bili/BannerItem/BannerItem.xaml | 72 +++++ src/App/Controls/Bili/PartitionItem.xaml | 12 +- src/App/Controls/Bili/PartitionItem.xaml.cs | 3 +- src/App/Controls/Bili/VideoItem.xaml | 270 +++++++++--------- src/App/Controls/Bili/VideoItem.xaml.cs | 2 +- src/App/Controls/CardPanel/CardPanel.cs | 54 ++++ src/App/Controls/CardPanel/CardPanel.xaml | 76 +++++ src/App/Themes/Generic.xaml | 77 +---- 10 files changed, 356 insertions(+), 221 deletions(-) rename src/App/Controls/Bili/{ => BannerItem}/BannerItem.cs (100%) create mode 100644 src/App/Controls/Bili/BannerItem/BannerItem.xaml create mode 100644 src/App/Controls/CardPanel/CardPanel.cs create mode 100644 src/App/Controls/CardPanel/CardPanel.xaml diff --git a/src/App/App.csproj b/src/App/App.csproj index a320c22..ead79d7 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -20,10 +20,11 @@ AccountAvatar.xaml - + BannerView.xaml + IconTextBlock.xaml @@ -212,6 +213,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -220,6 +225,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/src/App/Controls/Bili/BannerItem.cs b/src/App/Controls/Bili/BannerItem/BannerItem.cs similarity index 100% rename from src/App/Controls/Bili/BannerItem.cs rename to src/App/Controls/Bili/BannerItem/BannerItem.cs diff --git a/src/App/Controls/Bili/BannerItem/BannerItem.xaml b/src/App/Controls/Bili/BannerItem/BannerItem.xaml new file mode 100644 index 0000000..d3b87ce --- /dev/null +++ b/src/App/Controls/Bili/BannerItem/BannerItem.xaml @@ -0,0 +1,72 @@ + + + + diff --git a/src/App/Controls/Bili/PartitionItem.xaml b/src/App/Controls/Bili/PartitionItem.xaml index bcbfdc5..06697b2 100644 --- a/src/App/Controls/Bili/PartitionItem.xaml +++ b/src/App/Controls/Bili/PartitionItem.xaml @@ -9,15 +9,7 @@ d:DesignWidth="400" mc:Ignorable="d"> - + @@ -45,5 +37,5 @@ TextAlignment="Center" /> - + diff --git a/src/App/Controls/Bili/PartitionItem.xaml.cs b/src/App/Controls/Bili/PartitionItem.xaml.cs index 1d88681..d308033 100644 --- a/src/App/Controls/Bili/PartitionItem.xaml.cs +++ b/src/App/Controls/Bili/PartitionItem.xaml.cs @@ -52,9 +52,8 @@ namespace Richasy.Bili.App.Controls } } - private void OnItemTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) + private void OnItemClick(object sender, RoutedEventArgs e) { - e.Handled = true; var animationService = ConnectedAnimationService.GetForCurrentView(); animationService.PrepareToAnimate("PartitionAnimate", this.ContentContainer); ItemClick?.Invoke(this, Data); diff --git a/src/App/Controls/Bili/VideoItem.xaml b/src/App/Controls/Bili/VideoItem.xaml index a3f0085..b74ba20 100644 --- a/src/App/Controls/Bili/VideoItem.xaml +++ b/src/App/Controls/Bili/VideoItem.xaml @@ -20,22 +20,10 @@ - - - - - - - - - - + Click="OnContainerClick"> @@ -65,134 +53,146 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - + x:Name="CoverContainer" + Height="124" + CornerRadius="4,4,0,0" + Margin="1,0" + VerticalAlignment="Stretch"> + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - + + - - + UserName="{x:Bind ViewModel.PublisherName, Mode=OneWay}" /> + - - - - - - - - - - - + Padding="12,8" + RowSpacing="8"> + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/App/Controls/Bili/VideoItem.xaml.cs b/src/App/Controls/Bili/VideoItem.xaml.cs index 8ea2609..ecae40b 100644 --- a/src/App/Controls/Bili/VideoItem.xaml.cs +++ b/src/App/Controls/Bili/VideoItem.xaml.cs @@ -182,7 +182,7 @@ namespace Richasy.Bili.App.Controls CheckOrientation(); } - private void OnContainerTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) + private void OnContainerClick(object sender, RoutedEventArgs e) { } } diff --git a/src/App/Controls/CardPanel/CardPanel.cs b/src/App/Controls/CardPanel/CardPanel.cs new file mode 100644 index 0000000..74d3bab --- /dev/null +++ b/src/App/Controls/CardPanel/CardPanel.cs @@ -0,0 +1,54 @@ +// Copyright (c) Richasy. All rights reserved. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Richasy.Bili.App.Controls +{ + /// + /// 卡片容器,包含基本的Pointer动画. + /// + public class CardPanel : Button + { + private long _pointerOverToken; + private long _pressedToken; + + /// + /// Initializes a new instance of the class. + /// + public CardPanel() + { + this.DefaultStyleKey = typeof(CardPanel); + Loading += OnCardPanelLoading; + Unloaded += OnCardPanelUnloaded; + } + + /// + protected override void OnApplyTemplate() => base.OnApplyTemplate(); + + private void OnCardPanelLoading(FrameworkElement sender, object args) + { + _pointerOverToken = RegisterPropertyChangedCallback(IsPointerOverProperty, OnPanelStateChanged); + _pressedToken = RegisterPropertyChangedCallback(IsPressedProperty, OnPanelStateChanged); + } + + private void OnCardPanelUnloaded(object sender, RoutedEventArgs e) + { + UnregisterPropertyChangedCallback(IsPointerOverProperty, _pointerOverToken); + UnregisterPropertyChangedCallback(IsPressedProperty, _pressedToken); + } + + private void OnPanelStateChanged(DependencyObject sender, DependencyProperty dp) + { + if (IsPressed) + { + } + else if (IsPointerOver) + { + } + else + { + } + } + } +} diff --git a/src/App/Controls/CardPanel/CardPanel.xaml b/src/App/Controls/CardPanel/CardPanel.xaml new file mode 100644 index 0000000..771038c --- /dev/null +++ b/src/App/Controls/CardPanel/CardPanel.xaml @@ -0,0 +1,76 @@ + + + + + + diff --git a/src/App/Themes/Generic.xaml b/src/App/Themes/Generic.xaml index d430d78..c5d8de1 100644 --- a/src/App/Themes/Generic.xaml +++ b/src/App/Themes/Generic.xaml @@ -1,73 +1,6 @@ - - - + + + + + -- GitLab