splash ui

This commit is contained in:
Tsanie Lily 2021-08-11 16:59:35 +08:00
parent 521d82829d
commit c224bed1f4
14 changed files with 48 additions and 28 deletions

View File

@ -16,12 +16,7 @@ namespace Gallery
public static PlatformCulture CurrentCulture { get; private set; } public static PlatformCulture CurrentCulture { get; private set; }
public static Dictionary<string, System.DateTime> RefreshTimes { get; } = new(); public static Dictionary<string, System.DateTime> RefreshTimes { get; } = new();
public static List<IGallerySource> GallerySources { get; } = new() public static List<IGallerySource> GallerySources { get; private set; }
{
new Sources.Yandere.GallerySource(), // https://yande.re
new Sources.Danbooru.GallerySource(), // https://danbooru.donmai.us
new Sources.Gelbooru.GallerySource() // https://gelbooru.com
};
public App() public App()
{ {
@ -42,7 +37,7 @@ namespace Gallery
private void InitPreference() private void InitPreference()
{ {
Config.Proxy = null; Config.Proxy = null;
Config.DownloadThreads = Preferences.Get(Config.DownloadThreadsKey, 1); Config.DownloadThreads = Preferences.Get(Config.DownloadThreadsKey, 4);
var isProxied = Preferences.Get(Config.IsProxiedKey, false); var isProxied = Preferences.Get(Config.IsProxiedKey, false);
if (isProxied) if (isProxied)
@ -109,6 +104,14 @@ namespace Gallery
protected override void OnStart() protected override void OnStart()
{ {
InitLanguage(); InitLanguage();
GallerySources = new List<IGallerySource>()
{
new Sources.Yandere.GallerySource(), // https://yande.re
new Sources.Danbooru.GallerySource(), // https://danbooru.donmai.us
new Sources.Gelbooru.GallerySource() // https://gelbooru.com
};
MainPage = new AppShell(); MainPage = new AppShell();
InitResource(); InitResource();
@ -117,6 +120,7 @@ namespace Gallery
protected override void OnSleep() protected override void OnSleep()
{ {
base.OnSleep();
} }
protected override void OnResume() protected override void OnResume()

View File

@ -57,7 +57,7 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ui:CircleImage Aspect="AspectFill" Source="xamarin_logo.png" <ui:CircleImage Aspect="AspectFill" Source="logo_light.png"
HeightRequest="60" WidthRequest="60" HeightRequest="60" WidthRequest="60"
VerticalOptions="Center"/> VerticalOptions="Center"/>
<Label Grid.Column="1" VerticalOptions="Center" FontAttributes="Bold" <Label Grid.Column="1" VerticalOptions="Center" FontAttributes="Bold"

View File

@ -458,7 +458,7 @@ namespace Gallery.Resources.UI
} }
} }
var list = collection.Where(i => i.PreviewImage == null).ToArray(); var list = collection.Where(i => i.PreviewImage == null).ToArray();
var task = ParallelTask.Start("collection.load", 0, list.Length, 2, i => var task = ParallelTask.Start("collection.load", 0, list.Length, Config.DownloadThreads, i =>
{ {
if (!collection.Running) if (!collection.Running)
{ {
@ -468,11 +468,15 @@ namespace Gallery.Resources.UI
if (item.PreviewImage == null && item.PreviewUrl != null) if (item.PreviewImage == null && item.PreviewUrl != null)
{ {
item.PreviewImage = Definition.DownloadBackground; item.PreviewImage = Definition.DownloadBackground;
#if DEBUG
System.Threading.Thread.Sleep(500);
#else
var image = Store.LoadPreviewImage(item.PreviewUrl, true, force: true).Result; var image = Store.LoadPreviewImage(item.PreviewUrl, true, force: true).Result;
if (image != null) if (image != null)
{ {
item.PreviewImage = image; item.PreviewImage = image;
} }
#endif
} }
return true; return true;
}, tagIndex: tag); }, tagIndex: tag);

View File

@ -185,7 +185,7 @@ namespace Gallery.Util
var data = new byte[size]; var data = new byte[size];
var task = new TaskCompletionSource<string>(); var task = new TaskCompletionSource<string>();
ParallelTask.Start($"download.async.{id}", 0, list.Count, 2, i => ParallelTask.Start($"download.async.{id}", 0, list.Count, Config.MaxThreads, i =>
{ {
var (from, to) = list[i]; var (from, to) = list[i];
using (var request = new HttpRequestMessage(HttpMethod.Get, url)) using (var request = new HttpRequestMessage(HttpMethod.Get, url))

View File

@ -81,7 +81,7 @@ namespace Gallery.Util
public const string ProxyHostKey = "proxy_host"; public const string ProxyHostKey = "proxy_host";
public const string ProxyPortKey = "proxy_port"; public const string ProxyPortKey = "proxy_port";
public const int MaxThreads = 8; public const int MaxThreads = 2;
public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"; public const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36";
public const string AcceptLanguage = "zh-cn"; public const string AcceptLanguage = "zh-cn";
public const string AcceptImage = "image/png,image/*,*/*;q=0.8"; public const string AcceptImage = "image/png,image/*,*/*;q=0.8";

View File

@ -73,6 +73,7 @@
<CodesignProvision>Gallery.Ad-Hoc</CodesignProvision> <CodesignProvision>Gallery.Ad-Hoc</CodesignProvision>
<MtouchLink>SdkOnly</MtouchLink> <MtouchLink>SdkOnly</MtouchLink>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<MtouchUseLlvm>true</MtouchUseLlvm>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
@ -110,9 +111,6 @@
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png" /> <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png" /> <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png" /> <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png" />
<BundleResource Include="Resources\xamarin_logo.png" />
<BundleResource Include="Resources\xamarin_logo%402x.png" />
<BundleResource Include="Resources\xamarin_logo%403x.png" />
<BundleResource Include="Resources\fa-light-300.ttf" /> <BundleResource Include="Resources\fa-light-300.ttf" />
<BundleResource Include="Resources\fa-regular-400.ttf" /> <BundleResource Include="Resources\fa-regular-400.ttf" />
<BundleResource Include="Resources\fa-solid-900.ttf" /> <BundleResource Include="Resources\fa-solid-900.ttf" />
@ -133,6 +131,9 @@
<ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular.png" /> <ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular.png" />
<ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular%402x.png" /> <ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular%402x.png" />
<ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular%403x.png" /> <ImageAsset Include="Assets.xcassets\IconYandereRegular.imageset\yandere-regular%403x.png" />
<BundleResource Include="Resources\logo_light.png" />
<BundleResource Include="Resources\logo_light%402x.png" />
<BundleResource Include="Resources\logo_light%403x.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -140,7 +141,6 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -155,6 +155,8 @@
<Folder Include="Assets.xcassets\IconSource.imageset\" /> <Folder Include="Assets.xcassets\IconSource.imageset\" />
<Folder Include="Assets.xcassets\IconYandereRegular.imageset\" /> <Folder Include="Assets.xcassets\IconYandereRegular.imageset\" />
<Folder Include="Assets.xcassets\IconSourceRegular.imageset\" /> <Folder Include="Assets.xcassets\IconSourceRegular.imageset\" />
<Folder Include="Assets.xcassets\LaunchLogo.imageset\" />
<Folder Include="Assets.xcassets\LauncherLogo.imageset\" />
</ItemGroup> </ItemGroup>
<Import Project="..\Gallery.UI\Gallery.UI.projitems" Label="Shared" Condition="Exists('..\Gallery.UI\Gallery.UI.projitems')" /> <Import Project="..\Gallery.UI\Gallery.UI.projitems" Label="Shared" Condition="Exists('..\Gallery.UI\Gallery.UI.projitems')" />
<Import Project="..\Gallery.Share\Gallery.Share.projitems" Label="Shared" Condition="Exists('..\Gallery.Share\Gallery.Share.projitems')" /> <Import Project="..\Gallery.Share\Gallery.Share.projitems" Label="Shared" Condition="Exists('..\Gallery.Share\Gallery.Share.projitems')" />

View File

@ -33,9 +33,9 @@
<key>XSAppIconAssets</key> <key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string> <string>Assets.xcassets/AppIcon.appiconset</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.805</string> <string>1.0.811</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>2</string>
<key>UIAppFonts</key> <key>UIAppFonts</key>
<array> <array>
<string>fa-light-300.ttf</string> <string>fa-light-300.ttf</string>

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="X5k-f2-b5h">
<device id="retina6_0" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
@ -13,18 +17,21 @@
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/> <viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw"> <view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/> <rect key="frame" x="0.0" y="0.0" width="390" height="844"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="logo_light.png" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="59" y="356" width="60" height="60"/> <rect key="frame" x="165" y="392" width="60" height="60"/>
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/> <constraints>
<constraint firstAttribute="height" constant="60" id="41"/>
<constraint firstAttribute="width" constant="60" id="42"/>
</constraints>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/> <constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" id="39"/>
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/> <constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" id="40"/>
</constraints> </constraints>
</view> </view>
</viewController> </viewController>
@ -34,6 +41,9 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="Icon-60.png" width="180" height="180"/> <image name="logo_light.png" width="60" height="60"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources> </resources>
</document> </document>

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB