Skip to content

Commit

Permalink
Merge branch 'release/v1.2.23'
Browse files Browse the repository at this point in the history
  • Loading branch information
tor4kichi committed Dec 17, 2021
2 parents 322b7f6 + 78a06aa commit be16012
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Hohoema.Models/Hohoema.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.8.0-prerelease.210927001</Version>
<Version>2.7.1-prerelease.211026002</Version>
</PackageReference>
<PackageReference Include="ReactiveProperty">
<Version>7.12.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion Hohoema/Hohoema.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.8.0-prerelease.210927001</Version>
<Version>2.7.1-prerelease.211026002</Version>
</PackageReference>
<PackageReference Include="ReactiveProperty">
<Version>7.12.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion Hohoema/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
<Identity Name="18803tor4kichi.Hohoema" Publisher="CN=DFF1CEA0-5963-4197-8676-6105C5E8CE4B" Version="1.2.22.0" />
<Identity Name="18803tor4kichi.Hohoema" Publisher="CN=DFF1CEA0-5963-4197-8676-6105C5E8CE4B" Version="1.2.23.0" />
<mp:PhoneIdentity PhoneProductId="01cfd879-0a19-44a7-b5db-11bdbd13f0df" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Hohoema</DisplayName>
Expand Down
93 changes: 55 additions & 38 deletions Hohoema/Presentation.Views.Player/VideoPlayerPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,62 @@
PaneBackground="{ThemeResource ApplicationContentBackgroundBrush}"
>
<i:Interaction.Behaviors>
<!-- 子要素方向にあるContentControl にフォーカスが移ると KeyboardAccelerator のイベントを吸ってしまうので IsEnabledを変更してフォーカスを剥がす -->
<core:EventTriggerBehavior EventName="PaneOpening">
<core:ChangePropertyAction TargetObject="{x:Bind SidePaneContentControl}" PropertyName="IsEnabled" Value="True" />
</core:EventTriggerBehavior>
<!-- サイドペインが閉じられたら コンテンツVMをリセット -->
<core:EventTriggerBehavior EventName="PaneClosed">
<core:ChangePropertyAction TargetObject="{x:Bind _vm}" PropertyName="SidePaneType" Value="{x:Bind players:PlayerSidePaneContentType.None}" />
<core:ChangePropertyAction TargetObject="{x:Bind SidePaneContentControl}" PropertyName="IsEnabled" Value="False" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
<SplitView.Pane>
<Grid x:Name="PlayerSidePaneLayout">
<ContentControl Content="{x:Bind _vm.SidePaneViewModel, Mode=OneWay}" ContentTemplateSelector="{StaticResource PlayerSidePaneContentTemplateSelecter}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
<ContentControl x:Name="SidePaneContentControl" IsEnabled="False" Content="{x:Bind _vm.SidePaneViewModel, Mode=OneWay}" ContentTemplateSelector="{StaticResource PlayerSidePaneContentTemplateSelecter}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</Grid>
</SplitView.Pane>
<SplitView.Content>
<!-- Media Control -->
<Grid x:Name="MediaControl" ContextFlyout="{StaticResource VideoOptionsFlyout}" ManipulationMode="TranslateX">
<Grid x:Name="MediaControl" ContextFlyout="{StaticResource VideoOptionsFlyout}" ManipulationMode="TranslateX"
KeyboardAcceleratorPlacementMode="Hidden"
>
<Grid.KeyboardAccelerators>
<KeyboardAccelerator x:Name="CommentWriteBeginKeyboardTrigger" Key="C">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Invoked">
<core:ChangePropertyAction TargetObject="{x:Bind}" PropertyName="IsDisplayControlUI" Value="True" />
<mybehavior:SetFocus TargetObject="{x:Bind CommentTextBox}" Delay="00:00:00" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</KeyboardAccelerator>

<KeyboardAccelerator x:Name="CommentSubmitKeyboardTrigger" Key="Enter" IsEnabled="False">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Invoked">
<core:InvokeCommandAction Command="{x:Bind _vm.CommentPlayer.CommentSubmitCommand}" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</KeyboardAccelerator>

<!-- スペースキー入力で再生停止の切り替え-->
<KeyboardAccelerator x:Name="PlayPauseToggleKeyboardTrigger" Key="Space" Invoked="PlayPauseToggleKeyboardTrigger_Invoked" />

