diff --git a/Pixiview.iOS/Pixiview.iOS.csproj b/Pixiview.iOS/Pixiview.iOS.csproj index 35005d7..93ee590 100644 --- a/Pixiview.iOS/Pixiview.iOS.csproj +++ b/Pixiview.iOS/Pixiview.iOS.csproj @@ -75,7 +75,6 @@ - diff --git a/Pixiview.iOS/Renderers/AdaptedNavigationPageRenderer.cs b/Pixiview.iOS/Renderers/AdaptedNavigationPageRenderer.cs deleted file mode 100644 index e4b9d87..0000000 --- a/Pixiview.iOS/Renderers/AdaptedNavigationPageRenderer.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Pixiview.iOS.Renderers; -using Pixiview.UI; -using UIKit; -using Xamarin.Forms; -using Xamarin.Forms.Platform.iOS; - -[assembly: ExportRenderer(typeof(AdaptedNavigationPage), typeof(AdaptedNavigationPageRenderer))] -namespace Pixiview.iOS.Renderers -{ - public class AdaptedNavigationPageRenderer : NavigationRenderer - { - public override void WillMoveToParentViewController(UIViewController parent) - { - if (Element is AdaptedNavigationPage navigation) - { - NavigationBar.Translucent = true; - - var barHeight = NavigationBar.Frame.Height; - var statusHeight = UIApplication.SharedApplication.StatusBarFrame.Height; - navigation.SetNavigationBarHeight(barHeight, statusHeight); - } - - base.WillMoveToParentViewController(parent); - } - } -} diff --git a/Pixiview/App.cs b/Pixiview/App.cs index 0234461..664c928 100644 --- a/Pixiview/App.cs +++ b/Pixiview/App.cs @@ -67,7 +67,7 @@ namespace Pixiview { var service = DependencyService.Get(); InitLanguage(service); - MainPage = UIFactory.CreateNavigationPage(new MainPage()); + MainPage = new AppShell(); InitResources(service); } diff --git a/Pixiview/AppShell.xaml b/Pixiview/AppShell.xaml new file mode 100644 index 0000000..d83328a --- /dev/null +++ b/Pixiview/AppShell.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/Pixiview/AppShell.xaml.cs b/Pixiview/AppShell.xaml.cs new file mode 100644 index 0000000..e1fc87c --- /dev/null +++ b/Pixiview/AppShell.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Pixiview +{ + public partial class AppShell : Shell + { + public AppShell() + { + InitializeComponent(); + } + } +} diff --git a/Pixiview/MainPage.xaml b/Pixiview/MainPage.xaml index 1055071..6c52cce 100644 --- a/Pixiview/MainPage.xaml +++ b/Pixiview/MainPage.xaml @@ -10,6 +10,7 @@ mc:Ignorable="d" x:Class="Pixiview.MainPage" util:Screen.StatusBarStyle="{DynamicResource StatusBarStyle}" + Shell.NavBarHasShadow="True" BackgroundColor="{DynamicResource WindowColor}" Title="{r:Text Follow}" OrientationChanged="Page_OrientationChanged"> diff --git a/Pixiview/NewsPage.xaml b/Pixiview/NewsPage.xaml new file mode 100644 index 0000000..118c615 --- /dev/null +++ b/Pixiview/NewsPage.xaml @@ -0,0 +1,6 @@ + + + + + diff --git a/Pixiview/NewsPage.xaml.cs b/Pixiview/NewsPage.xaml.cs new file mode 100644 index 0000000..795b7f2 --- /dev/null +++ b/Pixiview/NewsPage.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Pixiview +{ + public partial class NewsPage : ContentPage + { + public NewsPage() + { + InitializeComponent(); + } + } +} diff --git a/Pixiview/RankingPage.xaml b/Pixiview/RankingPage.xaml new file mode 100644 index 0000000..0067e83 --- /dev/null +++ b/Pixiview/RankingPage.xaml @@ -0,0 +1,6 @@ + + + + + diff --git a/Pixiview/RankingPage.xaml.cs b/Pixiview/RankingPage.xaml.cs new file mode 100644 index 0000000..caf3382 --- /dev/null +++ b/Pixiview/RankingPage.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Pixiview +{ + public partial class RankingPage : ContentPage + { + public RankingPage() + { + InitializeComponent(); + } + } +} diff --git a/Pixiview/Resources/Languages/zh-CN.xml b/Pixiview/Resources/Languages/zh-CN.xml index b6a1bcf..a99684d 100644 --- a/Pixiview/Resources/Languages/zh-CN.xml +++ b/Pixiview/Resources/Languages/zh-CN.xml @@ -3,6 +3,8 @@ Pixiview OK 已关注 + 最新 + 排行榜 预览 成功保存图片到照片库。 \ No newline at end of file diff --git a/Pixiview/UI/AdaptedNavigationPage.cs b/Pixiview/UI/AdaptedNavigationPage.cs deleted file mode 100644 index f69235b..0000000 --- a/Pixiview/UI/AdaptedNavigationPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Xamarin.Forms; - -namespace Pixiview.UI -{ - public class AdaptedNavigationPage : NavigationPage - { - public AdaptedNavigationPage(Page page) : base(page) - { - } - - public void SetNavigationBarHeight(double barHeight, double statusHeight) - { - StyleDefinition.SetNavigationBarHeight(barHeight, statusHeight); - } - } -} diff --git a/Pixiview/UI/StyleDefinition.cs b/Pixiview/UI/StyleDefinition.cs index bfbebb3..e288e36 100644 --- a/Pixiview/UI/StyleDefinition.cs +++ b/Pixiview/UI/StyleDefinition.cs @@ -15,10 +15,9 @@ namespace Pixiview.UI public static readonly Thickness LeftBottom10 = new Thickness(10, 0, 0, 10); public static readonly GridLength TitleIconWidth = 40; - public static Thickness NavigationBarOffset; - public static Thickness StatusBarOffset; - public static Thickness TotalBarOffset; - + public const string IconUser = "\uf007"; + public const string IconSparkles = "\uf890"; + public const string IconOrder = "\uf88f"; public const string IconLayer = "\uf302"; public const string IconRefresh = "\uf2f1"; public const string IconOption = "\uf013"; @@ -39,13 +38,6 @@ namespace Pixiview.UI } } - public static void SetNavigationBarHeight(double barHeight, double statusHeight) - { - NavigationBarOffset = new Thickness(0, barHeight, 0, 0); - StatusBarOffset = new Thickness(0, statusHeight, 0, 0); - TotalBarOffset = new Thickness(0, barHeight + statusHeight, 0, 0); - } - private static bool? _isFullscreenDevice; public static bool IsFullscreenDevice { diff --git a/Pixiview/UI/Theme/ThemeBase.cs b/Pixiview/UI/Theme/ThemeBase.cs index 8a0d40c..fe12633 100644 --- a/Pixiview/UI/Theme/ThemeBase.cs +++ b/Pixiview/UI/Theme/ThemeBase.cs @@ -6,6 +6,9 @@ namespace Pixiview.UI.Theme { public const string TitleButton = nameof(TitleButton); public const string TitleLabel = nameof(TitleLabel); + public const string FontIconUser = nameof(FontIconUser); + public const string FontIconSparkles = nameof(FontIconSparkles); + public const string FontIconOrder = nameof(FontIconOrder); public const string FontIconRefresh = nameof(FontIconRefresh); public const string FontIconOption = nameof(FontIconOption); public const string FontIconDownload = nameof(FontIconDownload); @@ -51,7 +54,6 @@ namespace Pixiview.UI.Theme } var mainColor = this[MainTextColor]; - var iconSolidFontFamily = (string)this[IconSolidFontFamily]; Add(TitleLabel, new Style(typeof(Label)) { @@ -71,30 +73,29 @@ namespace Pixiview.UI.Theme { new Setter { Property = Button.BorderWidthProperty, Value = 0.0 }, new Setter { Property = VisualElement.BackgroundColorProperty, Value = Color.Transparent }, - new Setter { Property = Button.FontFamilyProperty, Value = iconSolidFontFamily }, + new Setter { Property = Button.FontFamilyProperty, Value = (string)this[IconSolidFontFamily] }, new Setter { Property = Button.FontSizeProperty, Value = StyleDefinition.FontSizeTitleIcon }, new Setter { Property = Button.TextColorProperty, Value = mainColor } } }); - Add(FontIconRefresh, new FontImageSource + + Add(FontIconUser, GetSolidIcon(StyleDefinition.IconUser)); + Add(FontIconSparkles, GetSolidIcon(StyleDefinition.IconSparkles)); + Add(FontIconOrder, GetSolidIcon(StyleDefinition.IconOrder)); + Add(FontIconRefresh, GetSolidIcon(StyleDefinition.IconRefresh)); + Add(FontIconOption, GetSolidIcon(StyleDefinition.IconOption)); + Add(FontIconDownload, GetSolidIcon(StyleDefinition.IconDownload)); + } + + private FontImageSource GetSolidIcon(string icon) + { + return new FontImageSource { - FontFamily = iconSolidFontFamily, - Glyph = StyleDefinition.IconRefresh, + FontFamily = (string)this[IconSolidFontFamily], + Glyph = icon, Size = StyleDefinition.FontSizeTitle - }); - Add(FontIconOption, new FontImageSource - { - FontFamily = iconSolidFontFamily, - Glyph = StyleDefinition.IconOption, - Size = StyleDefinition.FontSizeTitle - }); - Add(FontIconDownload, new FontImageSource - { - FontFamily = iconSolidFontFamily, - Glyph = StyleDefinition.IconDownload, - Size = StyleDefinition.FontSizeTitle - }); + }; } } } diff --git a/Pixiview/Utils/UIFactory.cs b/Pixiview/Utils/UIFactory.cs deleted file mode 100644 index 1e30d7b..0000000 --- a/Pixiview/Utils/UIFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Pixiview.UI; -using Pixiview.UI.Theme; -using Xamarin.Forms; - -namespace Pixiview.Utils -{ - public static class UIFactory - { - public static AdaptedNavigationPage CreateNavigationPage(Page root) - { - var navigation = new AdaptedNavigationPage(root); - //navigation.SetDynamicResource(NavigationPage.BarBackgroundColorProperty, ThemeBase.MainColor); - navigation.SetDynamicResource(NavigationPage.BarTextColorProperty, ThemeBase.MainTextColor); - navigation.SetDynamicResource(VisualElement.BackgroundColorProperty, ThemeBase.WindowColor); - return navigation; - } - } -} diff --git a/Pixiview/ViewIllustPage.xaml b/Pixiview/ViewIllustPage.xaml index 482cd67..fbdd4a5 100644 --- a/Pixiview/ViewIllustPage.xaml +++ b/Pixiview/ViewIllustPage.xaml @@ -4,18 +4,16 @@ xmlns:p="clr-namespace:Pixiview" xmlns:u="clr-namespace:Pixiview.UI" xmlns:util="clr-namespace:Pixiview.Utils" - xmlns:r="clr-namespace:Pixiview.Resources" x:Class="Pixiview.ViewIllustPage" util:Screen.StatusBarStyle="{DynamicResource StatusBarStyle}" util:Screen.HomeIndicatorAutoHidden="True" BackgroundColor="{DynamicResource WindowColor}" - Title="{r:Text Preview}" - OrientationChanged="Page_OrientationChanged"> + Title="{Binding IllustItem.Title}"> - + @@ -27,8 +25,13 @@ - + + + (bool)GetValue(IsPageVisibleProperty); set => SetValue(IsPageVisibleProperty, value); } - public Thickness PageTopMargin - { - get => (Thickness)GetValue(PageTopMarginProperty); - set => SetValue(PageTopMarginProperty, value); - } public IllustItem IllustItem { get => (IllustItem)GetValue(IllustItemProperty); @@ -86,7 +79,6 @@ namespace Pixiview } Illusts = items; - UpdatePageTopMargin(CurrentOrientation); Task.Run(DoLoadImages); } @@ -113,37 +105,6 @@ namespace Pixiview } } - private void Page_OrientationChanged(object sender, OrientationEventArgs e) - { - UpdatePageTopMargin(e.CurrentOrientation); - } - - private void UpdatePageTopMargin(Orientation orientation) - { - switch (orientation) - { - case Orientation.Portrait: - PageTopMargin = StyleDefinition.TotalBarOffset; - break; - case Orientation.PortraitUpsideDown: - if (DeviceInfo.Idiom == DeviceIdiom.Phone) - { - PageTopMargin = StyleDefinition.NavigationBarOffset; - } - else - { - PageTopMargin = StyleDefinition.TotalBarOffset; - } - break; - case Orientation.Unknown: - case Orientation.LandscapeLeft: - case Orientation.LandscapeRight: - default: - PageTopMargin = StyleDefinition.NavigationBarOffset; - break; - } - } - private void DoLoadImages() { var pages = Stores.LoadIllustPageData(IllustItem.Id); diff --git a/Res/screenshot.png b/Res/screenshot.png index 6f52ebf..a29339b 100644 Binary files a/Res/screenshot.png and b/Res/screenshot.png differ