Archived
1
0

#200: Fixed, Orientation support cut

This commit is contained in:
Michael Gordeev
2018-09-30 20:36:05 +03:00
parent 22cfe61bfb
commit a23774275f
3 changed files with 7 additions and 39 deletions
+1 -1
View File
@@ -82,7 +82,7 @@
</StackPanel> </StackPanel>
</Button> </Button>
</StackPanel> </StackPanel>
<ProgressBar Grid.Row="2" VerticalAlignment="Bottom" IsIndeterminate="True" Visibility="Collapsed" Name="commentsLoading"/> <ProgressBar Grid.Row="3" VerticalAlignment="Bottom" IsIndeterminate="True" Visibility="Collapsed" Name="commentsLoading"/>
</Grid> </Grid>
</Grid> </Grid>
+6 -2
View File
@@ -218,7 +218,7 @@ namespace FoxTube.Controls
private void editorClose_Click(object sender, RoutedEventArgs e) private void editorClose_Click(object sender, RoutedEventArgs e)
{ {
((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = GridLength.Auto; ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[3].Height = GridLength.Auto;
text.Visibility = Visibility.Visible; text.Visibility = Visibility.Visible;
editor.Visibility = Visibility.Collapsed; editor.Visibility = Visibility.Collapsed;
} }
@@ -236,11 +236,15 @@ namespace FoxTube.Controls
item.Snippet.UpdatedAt = DateTime.Now; item.Snippet.UpdatedAt = DateTime.Now;
if (type == CommentType.Reply) if (type == CommentType.Reply)
{
await SecretsVault.Service.Comments.Update(item, "snippet").ExecuteAsync(); await SecretsVault.Service.Comments.Update(item, "snippet").ExecuteAsync();
Initialize(item);
}
else else
{ {
thread.Snippet.TopLevelComment = item; thread.Snippet.TopLevelComment = item;
await SecretsVault.Service.CommentThreads.Update(thread, "snippet").ExecuteAsync(); await SecretsVault.Service.CommentThreads.Update(thread, "snippet").ExecuteAsync();
Initialize(thread);
} }
editorClose_Click(this, null); editorClose_Click(this, null);
@@ -265,7 +269,7 @@ namespace FoxTube.Controls
private void editBtn_Click(object sender, RoutedEventArgs e) private void editBtn_Click(object sender, RoutedEventArgs e)
{ {
((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = new GridLength(0); ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[3].Height = new GridLength(0);
text.Visibility = Visibility.Collapsed; text.Visibility = Visibility.Collapsed;
editorText.Text = text.Text; editorText.Text = text.Text;
editor.Visibility = Visibility.Visible; editor.Visibility = Visibility.Visible;
-36
View File
@@ -44,12 +44,9 @@ using Windows.System.Profile;
namespace FoxTube namespace FoxTube
{ {
public enum DeviceType { Other, Desktop, Mobile }
public sealed partial class VideoPlayer : UserControl public sealed partial class VideoPlayer : UserControl
{ {
public string videoId; public string videoId;
private DeviceType deviceType = DeviceType.Other;
private bool miniview = false; private bool miniview = false;
public bool MiniView public bool MiniView
@@ -107,21 +104,6 @@ namespace FoxTube
if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay))
miniViewBtn.Visibility = Visibility.Collapsed; miniViewBtn.Visibility = Visibility.Collapsed;
switch(AnalyticsInfo.VersionInfo.DeviceFamily)
{
case "Windows.Mobile":
deviceType = DeviceType.Mobile;
break;
case "Windows.Desktop":
deviceType = DeviceType.Desktop;
break;
default:
deviceType = DeviceType.Other;
break;
}
captions = grid.Children[2] as LiveCaptions; captions = grid.Children[2] as LiveCaptions;
volume.Value = Convert.ToDouble(settings.Values["volume"]); volume.Value = Convert.ToDouble(settings.Values["volume"]);
@@ -136,18 +118,6 @@ namespace FoxTube
audioSource.CurrentStateChanged += AudioSource_CurrentStateChanged; audioSource.CurrentStateChanged += AudioSource_CurrentStateChanged;
t.Elapsed += T_Elapsed; t.Elapsed += T_Elapsed;
seekTimer.Elapsed += SeekTimer_Elapsed; seekTimer.Elapsed += SeekTimer_Elapsed;
if(SimpleOrientationSensor.GetDefault() != null && deviceType == DeviceType.Mobile)
{
if (SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated270DegreesCounterclockwise || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated90DegreesCounterclockwise)
fullscreen_Click(this, null);
SimpleOrientationSensor.GetDefault().OrientationChanged += (s, arg) =>
{
if (((SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.NotRotated || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated180DegreesCounterclockwise) && fullScreen) ||
((SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated270DegreesCounterclockwise || SimpleOrientationSensor.GetDefault().GetCurrentOrientation() == SimpleOrientation.Rotated90DegreesCounterclockwise) && !fullScreen))
fullscreen_Click(this, null);
};
}
} }
public async void Initialize(Video meta, string channelAvatar) public async void Initialize(Video meta, string channelAvatar)
@@ -497,18 +467,12 @@ namespace FoxTube
ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
fullscreen.Content = "\xE1D8"; fullscreen.Content = "\xE1D8";
Height = Methods.MainPage.Height; Height = Methods.MainPage.Height;
if (deviceType == DeviceType.Mobile)
DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
} }
else else
{ {
ApplicationView.GetForCurrentView().ExitFullScreenMode(); ApplicationView.GetForCurrentView().ExitFullScreenMode();
fullscreen.Content = "\xE1D9"; fullscreen.Content = "\xE1D9";
Height = double.NaN; Height = double.NaN;
if (deviceType == DeviceType.Mobile)
DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
} }
} }