Skip to content

Commit

Permalink
Merge pull request #679 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.6.33
  • Loading branch information
ywmoyue authored Jun 22, 2024
2 parents d95fc83 + f5b89e5 commit c290e77
Show file tree
Hide file tree
Showing 64 changed files with 1,153 additions and 436 deletions.
24 changes: 23 additions & 1 deletion src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,13 @@
<Compile Include="Controls\VideoListView.xaml.cs">
<DependentUpon>VideoListView.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\EditPlaySpeedMenuDialog.xaml.cs">
<DependentUpon>EditPlaySpeedMenuDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\SendDynamicV2Dialog.xaml.cs">
<DependentUpon>SendDynamicV2Dialog.xaml</DependentUpon>
</Compile>
<Compile Include="Extensions\BizServicesExtensions.cs" />
<Compile Include="Extensions\ControlsExtensions.cs" />
<Compile Include="Extensions\QrCodeExtensions.cs" />
<Compile Include="Extensions\RegexExtensions.cs" />
Expand All @@ -164,6 +168,7 @@
<Compile Include="Models\Common\Comment\HotReply.cs" />
<Compile Include="Models\Common\Danmaku\BiliDanmakuItem.cs" />
<Compile Include="Models\Common\Dynamic\DynamicUgcSeasonCardModel.cs" />
<Compile Include="Models\Common\Player\PlaySpeedMenu.cs" />
<Compile Include="Models\Common\UserDynamic\DynLiveInfo.cs" />
<Compile Include="Models\Common\UserDynamic\IUserDynamicCommands.cs" />
<Compile Include="Models\Common\UserDynamic\NavDynArticle.cs" />
Expand All @@ -174,9 +179,22 @@
<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="Models\Common\Video\MediaListResources.cs" />
<Compile Include="Models\Functions\CancelFullscreenFunction.cs" />
<Compile Include="Models\Functions\MinusVolumeFunction.cs" />
<Compile Include="Models\Functions\AddVolumeFunction.cs" />
<Compile Include="Models\Functions\IShortcutFunction.cs" />
<Compile Include="Models\Functions\PlayPauseFunction.cs" />
<Compile Include="Models\Functions\PositionBackFunction.cs" />
<Compile Include="Models\Functions\RefreshShortcutFunction.cs" />
<Compile Include="Models\Common\User\FavoriteItemModel.cs" />
<Compile Include="Models\Common\Rank\RankItemModel.cs" />
<Compile Include="Models\Common\Rank\RankItemOwnerModel.cs" />
<Compile Include="Models\Common\Rank\RankItemStatModel.cs" />
<Compile Include="Services\Biz\MediaListService.cs" />
<Compile Include="Services\PlaySpeedMenuService.cs" />
<Compile Include="ViewModels\Rank\RankRegionViewModel.cs" />
<Compile Include="ViewModels\Settings\EditPlaySpeedMenuViewModel.cs" />
<Compile Include="ViewModels\User\FavoriteItemViewModel.cs" />
<Compile Include="Pages\Home\UserDynamicPage.xaml.cs">
<DependentUpon>UserDynamicPage.xaml</DependentUpon>
Expand Down Expand Up @@ -694,7 +712,7 @@
<Compile Include="ViewModels\User\HistoryViewModel.cs" />
<Compile Include="Modules\User\MyFollowSeasonVM.cs" />
<Compile Include="Modules\Player\PlayerVM.cs" />
<Compile Include="Modules\RankVM.cs" />
<Compile Include="ViewModels\Rank\RankViewModel.cs" />
<Compile Include="ViewModels\Home\RecommendPageViewModel.cs" />
<Compile Include="Modules\RelayCommand.cs" />
<Compile Include="ViewModels\Season\SeasonDetailPageViewModel.cs" />
Expand Down Expand Up @@ -1005,6 +1023,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Dialogs\EditPlaySpeedMenuDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Dialogs\SendDynamicV2Dialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public class UserDynamicItemV2DataTemplateSelector : DataTemplateSelector

