diff --git a/Pixiview/Illust/MainPage.xaml b/Pixiview/Illust/MainPage.xaml index 433e5b0..b87978c 100644 --- a/Pixiview/Illust/MainPage.xaml +++ b/Pixiview/Illust/MainPage.xaml @@ -12,7 +12,8 @@ IconImageSource="{DynamicResource FontIconRefresh}"/> - + - SetValue(KeywordsProperty, value); } + private double lastScrollY = double.MinValue; + private ScrollDirection scrollDirection = ScrollDirection.Stop; + public MainPage() { Resources.Add("cardView", GetCardViewTemplate()); @@ -26,24 +28,17 @@ namespace Pixiview.Illust #if __IOS__ searchBar.BackgroundColor = Color.Transparent; -#elif __ANDROID__ +#else searchBar.SetDynamicResource(SearchBar.TextColorProperty, UI.Theme.ThemeBase.TextColor); searchBar.SetDynamicResource(SearchBar.PlaceholderColorProperty, UI.Theme.ThemeBase.SubTextColor); searchBar.SetDynamicResource(BackgroundColorProperty, UI.Theme.ThemeBase.WindowColor); #endif } - protected override IEnumerable DoGetIllustList(IllustData data, ICommand command) + protected override IEnumerable DoGetIllustList(IllustData data) { return data.body.page.follow.Select(i => - { - var item = data.body.thumbnails.illust.FirstOrDefault(l => l.illustId == i.ToString())?.ConvertToItem(); - if (item != null) - { - item.IllustTapped = command; - } - return item; - }); + data.body.thumbnails.illust.FirstOrDefault(l => l.illustId == i.ToString())?.ConvertToItem()); } protected override IllustData DoLoadIllustData(bool force) @@ -73,5 +68,41 @@ namespace Pixiview.Illust Task.Run(() => App.OpenUrl(new Uri("pixiview://example.com/artworks/" + key))); } } + +#if __IOS__ + private const int searchBarHeight = 50; +#else + private const int searchBarHeight = 40; +#endif + + private void ScrollView_Scrolled(object sender, ScrolledEventArgs e) + { + var y = e.ScrollY; + if (y > lastScrollY) + { + // down + if (scrollDirection != ScrollDirection.Down && y > searchBarHeight - topOffset) + { + scrollDirection = ScrollDirection.Down; + ViewExtensions.CancelAnimations(searchBar); + ViewExtensions.CancelAnimations(panelBar); + searchBar.TranslateTo(0, -searchBarHeight, easing: Easing.CubicIn); + panelBar.TranslateTo(0, -searchBarHeight, easing: Easing.CubicIn); + } + } + else + { + // up + if (scrollDirection != ScrollDirection.Up) + { + scrollDirection = ScrollDirection.Up; + ViewExtensions.CancelAnimations(searchBar); + ViewExtensions.CancelAnimations(panelBar); + searchBar.TranslateTo(0, 0, easing: Easing.CubicOut); + panelBar.TranslateTo(0, 0, easing: Easing.CubicOut); + } + } + lastScrollY = y; + } } } diff --git a/Pixiview/Illust/RankingPage.xaml b/Pixiview/Illust/RankingPage.xaml index d373d93..7230c85 100644 --- a/Pixiview/Illust/RankingPage.xaml +++ b/Pixiview/Illust/RankingPage.xaml @@ -5,7 +5,8 @@ xmlns:u="clr-namespace:Pixiview.UI" xmlns:r="clr-namespace:Pixiview.Resources" x:Class="Pixiview.Illust.RankingPage" - BackgroundColor="{DynamicResource WindowColor}"> + BackgroundColor="{DynamicResource WindowColor}" + Title="{r:Text Ranking}"> @@ -23,7 +24,8 @@ -