Skip to content

Commit

Permalink
首页动态Tab页更换接口
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Apr 16, 2024
1 parent 2245317 commit 4fdaf37
Show file tree
Hide file tree
Showing 11 changed files with 745 additions and 7 deletions.
9 changes: 9 additions & 0 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,15 @@
<Compile Include="Models\Common\Danmaku\BiliDanmakuItem.cs" />
<Compile Include="Models\Common\Dynamic\DynamicUgcSeasonCardModel.cs" />
<Compile Include="Models\Common\UserDynamic\DynLiveInfo.cs" />
<Compile Include="Models\Common\UserDynamic\IUserDynamicCommands.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtDisplayModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\SendImagesModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\UploadImagesModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\RcmdTopicModel.cs" />
<Compile Include="Pages\Home\UserDynamicAllPage.xaml.cs">
<DependentUpon>UserDynamicAllPage.xaml</DependentUpon>
</Compile>
<Compile Include="Services\SettingsImportExportService.cs" />
<Compile Include="ViewModels\UserDynamic\DynamicV2ItemViewModel.cs" />
<Compile Include="Models\Common\Home\DefaultHomeNavItems.cs" />
Expand Down Expand Up @@ -216,6 +220,7 @@
<Compile Include="Pages\User\DynamicSpacePage.xaml.cs">
<DependentUpon>DynamicSpacePage.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\UserDynamic\UserDynamicAllViewModel.cs" />
<Compile Include="ViewModels\UserDynamic\UserDynamicSpaceViewModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtUserModel.cs" />
<Compile Include="ViewModels\User\SendDynamic\SendDynamicV2ViewModel.cs" />
Expand Down Expand Up @@ -969,6 +974,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\Home\UserDynamicAllPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\User\DynamicSpacePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
1 change: 1 addition & 0 deletions src/BiliLite.UWP/Extensions/ViewModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static IServiceCollection AddViewModels(this IServiceCollection services)
services.AddTransient<EmoteViewModel>();
services.AddTransient<AtViewModel>();
services.AddTransient<TopicViewModel>();
services.AddTransient<UserDynamicAllViewModel>();
return services;
}
}
Expand Down
31 changes: 28 additions & 3 deletions src/BiliLite.UWP/Models/Common/Home/DefaultHomeNavItems.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
using System.Collections.Generic;
using BiliLite.Services;
using System.Collections.Generic;
using System.Linq;

namespace BiliLite.Models.Common.Home
{
public static class DefaultHomeNavItems
{
public static List<HomeNavItem> CheckHomeNavItems(List<HomeNavItem> navList)
{
var defaultItems = GetDefaultHomeNavItems();
defaultItems.AddRange(GetDefaultHideHomeNavItems());
var result = new List<HomeNavItem>(navList);
foreach (var homeNavItem in navList.Where(homeNavItem =>
defaultItems.All(x => x.Title != homeNavItem.Title || x.Page != homeNavItem.Page)))
{
result.Remove(homeNavItem);
}
SettingService.SetValue(SettingConstants.UI.HOEM_ORDER, result);

return result;
}

public static List<HomeNavItem> GetDefaultHomeNavItems()
{
return new List<HomeNavItem>()
Expand All @@ -27,7 +44,7 @@ public static List<HomeNavItem> GetDefaultHomeNavItems()
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Heart,
Page = typeof(Pages.Home.UserDynamicPage),
Page = typeof(Pages.Home.UserDynamicAllPage),
Title = "动态",
NeedLogin = true,
Show = false
Expand Down Expand Up @@ -143,7 +160,15 @@ public static List<HomeNavItem> GetDefaultHideHomeNavItems()
Title = "我的收藏",
NeedLogin = true,
Show = false
}
},
new HomeNavItem()
{
Icon = FontAwesome5.EFontAwesomeIcon.Solid_Heart,
Page = typeof(Pages.Home.UserDynamicPage),
Title = "动态(旧版)",
NeedLogin = true,
Show = false
},
};
}
}
Expand Down
31 changes: 31 additions & 0 deletions src/BiliLite.UWP/Models/Common/UserDynamic/IUserDynamicCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Windows.Input;

namespace BiliLite.Models.Common.UserDynamic
{
public interface IUserDynamicCommands
{
public ICommand LaunchUrlCommand { get; set; }

public ICommand RepostCommand { get; set; }

public ICommand LikeCommand { get; set; }

public ICommand CommentCommand { get; set; }

public ICommand UserCommand { get; set; }

public ICommand LoadMoreCommand { get; }

public ICommand WebDetailCommand { get; set; }

public ICommand DetailCommand { get; set; }

public ICommand ImageCommand { get; set; }

public ICommand WatchLaterCommand { get; set; }

public ICommand CopyDynCommand { get; set; }

public ICommand TagCommand { get; set; }
}
}
175 changes: 175 additions & 0 deletions src/BiliLite.UWP/Pages/Home/UserDynamicAllPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<Page
x:Class="BiliLite.Pages.Home.UserDynamicAllPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BiliLite.Pages.Home"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:user="using:BiliLite.Modules.User"
mc:Ignorable="d"
xmlns:controls="using:BiliLite.Controls"
xmlns:dynamic="using:BiliLite.Controls.Dynamic"
xmlns:fa="using:FontAwesome5"
xmlns:converters="using:BiliLite.Converters"
xmlns:controls1="using:Microsoft.Toolkit.Uwp.UI.Controls"
Background="{ThemeResource TopPaneBackground}">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Controls/Dynamic/DynamicV2Template.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style TargetType="HyperlinkButton">
<Setter Property="Foreground" Value="#178bcf" />
</Style>
<ItemsPanelTemplate x:Key="GridPanel">
<controls1:StaggeredPanel DesiredColumnWidth="500"
HorizontalAlignment="Stretch"
ColumnSpacing="-12"
RowSpacing="8" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="ListPanel">
<ItemsStackPanel />
</ItemsPanelTemplate>

