commit 67d4955664ec388a8f8ae4dc4ae1dfd75f2cd758 Author: Tsanie Lily Date: Sun May 3 23:46:08 2020 +0800 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed9dbcb --- /dev/null +++ b/.gitignore @@ -0,0 +1,405 @@ +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ \ No newline at end of file diff --git a/Pixiview.iOS/AppDelegate.cs b/Pixiview.iOS/AppDelegate.cs new file mode 100644 index 0000000..14d3c98 --- /dev/null +++ b/Pixiview.iOS/AppDelegate.cs @@ -0,0 +1,27 @@ +using Foundation; +using UIKit; + +namespace Pixiview.iOS +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("AppDelegate")] + public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate + { + // + // This method is invoked when the application has loaded and is ready to run. In this + // method you should instantiate the window, load the UI into it and then make the window + // visible. + // + // You have 17 seconds to return from this method, or iOS will terminate your application. + // + public override bool FinishedLaunching(UIApplication app, NSDictionary options) + { + Xamarin.Forms.Forms.Init(); + LoadApplication(new App()); + + return base.FinishedLaunching(app, options); + } + } +} diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..98f4d03 --- /dev/null +++ b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,117 @@ +{ + "images": [ + { + "scale": "2x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon40.png" + }, + { + "scale": "3x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon60.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon58.png" + }, + { + "scale": "3x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon87.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon80.png" + }, + { + "scale": "3x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "2x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "3x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon180.png" + }, + { + "scale": "1x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon20.png" + }, + { + "scale": "2x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "1x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon29.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon58.png" + }, + { + "scale": "1x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon80.png" + }, + { + "scale": "1x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon76.png" + }, + { + "scale": "2x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon152.png" + }, + { + "scale": "2x", + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon167.png" + }, + { + "scale": "1x", + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon1024.png" + } + ], + "properties": {}, + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png new file mode 100644 index 0000000..b2982a9 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png new file mode 100644 index 0000000..e85949e Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png new file mode 100644 index 0000000..6136747 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png new file mode 100644 index 0000000..d1ed7fb Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png new file mode 100644 index 0000000..eed4f75 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png new file mode 100644 index 0000000..bb5a243 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png new file mode 100644 index 0000000..8f4026e Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png new file mode 100644 index 0000000..97a8193 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png new file mode 100644 index 0000000..96630b0 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png new file mode 100644 index 0000000..8c62d25 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png new file mode 100644 index 0000000..aed0901 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png new file mode 100644 index 0000000..4f7dae0 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png differ diff --git a/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png new file mode 100644 index 0000000..0949e86 Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png differ diff --git a/Pixiview.iOS/Entitlements.plist b/Pixiview.iOS/Entitlements.plist new file mode 100644 index 0000000..e9a3005 --- /dev/null +++ b/Pixiview.iOS/Entitlements.plist @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Pixiview.iOS/Info.plist b/Pixiview.iOS/Info.plist new file mode 100644 index 0000000..8e84970 --- /dev/null +++ b/Pixiview.iOS/Info.plist @@ -0,0 +1,48 @@ + + + + + UIDeviceFamily + + 1 + 2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + MinimumOSVersion + 11.0 + CFBundleDisplayName + Pixiview + CFBundleIdentifier + org.tsanie.Pixiview + CFBundleVersion + 1.0 + UILaunchStoryboardName + LaunchScreen + CFBundleName + Pixiview + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset + UIAppFonts + + fa-light-300.ttf + fa-regular-400.ttf + fa-solid-900.ttf + + UIViewControllerBasedStatusBarAppearance + + UIStatusBarStyle + UIStatusBarStyleDefault + + diff --git a/Pixiview.iOS/Main.cs b/Pixiview.iOS/Main.cs new file mode 100644 index 0000000..bb47b41 --- /dev/null +++ b/Pixiview.iOS/Main.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace Pixiview.iOS +{ + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, "AppDelegate"); + } + } +} diff --git a/Pixiview.iOS/Pixiview.iOS.csproj b/Pixiview.iOS/Pixiview.iOS.csproj new file mode 100644 index 0000000..a297a95 --- /dev/null +++ b/Pixiview.iOS/Pixiview.iOS.csproj @@ -0,0 +1,147 @@ + + + + Debug + iPhoneSimulator + 8.0.30703 + 2.0 + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {6143fdea-f3c2-4a09-aafa-6e230626515e} + Exe + Pixiview.iOS + Resources + Pixiview.iOS + true + NSUrlSessionHandler + automatic + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + x86_64 + None + true + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + ARM64 + iPhone Developer + true + Entitlements.plist + None + -all + + + none + true + bin\iPhone\Release + prompt + 4 + ARM64 + iPhone Developer + Entitlements.plist + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + + + + + + + + + + + + + + + + {7F310047-BCBB-45F5-BD16-F246BA72AF73} + Pixiview + + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview.iOS/Properties/AssemblyInfo.cs b/Pixiview.iOS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..01ee389 --- /dev/null +++ b/Pixiview.iOS/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Pixiview.iOS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Pixiview.iOS")] +[assembly: AssemblyCopyright("Copyright © Tsanie 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Pixiview.iOS/Renderers/AdaptedPageRenderer.cs b/Pixiview.iOS/Renderers/AdaptedPageRenderer.cs new file mode 100644 index 0000000..248e127 --- /dev/null +++ b/Pixiview.iOS/Renderers/AdaptedPageRenderer.cs @@ -0,0 +1,68 @@ +using System.Diagnostics.CodeAnalysis; +using Pixiview.iOS.Renderers; +using Pixiview.UI; +using Pixiview.Utils; +using UIKit; +using Xamarin.Forms; +using Xamarin.Forms.Platform.iOS; + +[assembly: ExportRenderer(typeof(AdaptedPage), typeof(AdaptedPageRenderer))] +namespace Pixiview.iOS.Renderers +{ + public class AdaptedPageRenderer : PageRenderer + { + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + if (Element is AdaptedPage page) + { + page.OnLoad(); + } + } + + public override void ViewDidAppear(bool animated) + { + base.ViewDidAppear(animated); + + var style = ConvertStyle(StatusBar.GetStatusBarStyle(Element)); + if (UIApplication.SharedApplication.StatusBarStyle != style) + { + SetStatusBarStyle(style); + } + } + + private void SetStatusBarStyle(UIStatusBarStyle style) + { + if (style == UIStatusBarStyle.BlackOpaque) + { + UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade); + } + else + { + UIApplication.SharedApplication.SetStatusBarStyle(style, true); + UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade); + } + + SetNeedsStatusBarAppearanceUpdate(); + } + + [SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "")] + [SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "")] + private UIStatusBarStyle ConvertStyle(StatusBarStyles style) + { + switch (style) + { + case StatusBarStyles.DarkText: + return UIStatusBarStyle.DarkContent; + case StatusBarStyles.WhiteText: + return UIStatusBarStyle.LightContent; + case StatusBarStyles.Hidden: + return UIStatusBarStyle.BlackOpaque; + case StatusBarStyles.Default: + default: + return UIStatusBarStyle.Default; + } + } + } +} diff --git a/Pixiview.iOS/Resources/LaunchScreen.storyboard b/Pixiview.iOS/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..ec605eb --- /dev/null +++ b/Pixiview.iOS/Resources/LaunchScreen.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview.sln b/Pixiview.sln new file mode 100644 index 0000000..086460a --- /dev/null +++ b/Pixiview.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.Android", "Pixiview.Android\Pixiview.Android.csproj", "{B695E0C4-084A-456D-B075-718E55BA1FD6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview.iOS", "Pixiview.iOS\Pixiview.iOS.csproj", "{0CDD279E-3CAB-4CCA-A7C4-BC499724D051}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixiview", "Pixiview\Pixiview.csproj", "{7F310047-BCBB-45F5-BD16-F246BA72AF73}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Release|iPhone = Release|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|Any CPU.Build.0 = Release|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Debug|iPhone.Build.0 = Debug|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhone.ActiveCfg = Release|Any CPU + {B695E0C4-084A-456D-B075-718E55BA1FD6}.Release|iPhone.Build.0 = Release|Any CPU + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhone.ActiveCfg = Debug|iPhone + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Debug|iPhone.Build.0 = Debug|iPhone + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhone.ActiveCfg = Release|iPhone + {0CDD279E-3CAB-4CCA-A7C4-BC499724D051}.Release|iPhone.Build.0 = Release|iPhone + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|Any CPU.Build.0 = Release|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Debug|iPhone.Build.0 = Debug|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhone.ActiveCfg = Release|Any CPU + {7F310047-BCBB-45F5-BD16-F246BA72AF73}.Release|iPhone.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Pixiview/App.xaml b/Pixiview/App.xaml new file mode 100644 index 0000000..cd3f8d4 --- /dev/null +++ b/Pixiview/App.xaml @@ -0,0 +1,28 @@ + + + + Black + White + #333333 + White + + + + \ No newline at end of file diff --git a/Pixiview/App.xaml.cs b/Pixiview/App.xaml.cs new file mode 100644 index 0000000..3da910a --- /dev/null +++ b/Pixiview/App.xaml.cs @@ -0,0 +1,58 @@ +using Pixiview.UI; +using Pixiview.Utils; +using Xamarin.Forms; + +namespace Pixiview +{ + public partial class App : Application + { + public const string TitleButton = nameof(TitleButton); + public const string TitleLabel = nameof(TitleLabel); + + public const string WindowColor = nameof(WindowColor); + public const string TextColor = nameof(TextColor); + public const string MainColor = nameof(MainColor); + public const string MainTextColor = nameof(MainTextColor); + + public const string IconLightFontFamily = nameof(IconLightFontFamily); + public const string IconRegularFontFamily = nameof(IconRegularFontFamily); + public const string IconSolidFontFamily = nameof(IconSolidFontFamily); + public const string IconLeft = nameof(IconLeft); + public const string FontSizeTitle = nameof(FontSizeTitle); + public const string FontSizeTitleIcon = nameof(FontSizeTitleIcon); + //public const string Horizon10 = nameof(Horizon10); + + public App() + { + InitializeComponent(); + InitResources(); + } + + private void InitResources() + { + var p = DependencyService.Get().GetEnvironment(); + + Resources.Add(IconLightFontFamily, p.IconLightFontFamily); + Resources.Add(IconRegularFontFamily, p.IconRegularFontFamily); + Resources.Add(IconSolidFontFamily, p.IconSolidFontFamily); + + Resources.Add(IconLeft, p.IconLeft); + Resources.Add(FontSizeTitle, StyleDefinition.FontSizeTitle); + Resources.Add(FontSizeTitleIcon, StyleDefinition.FontSizeTitleIcon); + //Resources.Add(Horizon10, StyleDefinition.Horizon10); + } + + protected override void OnStart() + { + MainPage = UIFactory.CreateNavigationPage(new MainPage()); + } + + protected override void OnSleep() + { + } + + protected override void OnResume() + { + } + } +} diff --git a/Pixiview/AssemblyInfo.cs b/Pixiview/AssemblyInfo.cs new file mode 100644 index 0000000..c859952 --- /dev/null +++ b/Pixiview/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Xamarin.Forms.Xaml; + +[assembly: XamlCompilation(XamlCompilationOptions.Compile)] \ No newline at end of file diff --git a/Pixiview/MainPage.xaml b/Pixiview/MainPage.xaml new file mode 100644 index 0000000..7802739 --- /dev/null +++ b/Pixiview/MainPage.xaml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/Pixiview/MainPage.xaml.cs b/Pixiview/MainPage.xaml.cs new file mode 100644 index 0000000..c47c903 --- /dev/null +++ b/Pixiview/MainPage.xaml.cs @@ -0,0 +1,34 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using Pixiview.UI; +using Pixiview.Utils; + +namespace Pixiview +{ + // Learn more about making custom code visible in the Xamarin.Forms previewer + // by visiting https://aka.ms/xamarinforms-previewer + [DesignTimeVisible(false)] + public partial class MainPage : AdaptedPage + { + public MainPage() + { + InitializeComponent(); + BindingContext = this; + } + + public override void OnLoad() + { + Debug.WriteLine(Stores.PersonalFolder); + } + + void NavigationTitle_RightButtonClicked(object sender, EventArgs e) + { + } + + void NavigationTitle_LeftButtonClicked(object sender, EventArgs e) + { + DisplayAlert("title", "message", "Ok"); + } + } +} diff --git a/Pixiview/Pixiview.csproj b/Pixiview/Pixiview.csproj new file mode 100644 index 0000000..776110c --- /dev/null +++ b/Pixiview/Pixiview.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + true + + + + portable + true + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview/UI/AdaptedPage.cs b/Pixiview/UI/AdaptedPage.cs new file mode 100644 index 0000000..1fc6131 --- /dev/null +++ b/Pixiview/UI/AdaptedPage.cs @@ -0,0 +1,20 @@ +using System; +using Xamarin.Forms; + +namespace Pixiview.UI +{ + public class AdaptedPage : ContentPage + { + public event EventHandler Load; + + public AdaptedPage() + { + SetDynamicResource(BackgroundColorProperty, App.WindowColor); + } + + public virtual void OnLoad() + { + Load?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/Pixiview/UI/NavigationTitle.cs b/Pixiview/UI/NavigationTitle.cs new file mode 100644 index 0000000..6db773c --- /dev/null +++ b/Pixiview/UI/NavigationTitle.cs @@ -0,0 +1,104 @@ +using System; +using Xamarin.Forms; + +namespace Pixiview.UI +{ + public class NavigationTitle : ContentView + { + public static readonly BindableProperty TitleProperty = BindableProperty.Create( + nameof(Title), typeof(string), typeof(NavigationTitle)); + public static readonly BindableProperty IsLeftButtonVisibleProperty = BindableProperty.Create( + nameof(IsLeftButtonVisible), typeof(bool), typeof(NavigationTitle)); + public static readonly BindableProperty IsRightButtonVisibleProperty = BindableProperty.Create( + nameof(IsRightButtonVisible), typeof(bool), typeof(NavigationTitle)); + public static readonly BindableProperty RightButtonTextProperty = BindableProperty.Create( + nameof(RightButtonText), typeof(string), typeof(NavigationTitle)); + + public string Title + { + get => (string)GetValue(TitleProperty); + set => SetValue(TitleProperty, value); + } + public bool IsLeftButtonVisible + { + get => (bool)GetValue(IsLeftButtonVisibleProperty); + set => SetValue(IsLeftButtonVisibleProperty, value); + } + public bool IsRightButtonVisible + { + get => (bool)GetValue(IsRightButtonVisibleProperty); + set => SetValue(IsRightButtonVisibleProperty, value); + } + public string RightButtonText + { + get => (string)GetValue(RightButtonTextProperty); + set => SetValue(RightButtonTextProperty, value); + } + + public event EventHandler LeftButtonClicked; + public event EventHandler RightButtonClicked; + + public NavigationTitle() + { + BindingContext = this; + + var left = GetLinkButton(nameof(IsLeftButtonVisible), + padding: StyleDefinition.HorizonRight10); + left.SetDynamicResource(Button.FontFamilyProperty, App.IconRegularFontFamily); + left.SetDynamicResource(Button.TextProperty, App.IconLeft); + left.Clicked += Left_Clicked; + + var title = new Label(); + title.SetDynamicResource(StyleProperty, App.TitleLabel); + title.SetBinding(Label.TextProperty, nameof(Title)); + Grid.SetColumnSpan(title, 3); + + var right = GetLinkButton(nameof(IsRightButtonVisible), + text: nameof(RightButtonText), + horizon: LayoutOptions.End, + padding: StyleDefinition.HorizonLeft10); + right.Clicked += Right_Clicked; + Grid.SetColumn(right, 2); + + Content = new Grid + { + ColumnDefinitions = + { + new ColumnDefinition { Width = GridLength.Auto }, + new ColumnDefinition(), + new ColumnDefinition { Width = GridLength.Auto } + }, + ColumnSpacing = 0, + Children = { title, left, right } + }; + } + + private void Left_Clicked(object sender, EventArgs e) + { + LeftButtonClicked?.Invoke(sender, e); + } + + private void Right_Clicked(object sender, EventArgs e) + { + RightButtonClicked?.Invoke(sender, e); + } + + private Button GetLinkButton(string visibility, string text = null, LayoutOptions horizon = default, Thickness padding = default) + { + var button = new Button + { + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = horizon, + Padding = padding + }; + button.SetBinding(IsVisibleProperty, visibility); + if (text != null) + { + button.SetBinding(Button.TextProperty, text); + } + button.SetDynamicResource(StyleProperty, App.TitleButton); + return button; + } + } +} + diff --git a/Pixiview/UI/StyleDefinition.cs b/Pixiview/UI/StyleDefinition.cs new file mode 100644 index 0000000..744af93 --- /dev/null +++ b/Pixiview/UI/StyleDefinition.cs @@ -0,0 +1,13 @@ +using Xamarin.Forms; + +namespace Pixiview.UI +{ + public static class StyleDefinition + { + public static readonly double FontSizeTitle = 18.0; + public static readonly double FontSizeTitleIcon = 24.0; + + public static readonly Thickness HorizonLeft10 = new Thickness(10, 0, 0, 0); + public static readonly Thickness HorizonRight10 = new Thickness(0, 0, 10, 0); + } +} diff --git a/Pixiview/Utils/Stores.cs b/Pixiview/Utils/Stores.cs new file mode 100644 index 0000000..f435a9e --- /dev/null +++ b/Pixiview/Utils/Stores.cs @@ -0,0 +1,44 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Pixiview.Utils +{ + public class Stores + { + public static readonly string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); + //public static readonly string CacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); + public const string ImageFolder = "images"; + + [SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "")] + public static async Task DownloadImage(string url) + { + var uri = new Uri(url); + var handler = new HttpClientHandler + { + Proxy = new WebProxy("10.0.10.100", 8088), + UseProxy = true + }; + var client = new HttpClient(handler) + { + BaseAddress = new Uri($"{uri.Scheme}://{uri.Host}") + }; + using (var request = new HttpRequestMessage(HttpMethod.Get, uri.PathAndQuery) + { + Version = new Version(2, 0) + }) + { + request.Headers.Referrer = new Uri("https://www.pixiv.net/"); + var file = Path.Combine(PersonalFolder, ImageFolder, Path.GetFileName(uri.LocalPath)); + using (var response = await client.SendAsync(request)) + using (var fs = File.OpenWrite(file)) + { + await response.Content.CopyToAsync(fs); + } + } + } + } +}