static UserDynamicItemV2DataTemplateSelector()
{
DataTemplate SelectRowTemplate(UserDynamicItemDataTemplateSelector selector,
UserDynamicItemDisplayViewModel _) => selector.OneRowTemplate;

_dynamicTypeTemplateSelectFuncs =
new Dictionary<string, Func<UserDynamicItemV2DataTemplateSelector,
DynamicV2ItemViewModel, DataTemplate>>()
Expand Down
8 changes: 5 additions & 3 deletions src/BiliLite.UWP/Controls/Dynamic/DynamicItemV2Control.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@
<Button
Command="{x:Bind Path=ViewModel.Parent.LikeCommand,Mode=OneWay}"
CommandParameter="{x:Bind Path=ViewModel,Mode=OneWay}"
Visibility="{x:Bind Path=ViewModel.Liked,Mode=OneWay}" Foreground="{ThemeResource HighLightColor}">
Visibility="{x:Bind Path=ViewModel.Liked,Mode=OneWay}">
<StackPanel Orientation="Horizontal">
<fontAwesome5:FontAwesome Icon="Regular_ThumbsUp" Margin="0 2 0 0" FontSize="14"></fontAwesome5:FontAwesome>
<TextBlock Margin="8 0"
<fontAwesome5:FontAwesome Icon="Regular_ThumbsUp" Foreground="{ThemeResource HighLightColor}"
Margin="0 2 0 0" FontSize="14"></fontAwesome5:FontAwesome>
<TextBlock Margin="8 0"
Foreground="{ThemeResource HighLightColor}"
Text="{x:Bind Path=ViewModel.LikeCount,Mode=OneWay,Converter={StaticResource countConvert},ConverterParameter='点赞'}"></TextBlock>
</StackPanel>
</Button>
Expand Down
24 changes: 15 additions & 9 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"
xmlns:fa="using:FontAwesome5" xmlns:player="using:BiliLite.Modules.Player"
xmlns:common="using:BiliLite.Models.Common"
xmlns:player1="using:BiliLite.Models.Common.Player"
d:DesignHeight="800"
d:DesignWidth="1000">
<UserControl.Resources>
Expand Down Expand Up @@ -845,15 +846,20 @@
<ComboBox x:Name="BottomCBQuality" DisplayMemberPath="QualityName" ToolTipService.ToolTip="清晰度" HorizontalContentAlignment="Center" Style="{StaticResource PlayerComboBoxStyle}" Foreground="White" BorderThickness="0" FontSize="18" VerticalAlignment="Center" Background="Transparent">

</ComboBox>
<ComboBox x:Name="BottomCBSpeed" ToolTipService.ToolTip="倍速" HorizontalContentAlignment="Center" Style="{StaticResource PlayerComboBoxStyle}" Foreground="White" BorderThickness="0" FontSize="18" VerticalAlignment="Center" Background="Transparent">
<ComboBox.Items>
<ComboBoxItem Content="2.0x" ></ComboBoxItem>
<ComboBoxItem Content="1.5x" ></ComboBoxItem>
<ComboBoxItem Content="1.25x" ></ComboBoxItem>
<ComboBoxItem Content="1.0x" ></ComboBoxItem>
<ComboBoxItem Content="0.75x" ></ComboBoxItem>
<ComboBoxItem Content="0.5x" ></ComboBoxItem>
</ComboBox.Items>
<ComboBox x:Name="BottomCBSpeed" ToolTipService.ToolTip="倍速"
HorizontalContentAlignment="Center"
Style="{StaticResource PlayerComboBoxStyle}"
Foreground="White" BorderThickness="0"
FontSize="18" VerticalAlignment="Center"
SelectedValuePath="Value"
DisplayMemberPath="Content"
ItemsSource="{x:Bind m_playSpeedMenuService.MenuItems}"
Background="Transparent">
<!--<ComboBox.ItemTemplate>
<DataTemplate x:DataType="player1:PlaySpeedMenuItem">
<ComboBoxItem Content="{x:Bind Content}"></ComboBoxItem>
</DataTemplate>
</ComboBox.ItemTemplate>-->
</ComboBox>

<Button x:Name="BottomBtnList" Click="BottomBtnList_Click" Visibility="{x:Bind ShowPlaylistButton,Mode=OneWay}" ToolTipService.ToolTip="选集" Background="Transparent" Foreground="White" Padding="12" Height="48">
Expand Down
98 changes: 51 additions & 47 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public sealed partial class PlayerControl : UserControl, IDisposable
private readonly IDanmakuController m_danmakuController;
private readonly PlayControlViewModel m_viewModel;
private readonly PlayerToastService m_playerToastService;
private readonly PlaySpeedMenuService m_playSpeedMenuService;
public event PropertyChangedEventHandler PropertyChanged;
private GestureRecognizer gestureRecognizer;
private void DoPropertyChanged(string name)
Expand Down Expand Up @@ -91,6 +92,9 @@ private void DoPropertyChanged(string name)
/// 当前播放
/// </summary>
public int CurrentPlayIndex { get; set; }

public bool IsPlaying => Player.PlayState == PlayState.Playing || Player.PlayState == PlayState.End;

/// <summary>
/// 当前播放
/// </summary>
Expand Down Expand Up @@ -129,6 +133,7 @@ public BiliPlayUrlQualitesInfo playUrlInfo
public PlayerControl()
{
m_viewModel = new PlayControlViewModel();
m_playSpeedMenuService = App.ServiceProvider.GetRequiredService<PlaySpeedMenuService>();
m_playerToastService = App.ServiceProvider.GetRequiredService<PlayerToastService>();
m_playerToastService.Init(this);
this.InitializeComponent();
Expand Down Expand Up @@ -288,33 +293,6 @@ private async void PlayerControl_KeyDown(CoreWindow sender, KeyEventArgs args)
args.Handled = true;
switch (args.VirtualKey)
{
case Windows.System.VirtualKey.Space:
if (Player.PlayState == PlayState.Playing || Player.PlayState == PlayState.End)
{
Pause();
}
else
{
Player.Play();
}
break;
case Windows.System.VirtualKey.Left:
{
if (Player.PlayState == PlayState.Playing || Player.PlayState == PlayState.Pause)
{
var _position = Player.Position - 3;
if (_position < 0)
{
_position = 0;
}
Player.Position = _position;

m_playerToastService.Show(
PlayerToastService.PROGRESS_KEY, "进度:" + TimeSpan.FromSeconds(Player.Position).ToString(@"hh\:mm\:ss"));
}
}

break;
case Windows.System.VirtualKey.Right:
{
if (m_playerKeyRightAction == PlayerKeyRightAction.AcceleratePlay)
Expand All @@ -335,23 +313,7 @@ private async void PlayerControl_KeyDown(CoreWindow sender, KeyEventArgs args)
}
}
break;
case Windows.System.VirtualKey.Up:
Player.Volume += 0.1;
m_playerToastService.Show(PlayerToastService.VOLUME_KEY, "音量:" + Player.Volume.ToString("P"));
break;

case Windows.System.VirtualKey.Down:
Player.Volume -= 0.1;
var txtToolTipText = "静音";
if (Player.Volume > 0)
{
txtToolTipText = "音量:" + Player.Volume.ToString("P");
}
m_playerToastService.Show(PlayerToastService.VOLUME_KEY, txtToolTipText);
break;
case Windows.System.VirtualKey.Escape:
IsFullScreen = false;
break;
case Windows.System.VirtualKey.F8:
case Windows.System.VirtualKey.T:
//小窗播放
Expand Down Expand Up @@ -725,12 +687,16 @@ private void LoadPlayerSetting()
Player.SetRatioMode(PlayerSettingRatio.SelectedIndex);
});
// 播放倍数
BottomCBSpeed.SelectedIndex = SettingConstants.Player.VideoSpeed.IndexOf(SettingService.GetValue<double>(SettingConstants.Player.DEFAULT_VIDEO_SPEED, 1.0d));
var speeds = m_playSpeedMenuService.MenuItems
.Select(x => x.Value)
.ToList();
BottomCBSpeed.SelectedIndex = speeds
.IndexOf(SettingService.GetValue<double>(SettingConstants.Player.DEFAULT_VIDEO_SPEED, 1.0d));
Player.SetRate(SettingService.GetValue<double>(SettingConstants.Player.DEFAULT_VIDEO_SPEED, 1.0d));
BottomCBSpeed.SelectionChanged += new SelectionChangedEventHandler((e, args) =>
{
SettingService.SetValue<double>(SettingConstants.Player.DEFAULT_VIDEO_SPEED, SettingConstants.Player.VideoSpeed[BottomCBSpeed.SelectedIndex]);
Player.SetRate(SettingConstants.Player.VideoSpeed[BottomCBSpeed.SelectedIndex]);
SettingService.SetValue<double>(SettingConstants.Player.DEFAULT_VIDEO_SPEED, speeds[BottomCBSpeed.SelectedIndex]);
Player.SetRate(speeds[BottomCBSpeed.SelectedIndex]);
});

