Skip to content

Commit

Permalink
支持设置显示视频底部进度条
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Jun 5, 2024
1 parent b7c44ab commit 7a053d5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,18 @@
</ItemsControl.ItemTemplate>
</ItemsControl>

<Grid x:Name="VirtualProgressBar"
Visibility="{x:Bind m_viewModel.ShowVideoBottomVirtualProgressBar}">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>

<ProgressBar Grid.Row="1"
Value="{Binding ElementName=Player,Path=Position,Mode=OneWay}"
Maximum="{Binding ElementName=Player,Path=Duration,Mode=OneWay}"></ProgressBar>
</Grid>

<Grid x:Name="control" >
<Grid x:Name="StandardControl">
<Grid.RowDefinitions>
Expand Down
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 @@ -160,6 +160,18 @@ public class UI
/// </summary>
[SettingDefaultValue]
public const double DEFAULT_VIDEO_DETAIL_LIST_EPISODE_DESIRED_WIDTH = 180;

/// <summary>
/// 是否在视频底部显示进度条
/// </summary>
[SettingKey(typeof(bool))]
public const string SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR = "ShowVideoBottomVirtualProgressBar";

/// <summary>
/// 默认不在视频底部显示进度条
/// </summary>
[SettingDefaultValue]
public const bool DEFAULT_SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR = false;
}

public class Account
Expand Down
5 changes: 5 additions & 0 deletions src/BiliLite.UWP/Pages/SettingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@
<TextBlock Margin="0 8" FontSize="16">隐藏首页右上角广告按钮</TextBlock>
<ToggleSwitch x:Name="swHideADBtn" ></ToggleSwitch>
</StackPanel>

<StackPanel Margin="0 0 0 8">
<TextBlock Margin="0 8" FontSize="16">是否在视频底部显示进度条</TextBlock>
<ToggleSwitch x:Name="SwShowVideoBottomProgress" ></ToggleSwitch>
</StackPanel>
</StackPanel>
</StackPanel>

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 @@ -304,6 +304,16 @@ private void LoadUI()
});
});

//显示视频底部进度条
SwShowVideoBottomProgress.IsOn = SettingService.GetValue(SettingConstants.UI.SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR, SettingConstants.UI.DEFAULT_SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR);
SwShowVideoBottomProgress.Loaded += (sender, e) =>
{
SwShowVideoBottomProgress.Toggled += (obj, args) =>
{
SettingService.SetValue(SettingConstants.UI.SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR, SwShowVideoBottomProgress.IsOn);
};
};

var navItems = SettingService.GetValue(SettingConstants.UI.HOEM_ORDER, DefaultHomeNavItems.GetDefaultHomeNavItems());
gridHomeCustom.ItemsSource = new ObservableCollection<HomeNavItem>(navItems);
ExceptHomeNavItems();
Expand Down
6 changes: 6 additions & 0 deletions src/BiliLite.UWP/ViewModels/PlayControlViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
using BiliLite.Modules.Player;
using BiliLite.ViewModels.Common;
using System.Collections.Generic;
using BiliLite.Models.Common;
using BiliLite.Services;

namespace BiliLite.ViewModels
{
public class PlayControlViewModel: BaseViewModel
{
public List<InteractionEdgeInfoQuestionModel> Questions { get; set; }

public bool ShowVideoBottomVirtualProgressBar =>
SettingService.GetValue(SettingConstants.UI.SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR,
SettingConstants.UI.DEFAULT_SHOW_VIDEO_BOTTOM_VIRTUAL_PROGRESS_BAR);
}
}

0 comments on commit 7a053d5

Please sign in to comment.