Archived
1
0

Updated target version to 17134

Fixed headers
Added ads to VideoGrid

Related Work Items: #162, #188
This commit is contained in:
Michael Gordeev
2019-04-10 14:02:42 +03:00
parent 9f87dd994c
commit 7cbbc59e16
22 changed files with 311 additions and 170 deletions
+7 -9
View File
@@ -3,15 +3,13 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"> xmlns:local="using:FoxTube">
<Application.Resources> <Application.Resources>
<Color x:Key="SystemAccentColor">Red</Color> <ResourceDictionary>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}"/> <ResourceDictionary.MergedDictionaries>
<Style TargetType="ListViewItem" BasedOn="{StaticResource ListViewItemRevealStyle}"/> <ResourceDictionary Source="Themes/Resources.xml"/>
<Style TargetType="TextBlock"> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
<Setter Property="SelectionHighlightColor" Value="Red"/> </ResourceDictionary.MergedDictionaries>
</Style> </ResourceDictionary>
<Style TargetType="TextBox">
<Setter Property="SelectionHighlightColor" Value="Red"/>
</Style>
</Application.Resources> </Application.Resources>
</Application> </Application>
+8
View File
@@ -7,12 +7,20 @@
- Added ability to add videos to playlists on video page - Added ability to add videos to playlists on video page
- Added ability to add videos to playlists through card's context menu - Added ability to add videos to playlists through card's context menu
- Added ability to download video through card's context menu - Added ability to download video through card's context menu
- Deleted videos are now also displayed
- Added support of April 2018 Update (Windows 10 build 17134)
- Added adverts
- Fixed header titles
</en-US> </en-US>
<ru-RU>### Что нового: <ru-RU>### Что нового:
- Добавлено уведомление со списком изменений при первом запуске после обновления - Добавлено уведомление со списком изменений при первом запуске после обновления
- Добавлена возможность добавлять видео в плейлисты на странице просмотра - Добавлена возможность добавлять видео в плейлисты на странице просмотра
- Добавлена возможность добавлять видео в плейлисты через контекстное меню карточки - Добавлена возможность добавлять видео в плейлисты через контекстное меню карточки
- Добавлена возможность скачивать видео через контекстное меню карточки - Добавлена возможность скачивать видео через контекстное меню карточки
- Удаленные видео теперь также отображаются
- Добавлена поддержка Апрельского Обновления 2018 (Windows 10 сборка 17134)
- Добавлена реклама
- Исправлено изменение заголовков
</ru-RU> </ru-RU>
</content> </content>
</item> </item>
+13 -6
View File
@@ -1,27 +1,21 @@
using FoxTube.Pages; using FoxTube.Pages;
using Google.Apis.YouTube.v3;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using System.Xml; using System.Xml;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;
using Windows.ApplicationModel.Resources.Core;
using Windows.Storage; using Windows.Storage;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using Windows.System; using Windows.System;
using Windows.UI;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Documents; using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media;
using YoutubeExplode; using YoutubeExplode;
using YoutubeExplode.Models.MediaStreams; using YoutubeExplode.Models.MediaStreams;
@@ -51,6 +45,19 @@ namespace FoxTube
return new Uri(url); return new Uri(url);
} }
public static string GuardFromNull(this string str)
{
if (string.IsNullOrWhiteSpace(str))
return string.Empty;
else
return str;
}
public static bool IsNullOrWhiteSpace(this string str)
{
return string.IsNullOrWhiteSpace(str);
}
public static string GetChars(this string str, int count) public static string GetChars(this string str, int count)
{ {
try try
+3 -2
View File
@@ -42,8 +42,9 @@ namespace FoxTube
}; };
public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService; public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService;
public static HttpClient HttpClient { get; } = new HttpClient(); public static HttpClient HttpClient { get; } = new HttpClient();
public static string AppId => true ? "d25517cb-12d4-4699-8bdc-52040c712cab" : "9ncqqxjtdlfh"; private static bool TestAds => true; //Change this bool
public static string AdUnitId => true ? "test" : "1100037769"; public static string AppId => TestAds ? "d25517cb-12d4-4699-8bdc-52040c712cab" : "9ncqqxjtdlfh";
public static string AdUnitId => TestAds ? "test" : "1100037769";
public static bool AdsDisabled { get; private set; } = true; public static bool AdsDisabled { get; private set; } = true;
//User info //User info
+19 -3
View File
@@ -9,7 +9,23 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Visibility="Collapsed"> Opacity="0"
Name="card">
<UserControl.Resources>
<Storyboard x:Name="show">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}"> <Button Padding="0" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<Grid> <Grid>
@@ -20,10 +36,10 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="image" Source="/Assets/videoThumbSample.png" Stretch="Fill"/> <Image Name="image" Stretch="Fill" ImageOpened="Image_ImageOpened"/>
<StackPanel Margin="0,0,5,5" Background="Orange" VerticalAlignment="Bottom" BorderBrush="OrangeRed" BorderThickness="1" HorizontalAlignment="Right" Padding="5,2,5,3"> <StackPanel Margin="0,0,5,5" Background="Orange" VerticalAlignment="Bottom" BorderBrush="OrangeRed" BorderThickness="1" HorizontalAlignment="Right" Padding="5,2,5,3">
<TextBlock Name="info" Text="SPONSORED CONTENT" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/> <TextBlock Name="info" Text="CALL TO ACTION TEXT" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
</StackPanel> </StackPanel>
<Grid Grid.Row="1" Name="contentGrid"> <Grid Grid.Row="1" Name="contentGrid">
+32 -14
View File
@@ -13,13 +13,26 @@ namespace FoxTube.Controls.Adverts
{ {
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId); NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
public NativeAdV2 advert; public NativeAdV2 advert;
public CardAdvert() public CardAdvert(bool isOnVideoPage = false)
{ {
InitializeComponent(); InitializeComponent();
if(!isOnVideoPage)
MainPage.VideoPageSizeChanged += Methods_VideoPageSizeChanged;
manager.AdReady += AdReady; manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
manager.RequestAd(); manager.RequestAd();
} }
private void Methods_VideoPageSizeChanged(object sender = null, params object[] args)
{
Visibility = (bool)args[0] ? Visibility.Collapsed : Visibility.Visible;
}
private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Error has occured while loading ad");
}
private void AdReady(object sender, NativeAdReadyEventArgs e) private void AdReady(object sender, NativeAdReadyEventArgs e)
{ {
advert = e.NativeAd; advert = e.NativeAd;
@@ -32,24 +45,29 @@ namespace FoxTube.Controls.Adverts
title.Text = advert.Title; title.Text = advert.Title;
image.Source = new BitmapImage(advert.MainImages.First().Url.ToUri()); image.Source = new BitmapImage(advert.MainImages.First().Url.ToUri());
icon.ProfilePicture = advert.AdIcon.Source; icon.ProfilePicture = advert.AdIcon == null ? null : advert.AdIcon.Source;
if (string.IsNullOrWhiteSpace(advert.SponsoredBy)) sponsor.Text = advert.SponsoredBy.GuardFromNull();
sponsor.Visibility = Visibility.Collapsed;
if (advert.CallToActionText.IsNullOrWhiteSpace())
(info.Parent as FrameworkElement).Visibility = Visibility.Collapsed;
else else
sponsor.Text = advert.SponsoredBy; info.Text = advert.CallToActionText;
if (!string.IsNullOrWhiteSpace(advert.Rating)) desc.Text = string.Empty;
info.Text += $" {advert.Rating}";
if (string.IsNullOrWhiteSpace(advert.CallToActionText) && string.IsNullOrWhiteSpace(advert.Price)) if (!advert.Price.IsNullOrWhiteSpace())
desc.Visibility = Visibility.Collapsed; desc.Text += advert.Price;
else if (!string.IsNullOrWhiteSpace(advert.CallToActionText))
desc.Text = advert.CallToActionText;
else
desc.Text = advert.Price;
Visibility = Visibility.Visible; if (!advert.Rating.IsNullOrWhiteSpace())
desc.Text += " " + advert.Rating;
show.Begin();
}
private void Image_ImageOpened(object sender, RoutedEventArgs e)
{
showThumb.Begin();
} }
} }
} }
+17 -9
View File
@@ -10,11 +10,23 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:UserControl.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:UserControl.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid Name="grid"> <Grid Name="grid">
@@ -26,11 +38,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" Opacity=".0001"/> <Image Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" Opacity=".0001"/>
<Image Name="cover" Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" ImageOpened="Cover_ImageOpened" Opacity="0"> <Image Name="cover" Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" ImageOpened="Cover_ImageOpened" Opacity="0"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<StackPanel Name="liveTag" Margin="5" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3" Orientation="Horizontal" Visibility="Collapsed"> <StackPanel Name="liveTag" Margin="5" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3" Orientation="Horizontal" Visibility="Collapsed">
<TextBlock Text="&#xEC44; " VerticalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" FontWeight="Black"/> <TextBlock Text="&#xEC44; " VerticalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" FontWeight="Black"/>
+2 -2
View File
@@ -82,7 +82,7 @@ namespace FoxTube.Controls
}); });
} }
Opacity = 1; show.Begin();
} }
public void Button_Click(object sender, RoutedEventArgs e) public void Button_Click(object sender, RoutedEventArgs e)
@@ -125,7 +125,7 @@ namespace FoxTube.Controls
private void Cover_ImageOpened(object sender, RoutedEventArgs e) private void Cover_ImageOpened(object sender, RoutedEventArgs e)
{ {
cover.Opacity = 1; showThumb.Begin();
} }
} }
} }
-2
View File
@@ -4,8 +4,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls1="using:FoxTube.Controls"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
xmlns:foxtube="using:FoxTube" xmlns:foxtube="using:FoxTube"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="1080" d:DesignHeight="1080"
+17 -9
View File
@@ -10,11 +10,23 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:Page.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:Page.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid> <Grid>
@@ -25,11 +37,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" Opacity="0" ImageOpened="Thumbnail_ImageOpened"> <Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" Opacity="0" ImageOpened="Thumbnail_ImageOpened"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<Grid HorizontalAlignment="Right" Width="100"> <Grid HorizontalAlignment="Right" Width="100">
<Grid.Background> <Grid.Background>
+2 -2
View File
@@ -49,7 +49,7 @@ namespace FoxTube.Controls
try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; } try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; }
catch { } catch { }
Opacity = 1; show.Begin();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -87,7 +87,7 @@ namespace FoxTube.Controls
private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e) private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e)
{ {
thumbnail.Opacity = 1; showThumb.Begin();
} }
} }
} }
+17 -9
View File
@@ -10,11 +10,23 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:UserControl.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:UserControl.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid> <Grid>
@@ -25,11 +37,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" ImageOpened="Thumbnail_ImageOpened" Opacity="0"> <Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" ImageOpened="Thumbnail_ImageOpened" Opacity="0"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<Grid Background="#7F000000" Name="watched" Visibility="Collapsed"> <Grid Background="#7F000000" Name="watched" Visibility="Collapsed">
<StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1"> <StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1">
+4 -4
View File
@@ -57,7 +57,7 @@ namespace FoxTube.Controls
if (item.Snippet.Title == "Deleted video") if (item.Snippet.Title == "Deleted video")
{ {
ContextFlyout = null; ContextFlyout = null;
Opacity = 1; show.Begin();
return; return;
} }
@@ -101,7 +101,7 @@ namespace FoxTube.Controls
if(SecretsVault.History.Contains(videoId)) if(SecretsVault.History.Contains(videoId))
watched.Visibility = Visibility.Visible; watched.Visibility = Visibility.Visible;
Opacity = 1; show.Begin();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -193,7 +193,7 @@ namespace FoxTube.Controls
if (SecretsVault.History.Contains(videoId)) if (SecretsVault.History.Contains(videoId))
watched.Visibility = Visibility.Visible; watched.Visibility = Visibility.Visible;
Opacity = 1; show.Begin();
} }
public async void Button_Click(object sender, RoutedEventArgs e) public async void Button_Click(object sender, RoutedEventArgs e)
@@ -252,7 +252,7 @@ namespace FoxTube.Controls
private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e) private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e)
{ {
thumbnail.Opacity = 1; showThumb.Begin();
} }
private async void NewPlaylist_Click(object sender, RoutedEventArgs e) private async void NewPlaylist_Click(object sender, RoutedEventArgs e)
+8 -10
View File
@@ -11,7 +11,7 @@
<AssemblyName>FoxTube</AssemblyName> <AssemblyName>FoxTube</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion> <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -390,11 +390,12 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Themes\Resources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AdaptiveCards.Rendering.Uwp">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="Google.Apis"> <PackageReference Include="Google.Apis">
<Version>1.30.0-beta02</Version> <Version>1.30.0-beta02</Version>
</PackageReference> </PackageReference>
@@ -414,7 +415,7 @@
<Version>10.1811.22001</Version> <Version>10.1811.22001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics"> <PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.13.2</Version> <Version>1.14.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version> <Version>6.2.8</Version>
@@ -429,16 +430,13 @@
<Version>5.1.1</Version> <Version>5.1.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.UI.Xaml"> <PackageReference Include="Microsoft.UI.Xaml">
<Version>2.0.181018004</Version> <Version>2.0.181011001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression"> <PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression">
<Version>4.3.2</Version> <Version>4.3.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="YoutubeExplode"> <PackageReference Include="YoutubeExplode">
<Version>4.6.7</Version> <Version>4.6.8</Version>
</PackageReference>
<PackageReference Include="YoutubeExtractor">
<Version>0.10.11</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+17 -10
View File
@@ -8,9 +8,23 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="using:FoxTube.Pages" xmlns:pages="using:FoxTube.Pages"
xmlns:controls="using:FoxTube.Controls" xmlns:controls="using:FoxTube.Controls"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources>
<Storyboard x:Name="showHeader">
<DoubleAnimation Storyboard.TargetName="ColapsedHeader" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideHeader">
<DoubleAnimation Storyboard.TargetName="ColapsedHeader" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="channelCover" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="channelCover" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="Grid_SizeChanged"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="Grid_SizeChanged">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
@@ -22,11 +36,7 @@
<Grid> <Grid>
<ParallaxView Source="{x:Bind videoScroll}" VerticalShift="100"> <ParallaxView Source="{x:Bind videoScroll}" VerticalShift="100">
<Grid> <Grid>
<Image Source="/Assets/ChannelCoverTemplate.png" Name="channelCover" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0" ImageOpened="ChannelCover_ImageOpened"> <Image Source="/Assets/ChannelCoverTemplate.png" Name="channelCover" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0" ImageOpened="ChannelCover_ImageOpened"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
</Grid> </Grid>
</ParallaxView> </ParallaxView>
<ScrollViewer ViewChanged="ScrollViewer_ViewChanged" Name="videoScroll"> <ScrollViewer ViewChanged="ScrollViewer_ViewChanged" Name="videoScroll">
@@ -78,14 +88,11 @@
<Pivot.RightHeader> <Pivot.RightHeader>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Name="ColapsedHeader" Opacity="0"> <StackPanel Orientation="Horizontal" Name="ColapsedHeader" Opacity="0">
<Windows10version1809:StackPanel.OpacityTransition>
<ScalarTransition/>
</Windows10version1809:StackPanel.OpacityTransition>
<PersonPicture Height="32" Name="collapsedAvatar"/> <PersonPicture Height="32" Name="collapsedAvatar"/>
<TextBlock Text="Channel name" VerticalAlignment="Center" Margin="10,0" Name="collapsedTitle"/> <TextBlock Text="Channel name" VerticalAlignment="Center" Margin="10,0" Name="collapsedTitle"/>
<Button x:Uid="/Cards/subscribe" Background="Red" Foreground="White" FontWeight="SemiBold" Content="Subscribe" Width="150" Name="collapsedBtn" Click="Subscribe_Click" Padding="2"/> <Button x:Uid="/Cards/subscribe" Background="Red" Foreground="White" FontWeight="SemiBold" Content="Subscribe" Width="150" Name="collapsedBtn" Click="Subscribe_Click" Padding="2"/>
</StackPanel> </StackPanel>
<AutoSuggestBox x:Uid="/Channel/search" VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/> <AutoSuggestBox FontSize="14" x:Uid="/Channel/search" VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/>
</StackPanel> </StackPanel>
</Pivot.RightHeader> </Pivot.RightHeader>
</Pivot> </Pivot>
+10 -4
View File
@@ -175,7 +175,7 @@ namespace FoxTube.Pages
if (content.SelectedIndex == 0) if (content.SelectedIndex == 0)
ScrollViewer_ViewChanged(this, null); ScrollViewer_ViewChanged(this, null);
else else
ColapsedHeader.Opacity = 1; showHeader.Begin();
} }
private async void ShowMorePlaylists_Click() private async void ShowMorePlaylists_Click()
@@ -259,9 +259,15 @@ namespace FoxTube.Pages
Rect view = new Rect(0.0, 0.0, videoScroll.ActualWidth, videoScroll.ActualHeight); Rect view = new Rect(0.0, 0.0, videoScroll.ActualWidth, videoScroll.ActualHeight);
if (view.Contains(new Point(panel.Left, panel.Bottom))) if (view.Contains(new Point(panel.Left, panel.Bottom)))
ColapsedHeader.Opacity = 0; {
if (ColapsedHeader.Opacity == 1)
hideHeader.Begin();
}
else else
ColapsedHeader.Opacity = 1; {
if (ColapsedHeader.Opacity == 0)
showHeader.Begin();
}
} }
private void Refresh_Click(object sender, RoutedEventArgs e) private void Refresh_Click(object sender, RoutedEventArgs e)
@@ -281,7 +287,7 @@ namespace FoxTube.Pages
private void ChannelCover_ImageOpened(object sender, RoutedEventArgs e) private void ChannelCover_ImageOpened(object sender, RoutedEventArgs e)
{ {
channelCover.Opacity = 1; showThumb.Begin();
infoStack.Margin = new Thickness(0, channelCover.ActualHeight, 0, 0); infoStack.Margin = new Thickness(0, channelCover.ActualHeight, 0, 0);
} }
+50 -54
View File
@@ -4,14 +4,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)" mc:Ignorable="d"
xmlns:Windows10version1803="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 6)" xmlns:ui="using:Microsoft.UI.Xaml.Controls">
mc:Ignorable="d">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Windows10version1809:Grid.BackgroundTransition>
<BrushTransition/>
</Windows10version1809:Grid.BackgroundTransition>
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup> <VisualStateGroup>
<VisualState> <VisualState>
@@ -38,13 +34,13 @@
Style="{StaticResource CaptionTextBlockStyle}" /> Style="{StaticResource CaptionTextBlockStyle}" />
</Border> </Border>
<NavigationView SelectedItem="toHome" Windows10version1803:BackRequested="Nav_BackRequested" Windows10version1803:PaneClosing="Nav_PaneClosing" Windows10version1803:PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged"> <ui:NavigationView FontSize="14" SelectedItem="toHome" BackRequested="Nav_BackRequested" PaneClosing="Nav_PaneClosing" PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
<NavigationView.Header> <ui:NavigationView.Header>
<TextBlock Name="Title" Margin="0,30,0,10" Style="{StaticResource TitleTextBlockStyle}"/> <TextBlock Name="Title" Style="{StaticResource TitleTextBlockStyle}"/>
</NavigationView.Header> </ui:NavigationView.Header>
<NavigationView.MenuItemTemplate> <ui:NavigationView.MenuItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}"> <StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}">
<PersonPicture Height="20" Margin="-5,0,15,0"> <PersonPicture Height="20" Margin="-5,0,15,0">
@@ -52,61 +48,61 @@
<BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/> <BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/>
</PersonPicture.ProfilePicture> </PersonPicture.ProfilePicture>
</PersonPicture> </PersonPicture>
<TextBlock Text="{Binding Snippet.Title}"/> <TextBlock FontSize="14" Text="{Binding Snippet.Title}"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</NavigationView.MenuItemTemplate> </ui:NavigationView.MenuItemTemplate>
<NavigationView.MenuItems> <ui:NavigationView.MenuItems>
<NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/> <ui:NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/>
<NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/>
<NavigationViewItemHeader x:Uid="/Main/myLibrary" Content="My library" Name="libHeader" Visibility="Collapsed"/> <ui:NavigationViewItemHeader x:Uid="/Main/myLibrary" FontSize="14" Content="My library" Name="libHeader" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed"> <ui:NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81C;"/> <FontIcon Glyph="&#xE81C;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/> <ui:NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/>
<NavigationViewItemHeader x:Uid="/Main/subscriptions" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/> <ui:NavigationViewItemHeader x:Uid="/Main/subscriptions" FontSize="14" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
</NavigationView.MenuItems> </ui:NavigationView.MenuItems>
<NavigationView.PaneFooter> <ui:NavigationView.PaneFooter>
<NavigationViewList> <ui:NavigationViewList>
<NavigationViewList.ItemContainerTransitions> <ui:NavigationViewList.ItemContainerTransitions>
<TransitionCollection> <TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/> <EntranceThemeTransition IsStaggeringEnabled="True"/>
<ReorderThemeTransition/> <ReorderThemeTransition/>
</TransitionCollection> </TransitionCollection>
</NavigationViewList.ItemContainerTransitions> </ui:NavigationViewList.ItemContainerTransitions>
<NavigationViewItem Name="openWeb" Tapped="Web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/> <ui:NavigationViewItem Name="openWeb" Tapped="Web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="Feedback_Click" Visibility="Collapsed"> <ui:NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="Feedback_Click" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xED15;"/> <FontIcon Glyph="&#xED15;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds"> <ui:NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE14D;"/> <FontIcon Glyph="&#xE14D;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem Name="account" x:Uid="/Main/signIn" Content="Add account" Tapped="SignIn_Click" Visibility="Collapsed"> <ui:NavigationViewItem Name="account" x:Uid="/Main/signIn" Content="Add account" Tapped="SignIn_Click" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE8FA;"/> <FontIcon Glyph="&#xE8FA;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="OpenContext" Padding="-5"> <ui:NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="OpenContext" Padding="-5">
<StackPanel Orientation="Horizontal" Padding="5"> <StackPanel Orientation="Horizontal" Padding="5">
<PersonPicture Height="20" Margin="-5,0,15,0"/> <PersonPicture Height="20" Margin="-5,0,15,0"/>
<TextBlock Name="myName" Text="My account"/> <TextBlock Name="myName" Text="My account"/>
</StackPanel> </StackPanel>
<NavigationViewItem.ContextFlyout> <ui:NavigationViewItem.ContextFlyout>
<Flyout> <Flyout>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -121,20 +117,20 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
</Flyout> </Flyout>
</NavigationViewItem.ContextFlyout> </ui:NavigationViewItem.ContextFlyout>
</NavigationViewItem> </ui:NavigationViewItem>
</NavigationViewList> </ui:NavigationViewList>
</NavigationView.PaneFooter> </ui:NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox> <ui:NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/> <AutoSuggestBox FontSize="14" x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/>
</NavigationView.AutoSuggestBox> </ui:NavigationView.AutoSuggestBox>
<Grid> <Grid>
<Frame Name="content" Navigated="Content_Navigated"/> <Frame Name="content" Navigated="Content_Navigated"/>
<Frame Name="videoPlaceholder"/> <Frame Name="videoPlaceholder"/>
</Grid> </Grid>
</NavigationView> </ui:NavigationView>
</Grid> </Grid>
</Page> </Page>
+21 -11
View File
@@ -12,14 +12,11 @@ using System.Xml;
using Google.Apis.YouTube.v3.Data; using Google.Apis.YouTube.v3.Data;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
using Windows.System; using Windows.System;
using Google.Apis.Oauth2.v2;
using Google.Apis.Oauth2.v2.Data;
using FoxTube.Pages; using FoxTube.Pages;
using Windows.UI.Popups; using Windows.UI.Popups;
using Windows.Networking.Connectivity; using Windows.Networking.Connectivity;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;
using Microsoft.Services.Store.Engagement; using Microsoft.Services.Store.Engagement;
using System.Linq;
namespace FoxTube namespace FoxTube
{ {
@@ -29,6 +26,7 @@ namespace FoxTube
public sealed partial class MainPage : Page public sealed partial class MainPage : Page
{ {
bool wasInvoked = false; bool wasInvoked = false;
public static event ObjectEventHandler VideoPageSizeChanged;
readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Main"); readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Main");
Dictionary<Type, Action> headers; Dictionary<Type, Action> headers;
public MainPage() public MainPage()
@@ -157,7 +155,7 @@ namespace FoxTube
break; break;
case "remove": case "remove":
NavigationViewItem item = nav.MenuItems.Find(i => ((i as NavigationViewItem).Content as StackPanel).Tag.ToString() == (args[1] as Subscription).Snippet.ResourceId.ChannelId) as NavigationViewItem; Microsoft.UI.Xaml.Controls.NavigationViewItem item = nav.MenuItems.Find(i => ((i as Microsoft.UI.Xaml.Controls.NavigationViewItem).Content as StackPanel).Tag.ToString() == (args[1] as Subscription).Snippet.ResourceId.ChannelId) as Microsoft.UI.Xaml.Controls.NavigationViewItem;
if (item == null) if (item == null)
break; break;
else else
@@ -338,7 +336,10 @@ namespace FoxTube
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
nav.IsPaneOpen = false; nav.IsPaneOpen = false;
VideoPageSizeChanged?.Invoke(this, true);
videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId }); videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId });
Title.Text = resources.GetString("/Main/video");
} }
public void GoToDeveloper(string id) public void GoToDeveloper(string id)
@@ -383,6 +384,8 @@ namespace FoxTube
else else
nav.IsBackEnabled = false; nav.IsBackEnabled = false;
VideoPageSizeChanged?.Invoke(this, false);
SetNavigationMenu(); SetNavigationMenu();
try { headers[content.SourcePageType](); } try { headers[content.SourcePageType](); }
@@ -394,7 +397,7 @@ namespace FoxTube
if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions)) if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions))
{ {
nav.ExpandedModeThresholdWidth = 1008; nav.ExpandedModeThresholdWidth = 1008;
nav.IsPaneOpen = nav.DisplayMode == NavigationViewDisplayMode.Expanded ? true : false; nav.IsPaneOpen = nav.DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded ? true : false;
} }
else else
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
@@ -415,6 +418,8 @@ namespace FoxTube
Title.Text = resources.GetString("/Main/video"); Title.Text = resources.GetString("/Main/video");
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
nav.IsPaneOpen = false; nav.IsPaneOpen = false;
VideoPageSizeChanged?.Invoke(this, true);
} }
public void CloseVideo() public void CloseVideo()
@@ -431,7 +436,12 @@ namespace FoxTube
else else
nav.IsBackEnabled = false; nav.IsBackEnabled = false;
VideoPageSizeChanged?.Invoke(this, false);
SetNavigationMenu(); SetNavigationMenu();
try { headers[content.SourcePageType](); }
catch { }
} }
private void Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) private void Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
@@ -538,7 +548,7 @@ namespace FoxTube
private void OpenContext(object sender, TappedRoutedEventArgs e) private void OpenContext(object sender, TappedRoutedEventArgs e)
{ {
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender); ((Microsoft.UI.Xaml.Controls.NavigationViewItem)sender).ContextFlyout.ShowAt((Microsoft.UI.Xaml.Controls.NavigationViewItem)sender);
} }
private void RemoveAds_Tapped(object sender, TappedRoutedEventArgs e) private void RemoveAds_Tapped(object sender, TappedRoutedEventArgs e)
@@ -551,7 +561,7 @@ namespace FoxTube
content.Navigate(typeof(Home1)); content.Navigate(typeof(Home1));
} }
private void Nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) private void Nav_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
{ {
try try
{ {
@@ -586,7 +596,7 @@ namespace FoxTube
catch { } catch { }
} }
private void Nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) private void Nav_BackRequested(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs args)
{ {
if (videoPlaceholder.Content != null) if (videoPlaceholder.Content != null)
{ {
@@ -599,16 +609,16 @@ namespace FoxTube
content.GoBack(); content.GoBack();
} }
private void Nav_PaneClosing(NavigationView sender, NavigationViewPaneClosingEventArgs args) private void Nav_PaneClosing(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewPaneClosingEventArgs args)
{ {
AppTitle.Visibility = Visibility.Collapsed; AppTitle.Visibility = Visibility.Collapsed;
} }
private void Nav_PaneOpened(NavigationView sender, object args) private void Nav_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
{ {
AppTitle.Visibility = Visibility.Visible; AppTitle.Visibility = Visibility.Visible;
if (sender.DisplayMode == NavigationViewDisplayMode.Expanded && sender.IsPaneOpen) if (sender.DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded && sender.IsPaneOpen)
AppTitleBar.Margin = new Thickness(40, 0, 0, 0); AppTitleBar.Margin = new Thickness(40, 0, 0, 0);
else else
AppTitleBar.Margin = new Thickness(); AppTitleBar.Margin = new Thickness();
+1 -1
View File
@@ -79,7 +79,7 @@
</Grid> </Grid>
<StackPanel Grid.Column="1"> <StackPanel Grid.Column="1">
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/> <TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/>
<TextBlock Opacity=".5" Text="{Binding Path=Subtitle}"/> <TextBlock FontSize="14" Opacity=".5" Text="{Binding Path=Subtitle}"/>
<TextBlock Opacity=".5" FontSize="13" Text="{Binding Path=TimeStampString}" TextWrapping="WrapWholeWords"/> <TextBlock Opacity=".5" FontSize="13" Text="{Binding Path=TimeStampString}" TextWrapping="WrapWholeWords"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
+11 -3
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using FoxTube.Controls.Adverts;
using System.Collections.Generic;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
@@ -20,6 +21,7 @@ namespace FoxTube.Pages
} }
private int cols = 1; private int cols = 1;
public int Count => Children.Count; public int Count => Children.Count;
public bool IsRelatedVideos { get; set; } = false;
public List<UIElement> Children { get; } = new List<UIElement>(); public List<UIElement> Children { get; } = new List<UIElement>();
public VideoGrid() public VideoGrid()
@@ -31,8 +33,14 @@ namespace FoxTube.Pages
{ {
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(card); (grid.Children[Count % cols + 1] as StackPanel).Children.Add(card);
Children.Add(card); Children.Add(card);
/*if (list.Items.Count % 10 == 0)
list.Items.Add(new CardAdvert());*/ if ((Children.Count - 5) % 20 == 0)
{
CardAdvert advert = new CardAdvert(IsRelatedVideos);
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(advert);
Children.Add(advert);
}
empty.Visibility = Visibility.Collapsed; empty.Visibility = Visibility.Collapsed;
} }
+1 -1
View File
@@ -128,7 +128,7 @@
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False"> <Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
<PivotItem x:Uid="/VideoPage/related" Header="Suggestions"> <PivotItem x:Uid="/VideoPage/related" Header="Suggestions">
<ScrollViewer> <ScrollViewer>
<pages:VideoGrid x:Name="relatedVideos"/> <pages:VideoGrid x:Name="relatedVideos" IsRelatedVideos="True"/>
</ScrollViewer> </ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder"> <PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder">
+46
View File
@@ -0,0 +1,46 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:Microsoft.UI.Xaml.Controls">
<Color x:Key="SystemAccentColor">Red</Color>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ListViewItem" BasedOn="{StaticResource ListViewItemRevealStyle}"/>
<Style TargetType="TextBlock">
<Setter Property="SelectionHighlightColor" Value="Red"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="SelectionHighlightColor" Value="Red"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ComboBox">
<Setter Property="Margin" Value="0,5,0,0"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ToggleSwitch">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="RadioButton">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="Run">
<Setter Property="FontSize" Value="{StaticResource Size}"/>
</Style>
<Style TargetType="HyperlinkButton">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="AutoSuggestBox">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ui:NavigationViewItem">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ui:NavigationViewItemHeader">
<Setter Property="FontSize" Value="14"/>
</Style>
<Duration x:Key="CardOpacityDuration">0:0:0.5</Duration>
</ResourceDictionary>