Skip to content

Commit

Permalink
可设置视频详情分集列表设计宽度
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed May 15, 2024
1 parent 71b6e9f commit b87191f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/BiliLite.UWP/Models/Common/SettingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ public class UI
/// </summary>
[SettingDefaultValue]
public const bool DEFAULT_SHOW_HOT_REPLIES = true;

/// <summary>
/// 视频详情页分集列表设计宽度
/// </summary>
[SettingKey(typeof(double))]
public const string VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH = "VideoDetailListEpisodeDesiredWidth";

/// <summary>
/// 视频详情页分集列表设计宽度默认值
/// </summary>
[SettingDefaultValue]
public const double DEFAULT_VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH = 180;
}

public class Account
Expand Down
3 changes: 3 additions & 0 deletions src/BiliLite.UWP/Pages/SettingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@
<TextBlock FontSize="14">右侧视频详情宽度(下次打开视频生效)</TextBlock>
<controls:NumberBox x:Name="numRightWidth" Minimum="40" Margin="0 0 0 8" Width="200" HorizontalAlignment="Left" Value="320" SpinButtonPlacementMode="Compact" SmallChange="20" ></controls:NumberBox>
<ToggleSwitch x:Name="swRightWidthChangeable" Header="右侧视频详情宽度可调整(下次打开视频生效)"></ToggleSwitch>

<TextBlock FontSize="14">视频详情页分集列表设计宽度(下次打开视频生效)</TextBlock>
<controls:NumberBox x:Name="NumListEpisodeDesiredWidth" Minimum="40" Margin="0 0 0 8" Width="200" HorizontalAlignment="Left" Value="180" SpinButtonPlacementMode="Compact" SmallChange="20" ></controls:NumberBox>
</StackPanel>

<StackPanel Margin="0 0 0 8">
Expand Down
10 changes: 10 additions & 0 deletions src/BiliLite.UWP/Pages/SettingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ private void LoadUI()
});
});

//视频详情页分集列表设计宽度
NumListEpisodeDesiredWidth.Value = SettingService.GetValue<double>(SettingConstants.UI.VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH, SettingConstants.UI.DEFAULT_VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH);
NumListEpisodeDesiredWidth.Loaded += (sender, e) =>
{
NumListEpisodeDesiredWidth.ValueChanged += (obj, args) =>
{
SettingService.SetValue(SettingConstants.UI.VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH, args.NewValue);
};
};

//动态评论宽度
NumBoxDynamicCommentWidth.Value = SettingService.GetValue<double>(SettingConstants.UI.DYNAMIC_COMMENT_WIDTH, SettingConstants.UI.DEFAULT_DYNAMIC_COMMENT_WIDTH);
NumBoxDynamicCommentWidth.Loaded += (sender, e) =>
Expand Down
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Pages/VideoDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
</StackPanel>
<toolkit:AdaptiveGridView
Visibility="{x:Bind Path=m_viewModel.VideoInfo.ShowPages,Mode=OneWay}"
DesiredWidth="180"
DesiredWidth="{x:Bind m_viewModel.VideoDetailListEpisodeDesiredWidth,Mode=OneWay}"
ItemHeight="36"
Margin="0 8 0 0"
x:Name="listEpisode"
Expand Down
5 changes: 5 additions & 0 deletions src/BiliLite.UWP/ViewModels/Video/VideoDetailPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Windows.UI.Xaml;
using AutoMapper;
using BiliLite.Extensions;
using BiliLite.Models.Common;
using BiliLite.Models.Common.Video;
using BiliLite.Models.Common.Video.Detail;
using BiliLite.Models.Exceptions;
Expand Down Expand Up @@ -92,6 +93,10 @@ public VideoDetailPageViewModel()

public double BottomActionBarWidth { get; set; }

public double VideoDetailListEpisodeDesiredWidth => SettingService.GetValue(
SettingConstants.UI.VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH,
SettingConstants.UI.DEFAULT_VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH);

[DependsOn(nameof(BottomActionBarWidth))]
public bool ShowNormalDownloadBtn => !(BottomActionBarWidth < 460);

Expand Down

0 comments on commit b87191f

Please sign in to comment.