<KeyboardAccelerator x:Name="VideoForwardKeyboardTrigger" Key="Right">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Invoked">
<core:InvokeCommandAction Command="{x:Bind _vm.SeekCommand}" CommandParameter="{x:Bind ForwardSeekTime}" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</KeyboardAccelerator>
<KeyboardAccelerator x:Name="VideoBackKeyboardTrigger" Key="Left">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Invoked">
<core:InvokeCommandAction Command="{x:Bind _vm.SeekCommand}" CommandParameter="{x:Bind PreviewSeekTime}" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</KeyboardAccelerator>
</Grid.KeyboardAccelerators>
<i:Interaction.Behaviors>
<!-- 再生停止時にUIを表示 -->
<core:DataTriggerBehavior Binding="{Binding ObservableMediaPlayer.NowPlaying.Value, Mode=OneWay}" Value="False" ComparisonCondition="Equal">
Expand All @@ -160,48 +203,14 @@
<core:DataTriggerBehavior Binding="{Binding ObservableMediaPlayer.NowPlaying.Value, Mode=OneWay}" Value="True" ComparisonCondition="Equal">
<core:ChangePropertyAction TargetObject="{x:Bind}" PropertyName="IsDisplayControlUI" Value="False" />
</core:DataTriggerBehavior>
<!-- WindowInWindow表示に切り替えた時にUIを非表示 -->
<!-- Enumは正しくトリガーできないっぽいのでDisplayModeの変更すべてにフックしてUIを消してる -->
<core:DataTriggerBehavior Binding="{Binding PrimaryViewPlayerManager.DisplayMode, Mode=OneWay}" Value="{x:Null}" ComparisonCondition="NotEqual">
<core:ChangePropertyAction TargetObject="{x:Bind}" PropertyName="IsDisplayControlUI" Value="False" />
</core:DataTriggerBehavior>
<!-- 左右スワイプでシーク -->
<mybehavior:Swipe x:Name="SeekSwipe" SwipeCommand="{x:Bind _vm.SeekCommand}" SwipeAmountConverter="{StaticResource SwipeSeekValueToTimeSpan}" SwipeAmountScale="0.15" SwipeEdgeOfPlay="48" />
<!-- マウスの非表示 -->
<mybehavior:PointerCursolAutoHideBehavior x:Name="AutoHideCursor" IsAutoHideEnabled="False" AutoHideDelay="0:0:1.25" />
<core:EventTriggerBehavior EventName="Loaded">
<mybehavior:SetFocus TargetObject="{Binding ElementName=RootLayout}" />
</core:EventTriggerBehavior>
<!-- スペースキー入力で再生停止の切り替え-->
<mybehavior:KeyboardTrigger Key="Space" x:Name="PlayPauseToggleKeyboardTrigger">
<core:InvokeCommandAction Command="{x:Bind _vm.VideoTogglePlayPauseCommand}" />
</mybehavior:KeyboardTrigger>
<mybehavior:KeyboardTrigger Key="Enter" x:Name="CommentSubmitKeyboardTrigger">
<mybehavior:KeyboardTrigger.Actions>
<core:InvokeCommandAction Command="{x:Bind _vm.CommentPlayer.CommentSubmitCommand}" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>
<mybehavior:KeyboardTrigger Key="Escape" x:Name="CommentWriteExitKeyboardTrigger" IsEnabled="False">
<mybehavior:KeyboardTrigger.Actions>
<core:ChangePropertyAction TargetObject="{Binding ElementName=CommentTextBox}" PropertyName="IsEnabled" Value="False" />
<core:ChangePropertyAction TargetObject="{Binding ElementName=CommentTextBox}" PropertyName="IsEnabled" Value="True" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>
<mybehavior:KeyboardTrigger Key="Right" x:Name="VideoForwardKeyboardTrigger">
<mybehavior:KeyboardTrigger.Actions>
<core:InvokeCommandAction Command="{x:Bind _vm.SeekCommand}" CommandParameter="{x:Bind ForwardSeekTime}" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>
<mybehavior:KeyboardTrigger Key="Left" x:Name="VideoPreviewKeyboardTrigger">
<mybehavior:KeyboardTrigger.Actions>
<core:InvokeCommandAction Command="{x:Bind _vm.SeekCommand}" CommandParameter="{x:Bind PreviewSeekTime}" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>
<mybehavior:KeyboardTrigger x:Name="CommentWriteBeginKeyboardTrigger">
<mybehavior:KeyboardTrigger.Actions>
<mybehavior:SetFocus TargetObject="{Binding ElementName=CommentTextBox}" Delay="00:00:00" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>

