Archived
1
0

Dark theme, navigation

This commit is contained in:
Michael Gordeev
2018-08-10 20:50:52 +03:00
parent 6969af84a8
commit b712bfb74e
32 changed files with 359 additions and 418 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ namespace FoxTube.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Parameter == null)
if ((string)e.Parameter == null)
loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated.");
else
Initialize(e.Parameter as string);
+2 -2
View File
@@ -8,7 +8,7 @@
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="White" Name="grid">
<Grid Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
@@ -30,7 +30,7 @@
<TextBlock Name="counter" Grid.Row="1" Text="[Comments count] Comments" Margin="5,0,0,0" VerticalAlignment="Center" FontWeight="SemiBold"/>
<StackPanel Padding="0" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
<TextBlock Text="Sort by: " VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Blue" Padding="0" VerticalAlignment="Center">
<Button Name="orderBtn" Background="Transparent" Content="Relevance" Foreground="Red" Padding="0" VerticalAlignment="Center">
<Button.Flyout>
<MenuFlyout>
+1
View File
@@ -95,6 +95,7 @@ namespace FoxTube
public void Initialize()
{
GC.Collect();
pivot.Items.Clear();
if(SecretsVault.IsAuthorized)
+2 -3
View File
@@ -5,10 +5,9 @@
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="White">
mc:Ignorable="d">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ProgressRing Name="ring" IsActive="True" Foreground="Red" Width="100" Height="100"/>
<StackPanel Name="wifiTrouble" Visibility="Collapsed" VerticalAlignment="Center">
+29 -38
View File
@@ -6,54 +6,47 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ads="using:Microsoft.Advertising.WinRT.UI"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:pages="using:FoxTube.Pages"
mc:Ignorable="d"
SizeChanged="Page_SizeChanged">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="openSearch.Visibility" Value="Collapsed"/>
<Setter Target="compactSearch.Visibility" Value="Visible"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<NavigationView PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" IsPaneOpen="False" SelectionChanged="nav_SelectionChanged">
<NavigationView SelectedItem="toHome" BackRequested="nav_BackRequested" PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" IsPaneOpen="False" SelectionChanged="nav_SelectionChanged">
<NavigationView.MenuItems>
<NavigationViewItem Icon="Home" Content="Home" Name="toHome"/>
<NavigationViewItem Content="History" Name="toHistory">
<NavigationViewItem Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/>
<NavigationViewItem Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/>
<NavigationViewItemHeader Content="My library" Name="libHeader" Visibility="Collapsed"/>
<NavigationViewItem Content="History" Name="toHistory" Visibility="Collapsed">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81C;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Icon="Like" Content="Liked videos" Name="toLiked"/>
<NavigationViewItem Icon="Clock" Content="Watch later" Name="toLater"/>
<NavigationViewItem Icon="People" Content="Subscriptions" Name="toSubscriptions"/>
<NavigationViewItem Icon="Download" Content="Downloads" Name="toDownloads"/>
<NavigationViewItemHeader Content="Subscriptions" Name="subsHeader"/>
<NavigationViewItem Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
<NavigationViewItem Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/>
<NavigationViewItem Icon="Download" Content="Downloads" Name="toDownloads" Visibility="Collapsed"/>
<NavigationViewItemHeader Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
</NavigationView.MenuItems>
<NavigationView.PaneFooter>
<NavigationViewList>
<NavigationViewItem Content="My channel" Icon="Contact" Name="toChannel"/>
<!--<NavigationViewItem>
<StackPanel>
<Button Visibility="Visible" Name="feedback" Click="feedback_Click" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<PersonPicture Height="20" Margin="-2,0,14,0"/>
<TextBlock Text="My channel"/>
<FontIcon Glyph="&#xED15;" FontSize="16" Margin="6,0,16,0"/>
<TextBlock Text="Give a feedback"/>
</StackPanel>
</NavigationViewItem>-->
<NavigationViewItem Icon="Shop" Content="Remove ads"/>
</NavigationViewList>
</Button>
<Button Visibility="Collapsed" Name="removeAds" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE14D;" FontSize="16" Margin="6,0,16,0"/>
<TextBlock Text="Remove ads"/>
</StackPanel>
</Button>
</StackPanel>
</NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="search_QuerySubmitted" TextChanged="search_TextChanged" PlaceholderText="Search"/>
</NavigationView.AutoSuggestBox>
@@ -70,10 +63,6 @@
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;"
Width="50" Height="50" Background="Transparent"/>
<Button Name="feedback" ToolTipService.ToolTip="Send feedback" Click="feedback_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED15;"
Width="50" Height="50" Background="Transparent"/>
<Button Name="account" ToolTipService.ToolTip="Sign in"
FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;"
Width="50" Height="50" Background="Transparent">
@@ -85,7 +74,7 @@
</Button.Flyout>
</Button>
<Button Width="50" Background="Transparent" Height="50" Visibility="Visible" Name="avatar" ToolTipService.ToolTip="My account">
<Button Width="50" Background="Transparent" Height="50" Visibility="Collapsed" Name="avatar" ToolTipService.ToolTip="My account">
<PersonPicture Width="30"/>
<Button.Flyout>
<MenuFlyout>
@@ -100,8 +89,10 @@
</NavigationView.Header>
<Grid>
<Frame Name="content"/>
<Frame Name="videoPlaceholder"/>
<Frame Name="content" Navigated="content_Navigated"/>
<controls:DropShadowPanel Color="Black" BlurRadius="0" ShadowOpacity=".7" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Frame Name="videoPlaceholder"/>
</controls:DropShadowPanel>
</Grid>
</NavigationView>
+138 -108
View File
@@ -38,6 +38,7 @@ using Google.Apis.Oauth2.v2;
using Google.Apis.Oauth2.v2.Data;
using FoxTube.Controls;
using FoxTube.Pages;
using Microsoft.Toolkit.Uwp.UI.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
@@ -72,6 +73,8 @@ namespace FoxTube
settings.Values.Add("moblieWarning", false);
if (settings.Values["videoAutoplay"] == null)
settings.Values.Add("videoAutoplay", false);
if (settings.Values["themeMode"] == null)
settings.Values.Add("themeMode", 2);
if (settings.Values["volume"] == null)
settings.Values.Add("volume", 100);
@@ -86,8 +89,8 @@ namespace FoxTube
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization();
if(!SecretsVault.IsAuthorized)
content.Navigate(typeof(Home));
if (!SecretsVault.IsAuthorized)
nav.SelectedItem = toHome;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -100,6 +103,7 @@ namespace FoxTube
{
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonForegroundColor = Colors.Black;
titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
@@ -110,7 +114,7 @@ namespace FoxTube
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
{
if ((string)args[0] == "add" && nav.MenuItems.Count < 16)
if ((string)args[0] == "add" && nav.MenuItems.Count < 19)
{
Subscription s = args[1] as Subscription;
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
@@ -121,10 +125,14 @@ namespace FoxTube
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
nav.MenuItems.Add(new NavigationViewItem()
{
Content = panel,
Name = (nav.MenuItems.Count - 9).ToString()
});
}
else if ((string)args[0] == "remove" && (int)args[1] < 10)
nav.MenuItems.RemoveAt((int)args[1]);
nav.MenuItems.RemoveAt((int)args[1] + 9);
}
private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
@@ -137,23 +145,24 @@ namespace FoxTube
Userinfoplus info = await new Oauth2Service(SecretsVault.Initializer).Userinfo.Get().ExecuteAsync();
ToolTipService.SetToolTip(avatar, new ToolTip() { Content = info.Name });
((avatar.Content as Grid).Children[1] as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
(avatar.Content as PersonPicture).ProfilePicture = new BitmapImage(new Uri(info.Picture));
}
catch { }
avatar.Visibility = Visibility.Visible;
toChannel.Visibility = Visibility.Visible;
toSubscriptions.Visibility = Visibility.Visible;
libHeader.Visibility = Visibility.Visible;
toHistory.Visibility = Visibility.Visible;
toLiked.Visibility = Visibility.Visible;
toLater.Visibility = Visibility.Visible;
toSubscriptions.Visibility = Visibility.Visible;
toChannel.Visibility = Visibility.Visible;
toDownloads.Visibility = Visibility.Visible;
subsHeader.Visibility = Visibility.Visible;
if (SecretsVault.Subscriptions.Count > 0)
{
subsHeader.Visibility = Visibility.Visible;
int l = SecretsVault.Subscriptions.Count;
int n = 10;
for(int k = 0; k < l && k < n; k++)
for(int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
try
{
Subscription s = SecretsVault.Subscriptions[k];
@@ -165,7 +174,11 @@ namespace FoxTube
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
nav.MenuItems.Add(new NavigationViewItem()
{
Content = panel,
Name = k.ToString()
});
}
catch { continue; }
}
@@ -175,22 +188,26 @@ namespace FoxTube
account.Visibility = Visibility.Visible;
avatar.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
toSubscriptions.Visibility = Visibility.Collapsed;
libHeader.Visibility = Visibility.Collapsed;
toHistory.Visibility = Visibility.Collapsed;
toLiked.Visibility = Visibility.Collapsed;
toLater.Visibility = Visibility.Collapsed;
toSubscriptions.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
toDownloads.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed;
for(int k = 7; k < nav.MenuItems.Count; k++)
for(int k = 9; k < nav.MenuItems.Count; k++)
nav.MenuItems.RemoveAt(k);
}
content.CacheSize = 0;
nav.SelectedItem = toHome;
content.Navigate(typeof(Home));
content.CacheSize = 0;
if (videoPlaceholder.Content != null)
(videoPlaceholder.Content as VideoPage).refresh_Click(this, null);
GoToVideo((videoPlaceholder.Content as VideoPage).videoId);
}
public void GotNotification()
@@ -198,75 +215,9 @@ namespace FoxTube
notificationMenu.Content = "\xED0C";
}
/*void MainListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (mainList.SelectedItem == null)
return;
subscriptionsList.SelectedItem = null;
serviceList.SelectedItem = null;
object s = mainList.SelectedItem;
if (s == toHistory)
content.Navigate(typeof(Settings));
else if (s == toLiked)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (s == toLater)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
else if (s == toSubscriptions)
content.Navigate(typeof(Settings));
else if (s == toDownloads)
content.Navigate(typeof(Downloads));
else
content.Navigate(typeof(Home));
}
catch { }
}
void ServiceListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (serviceList.SelectedItem == null)
return;
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
object s = serviceList.SelectedItem;
if (s == toChannel)
content.Navigate(typeof(Channel), SecretsVault.AccountId);
else if (s == toRemoveAds)
content.Navigate(typeof(Settings), "adblock");
else
content.Navigate(typeof(Settings));
}
catch { }
}
void SubscriptionSelected(object sender, SelectionChangedEventArgs e)
{
try
{
if (subscriptionsList.SelectedItem == null)
return;
mainList.SelectedItem = null;
serviceList.SelectedItem = null;
GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
}
catch { }
}*/
public void notificationMenu_Click(object sender, RoutedEventArgs e)
{
notificationMenu.Content = "\xED0D";
//notificationPane.IsOpen = !notificationPane.IsOpen;
}
private void feedback_Click(object sender, RoutedEventArgs e)
@@ -319,7 +270,7 @@ namespace FoxTube
content.Navigate(typeof(ChannelPage), id);
}
public void GoToVideo(string id)
public void GoToVideo(string id, string playlistId = null)
{
nav.IsPaneOpen = false;
@@ -327,7 +278,7 @@ namespace FoxTube
MaximizeVideo();
Fullscreen(false);
videoPlaceholder.Navigate(typeof(VideoPage), id);
videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId });
}
public void GoToDeveloper(string id)
@@ -356,34 +307,45 @@ namespace FoxTube
public void MinimizeVideo()
{
videoPlaceholder.Width = 432;
videoPlaceholder.Height = 243;
videoPlaceholder.VerticalAlignment = VerticalAlignment.Bottom;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Right;
videoPlaceholder.Margin = new Thickness(0, 0, 25, 50);
DropShadowPanel ph = videoPlaceholder.Parent as DropShadowPanel;
ph.BlurRadius = 20;
ph.Width = 432;
ph.Height = 243;
ph.VerticalAlignment = VerticalAlignment.Bottom;
ph.HorizontalAlignment = HorizontalAlignment.Right;
ph.Margin = new Thickness(0, 0, 25, 50);
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
}
public void MaximizeVideo()
{
videoPlaceholder.Width = double.NaN;
videoPlaceholder.Height = double.NaN;
videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
videoPlaceholder.Margin = new Thickness(0);
DropShadowPanel ph = videoPlaceholder.Parent as DropShadowPanel;
ph.BlurRadius = 0;
ph.Width = double.NaN;
ph.Height = double.NaN;
ph.VerticalAlignment = VerticalAlignment.Stretch;
ph.HorizontalAlignment = HorizontalAlignment.Stretch;
ph.Margin = new Thickness(0);
nav.IsBackEnabled = true;
}
public void Fullscreen(bool on)
{
if(on)
{
nav.AlwaysShowHeader = false;
nav.CompactPaneLength = 0;
nav.OpenPaneLength = 0;
nav.Margin = new Thickness(-48, -93, 0, 0);
nav.OpenPaneLength = 48;
}
else
{
nav.AlwaysShowHeader = true;
nav.CompactPaneLength = 48;
nav.Margin = new Thickness(0);
nav.OpenPaneLength = 300;
}
}
@@ -397,6 +359,11 @@ namespace FoxTube
}
videoPlaceholder.Content = null;
MaximizeVideo();
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
}
private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
@@ -409,21 +376,84 @@ namespace FoxTube
if(search.Text.Length > 2)
{
XmlDocument doc = new XmlDocument();
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string)[0] + (settings.Values["region"] as string)[1]}&q={search.Text}");
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string).Remove(2)}&q={search.Text}");
if (doc["toplevel"].HasChildNodes)
for (int k = 0; k < 5; k++)
try
{
search.Items.Add(doc["toplevel"].ChildNodes[k]["suggestion"].GetAttribute("data"));
}
catch { break; }
List<string> suggestions = new List<string>();
for (int i = 0; i < doc["toplevel"].ChildNodes.Count && i < 5; i++)
suggestions.Add(doc["toplevel"].ChildNodes[i]["suggestion"].GetAttribute("data"));
search.ItemsSource = suggestions;
}
}
private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
if (args.IsSettingsSelected)
content.Navigate(typeof(Settings));
else
{
if (args.SelectedItem == toHome)
content.Navigate(typeof(Home));
else if (args.SelectedItem == toHistory)
content.Navigate(typeof(Settings));
else if (args.SelectedItem == toLiked)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (args.SelectedItem == toLater)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
else if (args.SelectedItem == toSubscriptions)
content.Navigate(typeof(Settings));
else if (args.SelectedItem == toDownloads)
content.Navigate(typeof(Downloads));
else if (args.SelectedItem == toChannel)
content.Navigate(typeof(Channel), SecretsVault.UserChannel.Id);
else
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
}
}
private void content_Navigated(object sender, NavigationEventArgs e)
{
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{
{ typeof(Settings), () => header.Text = "Settings" },
{ typeof(ChannelPage), () => header.Text = "Channel" },
{ typeof(PlaylistPage), () => header.Text = "Playlist" },
{ typeof(Search), () => header.Text = "Search" },
{ typeof(History), () => header.Text = "History" },
{ typeof(Home), () => header.Text = "Home" },
{ typeof(Downloads), () => header.Text = "Downloads" }
};
switchCase[e.SourcePageType]();
if (content.CanGoBack)
nav.IsBackEnabled = true;
else
nav.IsBackEnabled = false;
if (videoPlaceholder.Content != null && (videoPlaceholder.Parent as DropShadowPanel).HorizontalAlignment == HorizontalAlignment.Stretch)
MinimizeAsInitializer();
}
private void toChannel_Click(object sender, RoutedEventArgs e)
{
nav.SelectedItem = null;
GoToChannel(SecretsVault.UserChannel.Id);
}
private void nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
{
if (videoPlaceholder.Content != null)
{
DropShadowPanel panel = videoPlaceholder.Parent as DropShadowPanel;
if (panel.HorizontalAlignment == HorizontalAlignment.Stretch)
MinimizeAsInitializer();
else
content.GoBack();
}
else
content.GoBack();
}
}
}
+2 -2
View File
@@ -91,7 +91,7 @@ namespace FoxTube.Pages
list.Clear();
foreach (PlaylistItem i in response.Items)
list.Add(new VideoCard(i.ContentDetails.VideoId));
list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId));
while (response.NextPageToken != null)
{
@@ -99,7 +99,7 @@ namespace FoxTube.Pages
response = await listRequest.ExecuteAsync();
foreach (PlaylistItem i in response.Items)
list.Add(new VideoCard(i.ContentDetails.VideoId));
list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId));
}
loading.Close();
+7 -2
View File
@@ -29,6 +29,7 @@ namespace FoxTube
public sealed partial class Search : Page
{
public string Term;
bool isChannel = false;
SearchResource.ListRequest request;
string nextToken;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
@@ -65,8 +66,11 @@ namespace FoxTube
break;
case "youtube#channel":
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
list.Add(cCard);
if(!isChannel)
{
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
list.Add(cCard);
}
break;
case "youtube#playlist":
@@ -110,6 +114,7 @@ namespace FoxTube
request = SecretsVault.Service.Search.List("id");
if (!string.IsNullOrWhiteSpace(channelId))
{
isChannel = true;
request.ChannelId = channelId;
(grid.Children[1] as CommandBar).Visibility = Visibility.Collapsed;
}
+1 -1
View File
@@ -10,7 +10,7 @@
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False" SelectionChanged="pivot_SelectionChanged">
<PivotItem Header="General">
<ScrollViewer>
<settingspages:General/>
+10
View File
@@ -27,6 +27,7 @@ namespace FoxTube
/// </summary>
public sealed partial class Settings : Page
{
bool inboxLoaded = false;
public Settings()
{
this.InitializeComponent();
@@ -60,5 +61,14 @@ namespace FoxTube
}
}
}
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (pivot.SelectedIndex == 4 && !inboxLoaded)
{
(((pivot.Items[4] as PivotItem).Content as ScrollViewer).Content as Inbox).LoadItems();
inboxLoaded = true;
}
}
}
}
+9 -9
View File
@@ -37,17 +37,17 @@
<TextBlock TextWrapping="WrapWholeWords" Visibility="Collapsed" Text="Special thanks to contributors for motivating me, testers and translators for making this app better everyday and you for using this app;)" Margin="0,0,0,10"/>
<TextBlock Text="Contacts" FontSize="22" FontWeight="SemiBold"/>
<TextBlock>Twitter: <Hyperlink NavigateUri="https://twitter.com/XFox_Mike" Foreground="Red">@XFox_Mike</Hyperlink></TextBlock>
<TextBlock>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike" Foreground="Red">@XFox.Mike</Hyperlink></TextBlock>
<TextBlock>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel" Foreground="Red">@FoxGameStudioChannel</Hyperlink></TextBlock>
<TextBlock>E-mail: <Hyperlink NavigateUri="mailto:michael.xfox@outlook.com" Foreground="Red">michael.xfox@outlook.com</Hyperlink></TextBlock>
<TextBlock Margin="0,0,0,10">My blog (Russian language only): <Hyperlink NavigateUri="https://michael-xfox.com" Foreground="Red">https://michael-xfox.com</Hyperlink></TextBlock>
<TextBlock>Twitter: <Hyperlink NavigateUri="https://twitter.com/XFox_Mike">@XFox_Mike</Hyperlink></TextBlock>
<TextBlock>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike">@XFox.Mike</Hyperlink></TextBlock>
<TextBlock>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel">@FoxGameStudioChannel</Hyperlink></TextBlock>
<TextBlock>E-mail: <Hyperlink NavigateUri="mailto:michael.xfox@outlook.com">michael.xfox@outlook.com</Hyperlink></TextBlock>
<TextBlock Margin="0,0,0,10">My blog (Russian language only): <Hyperlink NavigateUri="https://michael-xfox.com">https://michael-xfox.com</Hyperlink></TextBlock>
<TextBlock Text="Legal stuff" FontSize="22" FontWeight="SemiBold"/>
<HyperlinkButton Foreground="Red" Content="Our Privacy Policy" NavigateUri="https://michael-xfox.com/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<HyperlinkButton Content="Our Privacy Policy" NavigateUri="https://michael-xfox.com/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Content="YouTube Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Content="YouTube Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<TextBlock Text="© 2018 Michael Gordeev"/>
<TextBlock Text="© 2018 YouTube, LLC"/>
</StackPanel>
+1 -1
View File
@@ -52,7 +52,7 @@
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="Submit feedback" Name="submit" Margin="0,10,10,10" Click="submit_Click" Background="Red" Foreground="White"/>
<Button Content="Submit feedback" Name="submit" Margin="0,10,10,10" Click="submit_Click" Background="{ThemeResource SystemControlForegroundAccentBrush}" Foreground="White"/>
<ProgressRing VerticalAlignment="Center" Name="ring" Foreground="Red"/>
</StackPanel>
</StackPanel>
+6
View File
@@ -39,5 +39,11 @@
<TextBlock Text="Notifications" FontSize="22"/>
<ToggleSwitch Name="newVideo" OnContent="Notify when someone of your subscriptions uploaded new video" OffContent="Notify when someone of your subscriptions uploaded new video" Toggled="notification_IsEnabledChanged"/>
<TextBlock Text="Color mode" FontSize="22"/>
<RadioButton Content="Light" Name="light" GroupName="color" Checked="RadioButton_Checked"/>
<RadioButton Content="Dark" Name="dark" GroupName="color" Checked="RadioButton_Checked"/>
<RadioButton Content="Windows default" Name="system" GroupName="color" Checked="RadioButton_Checked"/>
<HyperlinkButton Content="Windows color settings" NavigateUri="ms-settings:colors"/>
</StackPanel>
</Page>
+36 -8
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -39,6 +40,19 @@ namespace FoxTube.Pages.SettingsPages
safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
switch((int)settings.Values["themeMode"])
{
case 0:
light.IsChecked = true;
break;
case 1:
dark.IsChecked = true;
break;
case 2:
system.IsChecked = true;
break;
}
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
region.Items.Add(culture.DisplayName);
@@ -63,14 +77,9 @@ namespace FoxTube.Pages.SettingsPages
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
{
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsOn)
settings.Values["newVideoNotification"] = newVideo.IsOn;
if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
settings.Values["moblieWarning"] = mobileWarning.IsOn;
if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
settings.Values["videoAutoplay"] = autoplay.IsOn;
settings.Values["newVideoNotification"] = newVideo.IsOn;
settings.Values["moblieWarning"] = mobileWarning.IsOn;
settings.Values["videoAutoplay"] = autoplay.IsOn;
}
private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -82,5 +91,24 @@ namespace FoxTube.Pages.SettingsPages
{
settings.Values["safeSearch"] = safeSearch.SelectedIndex;
}
private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
if (sender == light)
{
settings.Values["themeMode"] = 0;
Application.Current.RequestedTheme = ApplicationTheme.Light;
}
if (sender == dark)
{
settings.Values["themeMode"] = 1;
Application.Current.RequestedTheme = ApplicationTheme.Dark;
}
if (sender == system)
{
settings.Values["themeMode"] = 2;
Application.Current.RequestedTheme = ApplicationTheme.;
}
}
}
}
+1 -1
View File
@@ -54,7 +54,7 @@
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<ScrollViewer>
<StackPanel VerticalAlignment="Stretch" Background="#FFF2F2F2">
<StackPanel VerticalAlignment="Stretch">
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0" Name="filter" SelectionChanged="filter_SelectionChanged">
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Messages"/>
-29
View File
@@ -11,39 +11,10 @@
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="728"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="728"/>
<Setter Target="ad.Height" Value="90"/>
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="640"/>
<Setter Target="ad.Height" Value="100"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ui:AdControl VerticalAlignment="Top" Name="ad"
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Height="50"
Width="300"/>
<controls:AdaptiveGridView Name="list" OneRowModeEnabled="False" DesiredWidth="384" SelectionMode="None" Grid.Row="1"/>
<TextBlock Name="empty" Text="&#xD8;" FontSize="200" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="2"/>
</Grid>
+26 -7
View File
@@ -97,18 +97,37 @@
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
<PivotItem Header="Suggestions">
<ScrollViewer>
<StackPanel>
<ui:AdControl
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Width="320" Height="50"/>
<StackPanel Name="relatedVideos"/>
</StackPanel>
<StackPanel Name="relatedVideos"/>
</ScrollViewer>
</PivotItem>
<PivotItem Header="Comments" Name="commentsPlaceholder">
<pages:CommentsPage/>
</PivotItem>
<PivotItem Header="Playlist" Name="playlist">
<StackPanel>
<StackPanel Padding="8" Background="WhiteSmoke">
<TextBlock Text="Music" FontSize="26" TextWrapping="WrapWholeWords" Name="playlistName"/>
<TextBlock Text="DAGames" Name="playlistChannel"/>
<TextBlock Text="15/155" Name="playlistCounter"/>
</StackPanel>
<ScrollViewer>
<StackPanel Name="playlistList">
<Button HorizontalAlignment="Stretch" Height="75" HorizontalContentAlignment="Stretch" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="15" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Image Grid.Column="1" Source="/Assets/videoThumbSample.png"/>
<TextBlock Grid.Column="2" Margin="8,0,0,0" VerticalAlignment="Center" TextWrapping="WrapWholeWords" Text="Title"/>
</Grid>
</Button>
</StackPanel>
</ScrollViewer>
</StackPanel>
</PivotItem>
</Pivot>
</Grid>
+30 -9
View File
@@ -46,7 +46,8 @@ namespace FoxTube.Pages
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
string videoId;
public string videoId;
string playlistId = null;
Video item;
List<string> downloads = new List<string>();
@@ -99,21 +100,40 @@ namespace FoxTube.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Parameter == null)
if (e.Parameter == null || string.IsNullOrWhiteSpace((e.Parameter as string[])[0]))
loading.Error("NullReferenceException", "Unable to initialize page. Video ID is not stated.");
else
Initialize(e.Parameter as string);
Initialize(e.Parameter as string[]);
}
public async void Initialize(string id)
public async void Initialize(string[] ids)
{
loading.Refresh();
try
{
videoId = id;
videoId = ids[0];
if (ids[1] != null)
{
PlaylistsResource.ListRequest playlistRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails");
playlistRequest.Id = ids[1];
Playlist playlistItem = (await playlistRequest.ExecuteAsync()).Items[0];
playlistName.Text = playlistItem.Snippet.Title;
playlistChannel.Text = playlistItem.Snippet.ChannelTitle;
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
listRequest.PlaylistId = ids[1];
PlaylistItemListResponse listResponse = await listRequest.ExecuteAsync();
//Initialize playlist tab
}
else
pivot.Items.Remove(playlist);
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,statistics,status,contentDetails");
request.Id = id;
request.Id = ids[0];
item = (await request.ExecuteAsync()).Items[0];
title.Text = item.Snippet.Title;
@@ -135,7 +155,7 @@ namespace FoxTube.Pages
if (SecretsVault.IsAuthorized)
{
VideoGetRatingResponse ratingResponse = await SecretsVault.Service.Videos.GetRating(id).ExecuteAsync();
VideoGetRatingResponse ratingResponse = await SecretsVault.Service.Videos.GetRating(ids[0]).ExecuteAsync();
if (ratingResponse.Items[0].Rating == "like")
{
userRating = Rating.Like;
@@ -274,7 +294,7 @@ namespace FoxTube.Pages
public void refresh_Click(object sender, RoutedEventArgs e)
{
player = new VideoPlayer();
Initialize(videoId);
Initialize(new string[2] { videoId, playlistId });
}
private void grid_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -290,7 +310,8 @@ namespace FoxTube.Pages
{
mainContent.Children.Remove(pivot);
tabsPlaceholder.Children.Add(pivot);
(pivot.Items[0] as PivotItem).Content = null;
pivot.Items.RemoveAt(0);
mainContent.Children.Add(descriptionPanel);
}