_autoPlay = SettingService.GetValue<bool>(SettingConstants.Player.AUTO_PLAY, false);
Expand Down Expand Up @@ -1809,9 +1775,9 @@ private async void ShowDialog(string content, string title)
#region 全屏处理
public void FullScreen(bool fullScreen)
{

ApplicationView view = ApplicationView.GetForCurrentView();
FullScreenEvent?.Invoke(this, fullScreen);
m_danmakuController.SetFullscreen(fullScreen);
if (fullScreen)
{
BottomBtnExitFull.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -2118,6 +2084,7 @@ private void Grid_PointerPressed(object sender, PointerRoutedEventArgs e)
if (SettingService.GetValue(SettingConstants.UI.MOUSE_MIDDLE_ACTION, (int)MouseMiddleActions.Back) == (int)MouseMiddleActions.Back
&& par == Windows.UI.Input.PointerUpdateKind.XButton1Pressed || par == Windows.UI.Input.PointerUpdateKind.MiddleButtonPressed)
{
Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 0);
MessageCenter.GoBack(this);
return;
}
Expand Down Expand Up @@ -2856,7 +2823,44 @@ public void Pause()
{
m_danmakuController.Pause();
Player.Pause();
}

public void PositionBack()
{
if (Player.PlayState == PlayState.Playing || Player.PlayState == PlayState.Pause)
{
var _position = Player.Position - 3;
if (_position < 0)
{
_position = 0;
}
Player.Position = _position;

m_playerToastService.Show(
PlayerToastService.PROGRESS_KEY, "进度:" + TimeSpan.FromSeconds(Player.Position).ToString(@"hh\:mm\:ss"));
}
}

public void AddVolume()
{
Player.Volume += 0.1;
m_playerToastService.Show(PlayerToastService.VOLUME_KEY, "音量:" + Player.Volume.ToString("P"));
}

public void MinusVolume()
{
Player.Volume -= 0.1;
var txtToolTipText = "静音";
if (Player.Volume > 0)
{
txtToolTipText = "音量:" + Player.Volume.ToString("P");
}
m_playerToastService.Show(PlayerToastService.VOLUME_KEY, txtToolTipText);
}

public void CancelFullscreen()
{
IsFullScreen = false;
}

public void PlayerSettingABPlaySetPointA_Click(object sender, RoutedEventArgs e)
Expand Down
8 changes: 8 additions & 0 deletions src/BiliLite.UWP/Controls/VideoListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer>
<HyperlinkButton x:Name="BtnLoadMore"
Tapped="BtnLoadMore_OnTapped"
HorizontalAlignment="Center"
Visibility="{x:Bind IsLazyOnlineList,Mode=OneWay}">
加载更多
</HyperlinkButton>
</ListView.Footer>
</ListView>
</muxc:Expander.Content>
</muxc:Expander>
Expand Down
16 changes: 15 additions & 1 deletion src/BiliLite.UWP/Controls/VideoListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using AutoMapper;
using BiliLite.Extensions;
using BiliLite.Models.Common.Video;
using BiliLite.Services.Biz;
using BiliLite.ViewModels.Video;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板
Expand All @@ -19,12 +20,14 @@ public sealed partial class VideoListView : UserControl
{
private readonly VideoListViewModel m_viewModel;
private readonly IMapper m_mapper;
private readonly MediaListService m_mediaListService;
private object m_flyoutContextElement;

public VideoListView(VideoListViewModel viewModel, IMapper mapper)
public VideoListView(VideoListViewModel viewModel, IMapper mapper, MediaListService mediaListService)
{
m_viewModel = viewModel;
m_mapper = mapper;
m_mediaListService = mediaListService;
this.InitializeComponent();
}

Expand Down Expand Up @@ -114,5 +117,16 @@ private void CloseList_OnClick(object sender, RoutedEventArgs e)
m_viewModel.Sections.Remove(section);
}
}

private async void BtnLoadMore_OnTapped(object sender, TappedRoutedEventArgs e)
{
if (!(sender is HyperlinkButton btnLoadMore))
{
return;
}

if (!(btnLoadMore.DataContext is VideoListSectionViewModel section)) return;
await m_mediaListService.LoadMoreMediaList(section);
}
}
}
Loading

0 comments on commit c290e77

Please sign in to comment.