<mybehavior:MouseWheelTrigger>
<mybehavior:MouseWheelTrigger.UpActions>
<core:InvokeCommandAction Command="{x:Bind _vm.VolumeUpCommand}" CommandParameter="{Binding PlayerSettings.SoundVolumeChangeFrequency}" />
Expand Down Expand Up @@ -617,6 +626,13 @@
<Style TargetType="TextBox">
</Style>
</TextBox.Style>
<i:Interaction.Behaviors>
<mybehavior:KeyboardTrigger Key="Escape" x:Name="CommentWriteExitKeyboardTrigger" IsEnabled="False" OnlyWhenFocus="{x:Bind CommentTextBox}">
<mybehavior:KeyboardTrigger.Actions>
<mybehavior:SetFocus TargetObject="{x:Bind PlayPauseButton}" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>
</i:Interaction.Behaviors>
</TextBox>
<Button x:Name="CommentCommandEditButton"
Content="{Binding CommentCommandEditerViewModel.CommandsText.Value, Mode=OneWay}"
Expand Down Expand Up @@ -960,6 +976,7 @@
<StateTrigger IsActive="{x:Bind IsDisplayControlUI, Mode=OneWay}" />
<StateTrigger IsActive="{Binding PlayerView.IsCompactOverlay, Mode=OneWay}" />
<myTrigger:WindowInWindowViewModeTrigger myExt:DependencyObjectExtensions.DisposeOnUnloadedTarget="{x:Bind RootLayout}"/>
<windowsTriggers:EqualsStateTrigger Value="{Binding CurrentPlayerDisplayView.Value, Mode=OneWay}" EqualTo="SecondaryView" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="AutoHideCursor.IsAutoHideEnabled" Value="False" />
Expand Down Expand Up @@ -1143,7 +1160,7 @@
<VisualState>
<VisualState.StateTriggers>
<!-- Target="{x:Bind CommentTextBox}" と指定すると動作しない -->
<myTrigger:FocusTrigger Target="{Binding ElementName=CommentTextBox}" />
<myTrigger:FocusTrigger Target="{x:Bind CommentTextBox}" />
<StateTrigger IsActive="{Binding ElementName=PlayerSplitView, Path=IsPaneOpen}" />
<myTrigger:WindowInWindowViewModeTrigger myExt:DependencyObjectExtensions.DisposeOnUnloadedTarget="{x:Bind RootLayout}" />
<myTrigger:FlyoutIsOpenStateTrigger TargetFlyout="{Binding ElementName=CommandEditerFlyout}" myExt:DependencyObjectExtensions.DisposeOnUnloadedTarget="{x:Bind RootLayout}" />
Expand Down
20 changes: 20 additions & 0 deletions Hohoema/Presentation.Views.Player/VideoPlayerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,25 @@ private void VideoPlayerPage_Loaded(object sender, RoutedEventArgs e)
ThemeChanged(theme);
}).AddTo(_compositeDisposable);

LayoutRoot.SizeChanged += LayoutRoot_SizeChanged;

_prevPosition = 0.0;
}

private void LayoutRoot_SizeChanged(object sender, SizeChangedEventArgs e)
{
IsDisplayControlUI = false;
}

private void VideoPlayerPage_Unloaded(object sender, RoutedEventArgs e)
{
_compositeDisposable.Dispose();
_mediaPlayer.VolumeChanged -= OnMediaPlayerVolumeChanged;
_mediaPlayer.PlaybackSession.PositionChanged -= PlaybackSession_PositionChanged;

SeekBarSlider.ValueChanged -= SeekBarSlider_ValueChanged;

LayoutRoot.SizeChanged -= LayoutRoot_SizeChanged;
}


Expand Down Expand Up @@ -354,6 +363,17 @@ private void PlaybackSession_PositionChanged(MediaPlaybackSession sender, object
});
}

private void PlayPauseToggleKeyboardTrigger_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
var currentFocus = FocusManager.GetFocusedElement() as FrameworkElement;
if (currentFocus == PlayPauseButton) { return; }