<Storyboard x:Name="HideComment">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CommentPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.5100000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CommentPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00.5000000">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="00:00:00.5100000">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>

<Storyboard x:Name="ShowComment">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CommentPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.0100000" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.5100000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CommentPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="00:00:00.0100000">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</ResourceDictionary>
</Page.Resources>
<Grid >
<!--背景图-->
<Image Visibility="Collapsed" Stretch="UniformToFill" Source="https://i0.hdslb.com/bfs/album/[email protected]"></Image>
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="gridTopBar" MaxWidth="800" Margin="8 0">
<Border x:Name="borderTopBar" Margin="12 4" CornerRadius="4" Background="{ThemeResource CardColor}">
<Pivot x:Name="pivot" SelectionChanged="Pivot_OnSelectionChanged">
<Pivot.RightHeader>
<StackPanel Orientation="Horizontal">

<Button Command="{x:Bind Path=m_viewModel.RepostCommand,Mode=OneWay}" Background="Transparent" Margin="8 0">
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="14" FontFamily="Segoe MDL2 Assets" Glyph="&#xE104;" />
<TextBlock Margin="8 0 0 0">发表动态</TextBlock>
</StackPanel>
</Button>
</StackPanel>

</Pivot.RightHeader>
<PivotItem>
<PivotItem.Header>
<TextBlock FontSize="15">全部</TextBlock>
</PivotItem.Header>
</PivotItem>
<PivotItem>
<PivotItem.Header>
<TextBlock FontSize="15">投稿视频</TextBlock>
</PivotItem.Header>
</PivotItem>
<PivotItem>
<PivotItem.Header>
<TextBlock FontSize="15">追番追剧</TextBlock>
</PivotItem.Header>
</PivotItem>
<PivotItem>
<PivotItem.Header>
<TextBlock FontSize="15">专栏</TextBlock>
</PivotItem.Header>
</PivotItem>
</Pivot>
</Border>
</Grid>
<controls:MyListView SelectionMode="None"
IsItemClickEnabled="false"
x:Name="ListDyn"
ItemsSource="{x:Bind Path=m_viewModel.DynamicItems,Mode=OneWay}"
CanLoadMore="{x:Bind Path=m_viewModel.CanLoadMore,Mode=OneWay}"
LoadMoreBottomOffset="0"
LoadMoreCommand="{x:Bind Path=m_viewModel.LoadMoreCommand}"
Padding="4"
Grid.Row="1"
ItemTemplateSelector="{StaticResource DynamicTemplateSelector}"
HorizontalContentAlignment="Center">
<controls:MyListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
<Setter Property="MaxWidth" Value="800"></Setter>
<Setter Property="Margin" Value="4"></Setter>
</Style>
</controls:MyListView.ItemContainerStyle>

</controls:MyListView>
<ProgressRing Grid.Row="1" VerticalAlignment="Bottom" Margin="8" IsActive="True" HorizontalAlignment="Center" Visibility="{x:Bind Path=m_viewModel.Loading,Mode=OneWay}"></ProgressRing>
<StackPanel Orientation="Vertical" Grid.Row="1" VerticalAlignment="Bottom" Margin="20 12" HorizontalAlignment="Right">
<controls:RoundButton x:Name="BtnGrid" ToolTipService.ToolTip="切换为瀑布流" Click="BtnGrid_OnClick" Margin="0 0 0 8" Padding="12">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE80A;" Foreground="White"/>
</controls:RoundButton>
<controls:RoundButton x:Name="BtnList" Visibility="Collapsed" ToolTipService.ToolTip="切换为列表" Click="BtnList_OnClick" Margin="0 0 0 8" Padding="12">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE292;" Foreground="White"/>
</controls:RoundButton>
<controls:RoundButton x:Name="BtnTop" Click="BtnTop_OnClick" ToolTipService.ToolTip="返回顶部" Margin="0 0 0 8" Padding="12">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE110;" Foreground="White"/>
</controls:RoundButton>
<controls:RoundButton x:Name="BtnRefresh" Click="BtnRefreshDynamic_OnClick" Padding="12">
<SymbolIcon Symbol="Refresh" Foreground="White"></SymbolIcon>
</controls:RoundButton>
</StackPanel>
<Grid x:Name="CommentPanel"
Visibility="Collapsed"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{ThemeResource HalfTransparentBackground}">
<Grid
Tapped="CommentPanel_OnTapped"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"></Grid>
<Grid HorizontalAlignment="Right"
Background="{ThemeResource ApplicationBackground}"
Width="{x:Bind m_viewModel.CommentControlWidth}"
VerticalAlignment="Stretch">
<controls:CommentControl x:Name="Comment"></controls:CommentControl>
</Grid>
</Grid>
</Grid>
</Grid>
</Page>
Loading

0 comments on commit 4fdaf37

Please sign in to comment.