splash ui
This commit is contained in:
@@ -16,12 +16,7 @@ namespace Gallery
|
||||
public static PlatformCulture CurrentCulture { get; private set; }
|
||||
|
||||
public static Dictionary<string, System.DateTime> RefreshTimes { get; } = new();
|
||||
public static List<IGallerySource> GallerySources { get; } = new()
|
||||
{
|
||||
new Sources.Yandere.GallerySource(), // https://yande.re
|
||||
new Sources.Danbooru.GallerySource(), // https://danbooru.donmai.us
|
||||
new Sources.Gelbooru.GallerySource() // https://gelbooru.com
|
||||
};
|
||||
public static List<IGallerySource> GallerySources { get; private set; }
|
||||
|
||||
public App()
|
||||
{
|
||||
@@ -42,7 +37,7 @@ namespace Gallery
|
||||
private void InitPreference()
|
||||
{
|
||||
Config.Proxy = null;
|
||||
Config.DownloadThreads = Preferences.Get(Config.DownloadThreadsKey, 1);
|
||||
Config.DownloadThreads = Preferences.Get(Config.DownloadThreadsKey, 4);
|
||||
|
||||
var isProxied = Preferences.Get(Config.IsProxiedKey, false);
|
||||
if (isProxied)
|
||||
@@ -109,6 +104,14 @@ namespace Gallery
|
||||
protected override void OnStart()
|
||||
{
|
||||
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();
|
||||
|
||||
InitResource();
|
||||
@@ -117,6 +120,7 @@ namespace Gallery
|
||||
|
||||
protected override void OnSleep()
|
||||
{
|
||||
base.OnSleep();
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
|
@@ -57,7 +57,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:CircleImage Aspect="AspectFill" Source="xamarin_logo.png"
|
||||
<ui:CircleImage Aspect="AspectFill" Source="logo_light.png"
|
||||
HeightRequest="60" WidthRequest="60"
|
||||
VerticalOptions="Center"/>
|
||||
<Label Grid.Column="1" VerticalOptions="Center" FontAttributes="Bold"
|
||||
|
@@ -458,7 +458,7 @@ namespace Gallery.Resources.UI
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -468,11 +468,15 @@ namespace Gallery.Resources.UI
|
||||
if (item.PreviewImage == null && item.PreviewUrl != null)
|
||||
{
|
||||
item.PreviewImage = Definition.DownloadBackground;
|
||||
#if DEBUG
|
||||
System.Threading.Thread.Sleep(500);
|
||||
#else
|
||||
var image = Store.LoadPreviewImage(item.PreviewUrl, true, force: true).Result;
|
||||
if (image != null)
|
||||
{
|
||||
item.PreviewImage = image;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}, tagIndex: tag);
|
||||
|
@@ -185,7 +185,7 @@ namespace Gallery.Util
|
||||
var data = new byte[size];
|
||||
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];
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get, url))
|
||||
|
@@ -81,7 +81,7 @@ namespace Gallery.Util
|
||||
public const string ProxyHostKey = "proxy_host";
|
||||
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 AcceptLanguage = "zh-cn";
|
||||
public const string AcceptImage = "image/png,image/*,*/*;q=0.8";
|
||||
|
Reference in New Issue
Block a user