if (CommentTextBox.FocusState == FocusState.Unfocused && PlayPauseButton.FocusState == FocusState.Unfocused)
{
(_vm.VideoTogglePlayPauseCommand as ICommand).Execute(null);
}
}

/*
private void SeekBarSlider_FocusEngaged(Control sender, FocusEngagedEventArgs args)
Expand Down
58 changes: 27 additions & 31 deletions Hohoema/Presentation.Views/Interaction/Input/KeyboardTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,25 @@ private void Register()
if (fe == null) { return; }
fe.Unloaded += this.Fe_Unloaded;
if (!UseKeyUp)
{
Window.Current.CoreWindow.KeyDown += this.CoreWindow_KeyDown;
{
fe.KeyDown += ProcessKeyAction;
}
else
{
Window.Current.CoreWindow.KeyUp += this.CoreWindow_KeyDown;
fe.KeyUp += ProcessKeyAction;
}
}

private void Unregister()

private void Unregister()
{
var fe = this.AssociatedObject as FrameworkElement;
if (fe == null) { return; }
fe.Unloaded -= this.Fe_Unloaded;

if (!UseKeyUp)
{
Window.Current.CoreWindow.KeyDown -= this.CoreWindow_KeyDown;
}
else
{
Window.Current.CoreWindow.KeyUp -= this.CoreWindow_KeyDown;
}
}
fe.KeyDown -= ProcessKeyAction;
fe.KeyUp -= ProcessKeyAction;
}

static readonly VirtualKey[] NavigationButtonVirtualKeyList = new[]
{
Expand Down Expand Up @@ -239,32 +234,32 @@ private void Unregister()
0xB3, // Play/Pause Media key
};

private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
{
private void ProcessKeyAction(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs args)
{
if (OnlyWhenFocus != null && !_NowFocusing_OnlyWhenFocus) { return; }
if (!IsEnabled) { return; }
if (args.Handled) { return; }
if (!IsEnabled) { return; }
if (args.Handled) { return; }

if (this.ShiftKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
{
return;
}
if (this.ShiftKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
{
return;
}

if (this.CtrlKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
{
return;
}
if (this.CtrlKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
{
return;
}

if (!IsEnableUINavigationButtons)
{
if (NavigationButtonVirtualKeyList.Any(x => x == args.VirtualKey)) { return; }
if (NavigationButtonVirtualKeyList.Any(x => x == args.Key)) { return; }

var keycode = (int)args.VirtualKey;
var keycode = (int)args.Key;
if (IgnoreVirtualKeyList.Any(x => x == keycode)) { return; }
}

if (this.Key == VirtualKey.None || this.Key == args.VirtualKey)
{
if (this.Key == VirtualKey.None || this.Key == args.Key)
{
foreach (var action in this.Actions.Cast<IAction>())
{
var result = action.Execute(this, null);
Expand All @@ -282,8 +277,9 @@ private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Co
args.Handled = true;
}
}
}
}
}
}


private void Fe_Unloaded(object sender, RoutedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ private void Register()
if (fe == null) { return; }
fe.Unloaded += this.Fe_Unloaded;


if (AssociatedObject is UIElement)
{
var ui = AssociatedObject as UIElement;
ui.PointerWheelChanged += Ui_PointerWheelChanged; ;
ui.PointerWheelChanged += Ui_PointerWheelChanged;
}
else
{
Expand Down Expand Up @@ -128,6 +127,7 @@ private void Unregister()
if (fe == null) { return; }
fe.Unloaded -= this.Fe_Unloaded;

fe.PointerWheelChanged -= Ui_PointerWheelChanged;
Window.Current.CoreWindow.PointerWheelChanged -= CoreWindow_PointerWheelChanged;

}
Expand Down
2 changes: 2 additions & 0 deletions Hohoema/Presentation.Views/StateTrigger/FocusTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class FocusTrigger : UIIntractionTriggerBase
{
protected override void OnAttachTargetHandler(UIElement ui)
{
ui.GotFocus -= Ui_GotFocus;
ui.LostFocus -= Ui_LostFocus;
ui.GotFocus += Ui_GotFocus;
ui.LostFocus += Ui_LostFocus;
}
Expand Down

0 comments on commit be16012

Please sign in to comment.