diff --git a/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/Contents.json b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/Contents.json
new file mode 100644
index 0000000..dcce229
--- /dev/null
+++ b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/Contents.json
@@ -0,0 +1,530 @@
+{
+ "images": [
+ {
+ "idiom": "universal"
+ },
+ {
+ "filename": "pixiv.png",
+ "scale": "1x",
+ "idiom": "universal"
+ },
+ {
+ "filename": "pixiv@2x.png",
+ "scale": "2x",
+ "idiom": "universal"
+ },
+ {
+ "filename": "pixiv@3x.png",
+ "scale": "3x",
+ "idiom": "universal"
+ },
+ {
+ "idiom": "iphone"
+ },
+ {
+ "scale": "1x",
+ "idiom": "iphone"
+ },
+ {
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "subtype": "retina4",
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "scale": "3x",
+ "idiom": "iphone"
+ },
+ {
+ "idiom": "ipad"
+ },
+ {
+ "scale": "1x",
+ "idiom": "ipad"
+ },
+ {
+ "scale": "2x",
+ "idiom": "ipad"
+ },
+ {
+ "idiom": "watch"
+ },
+ {
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{130,145}",
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{146,165}",
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "idiom": "mac"
+ },
+ {
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "idiom": "car"
+ },
+ {
+ "scale": "2x",
+ "idiom": "car"
+ },
+ {
+ "scale": "3x",
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "subtype": "retina4",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "watch"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{130,145}",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{146,165}",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "universal"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "subtype": "retina4",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "iphone"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "ipad"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "watch"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{130,145}",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "screenWidth": "{146,165}",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "watch"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "2x",
+ "idiom": "car"
+ },
+ {
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ],
+ "scale": "3x",
+ "idiom": "car"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
\ No newline at end of file
diff --git a/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv.png b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv.png
new file mode 100644
index 0000000..cf0812f
Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv.png differ
diff --git a/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@2x.png b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@2x.png
new file mode 100644
index 0000000..fedcabc
Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@2x.png differ
diff --git a/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@3x.png b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@3x.png
new file mode 100644
index 0000000..28b73cf
Binary files /dev/null and b/Pixiview.iOS/Assets.xcassets/LauncherLogo.imageset/pixiv@3x.png differ
diff --git a/Pixiview.iOS/Pixiview.iOS.csproj b/Pixiview.iOS/Pixiview.iOS.csproj
index e93e687..58f3b6b 100644
--- a/Pixiview.iOS/Pixiview.iOS.csproj
+++ b/Pixiview.iOS/Pixiview.iOS.csproj
@@ -125,6 +125,10 @@
false
+
+
+
+
@@ -150,6 +154,7 @@
+
diff --git a/Pixiview.iOS/Renderers/AppShellRenderer.cs b/Pixiview.iOS/Renderers/AppShellRenderer.cs
index 904a200..6575d51 100644
--- a/Pixiview.iOS/Renderers/AppShellRenderer.cs
+++ b/Pixiview.iOS/Renderers/AppShellRenderer.cs
@@ -92,12 +92,13 @@ namespace Pixiview.iOS.Renderers
tabBar.UnselectedItemTintColor = _defaultUnselectedTint;
}
+ [SuppressMessage("Code Notifications", "XI0002:Notifies you from using newer Apple APIs when targeting an older OS version", Justification = "")]
public void SetAppearance(UITabBarController controller, ShellAppearance appearance)
{
IShellAppearanceElement appearanceElement = appearance;
//var backgroundColor = appearanceElement.EffectiveTabBarBackgroundColor;
var unselectedColor = appearanceElement.EffectiveTabBarUnselectedColor;
- var titleColor = appearanceElement.EffectiveTabBarTitleColor;
+ var tintColor = appearanceElement.EffectiveTabBarForegroundColor; // appearanceElement.EffectiveTabBarTitleColor;
var tabBar = controller.TabBar;
//bool operatingSystemSupportsUnselectedTint = Forms.IsiOS10OrNewer;
@@ -115,12 +116,16 @@ namespace Pixiview.iOS.Renderers
//if (!backgroundColor.IsDefault)
// tabBar.BarTintColor = backgroundColor.ToUIColor();
- if (!UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
- {
- if (!titleColor.IsDefault)
- tabBar.TintColor = titleColor.ToUIColor();
- //if (operatingSystemSupportsUnselectedTint)
+ if (!tintColor.IsDefault)
+ tabBar.TintColor = tintColor.ToUIColor();
+ //if (operatingSystemSupportsUnselectedTint)
+ {
+ if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
+ {
+ //tabBar.UnselectedItemTintColor = UIColor.TertiaryLabelColor;
+ }
+ else
{
if (!unselectedColor.IsDefault)
tabBar.UnselectedItemTintColor = unselectedColor.ToUIColor();
diff --git a/Pixiview.iOS/Renderers/AppShellSection/AppShellSectionRootHeader.cs b/Pixiview.iOS/Renderers/AppShellSection/AppShellSectionRootHeader.cs
index bb1fb4a..663d910 100644
--- a/Pixiview.iOS/Renderers/AppShellSection/AppShellSectionRootHeader.cs
+++ b/Pixiview.iOS/Renderers/AppShellSection/AppShellSectionRootHeader.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Specialized;
using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
using CoreGraphics;
using Foundation;
using UIKit;
diff --git a/Pixiview.iOS/Resources/LaunchScreen.storyboard b/Pixiview.iOS/Resources/LaunchScreen.storyboard
index 3f84ee2..696c3e4 100644
--- a/Pixiview.iOS/Resources/LaunchScreen.storyboard
+++ b/Pixiview.iOS/Resources/LaunchScreen.storyboard
@@ -16,6 +16,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -23,4 +39,7 @@
+
+
+
\ No newline at end of file
diff --git a/Pixiview/AppShell.xaml b/Pixiview/AppShell.xaml
index e686802..1f8cfc5 100644
--- a/Pixiview/AppShell.xaml
+++ b/Pixiview/AppShell.xaml
@@ -8,8 +8,8 @@
xmlns:util="clr-namespace:Pixiview.Utils"
x:Class="Pixiview.AppShell"
BackgroundColor="{DynamicResource NavColor}"
- ForegroundColor="{DynamicResource MainTextColor}"
- TitleColor="{DynamicResource MainTextColor}"
+ ForegroundColor="{DynamicResource TintColor}"
+ TitleColor="{DynamicResource TextColor}"
UnselectedColor="{DynamicResource SubTextColor}">
diff --git a/Pixiview/Illust/FavoritesPage.xaml.cs b/Pixiview/Illust/FavoritesPage.xaml.cs
index 8dda895..7bd5c05 100644
--- a/Pixiview/Illust/FavoritesPage.xaml.cs
+++ b/Pixiview/Illust/FavoritesPage.xaml.cs
@@ -17,9 +17,9 @@ namespace Pixiview.Illust
protected override void OnAppearing()
{
- base.OnAppearing();
-
- StartLoad(true);
+ //base.OnAppearing();
+ loaded = false;
+ StartLoad();
}
protected override IEnumerable DoGetIllustList(IllustItem[] data, ICommand command)
@@ -33,12 +33,12 @@ namespace Pixiview.Illust
protected override IllustItem[] DoLoadIllustData(bool force)
{
- var favorites = Stores.LoadFavoritesIllusts();
+ var favorites = Stores.FavoriteObject;
if (favorites == null)
{
return null;
}
- return favorites.Illusts;
+ return favorites.Illusts.ToArray();
}
}
}
diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs
index af674df..fb6581f 100644
--- a/Pixiview/Illust/IllustCollectionPage.cs
+++ b/Pixiview/Illust/IllustCollectionPage.cs
@@ -15,7 +15,6 @@ namespace Pixiview.Illust
{
public interface IIllustCollectionPage
{
- List Favorites { get; }
IllustCollection IllustCollection { get; set; }
}
@@ -60,13 +59,13 @@ namespace Pixiview.Illust
set => SetValue(LoadingProperty, value);
}
- public List Favorites { get; } = new List();
+ #endregion
+
+ protected static bool IsUpdated { get; private set; } = true;
+
public IllustCollection IllustCollection { get; set; }
protected virtual bool IsFavoriteVisible => true;
-
- #endregion
-
protected Thickness totalBarOffset;
protected Thickness navigationBarOffset;
protected bool loaded;
@@ -79,12 +78,6 @@ namespace Pixiview.Illust
{
BindingContext = this;
commandIllustImageTapped = new Command(IllustImageTapped);
-
- var favorites = Stores.LoadFavoritesIllusts();
- if (favorites != null)
- {
- Favorites.AddRange(favorites.Illusts);
- }
}
private void IllustImageTapped(IllustItem illust)
@@ -97,22 +90,38 @@ namespace Pixiview.Illust
protected override void OnAppearing()
{
base.OnAppearing();
-
Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
+
+ if (IsUpdated || !loaded)
+ {
+ IsUpdated = false;
+ loaded = false;
+ StartLoad();
+ }
+ else if (IsFavoriteVisible)
+ {
+ var favorites = Stores.Favorites;
+ foreach (var item in IllustCollection)
+ {
+ item.IsFavorite = favorites.Any(i => i.Id == item.Id);
+ }
+ }
}
protected override void OnDisappearing()
{
- base.OnDisappearing();
-
Connectivity.ConnectivityChanged -= Connectivity_ConnectivityChanged;
+ base.OnDisappearing();
}
private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
{
if (e.NetworkAccess == NetworkAccess.Internet || e.NetworkAccess == NetworkAccess.ConstrainedInternet)
{
- StartLoad();
+ if (!loaded)
+ {
+ StartLoad(true);
+ }
}
}
@@ -293,7 +302,7 @@ namespace Pixiview.Illust
}
}
}
- .DynamicResource(BackgroundColorProperty, ThemeBase.SubColor);
+ .DynamicResource(BackgroundColorProperty, ThemeBase.CardBackgroundColor);
});
}
@@ -308,15 +317,20 @@ namespace Pixiview.Illust
Loading = false;
return;
}
+ if (force)
+ {
+ IsUpdated = true;
+ }
var data = DoGetIllustList(illustData, commandIllustImageTapped).Where(i => i != null);
var collection = new IllustCollection(data);
if (IsFavoriteVisible)
{
+ var favorites = Stores.Favorites;
foreach (var item in collection)
{
- item.IsFavorite = Favorites.Any(i => i.Id == item.Id);
+ item.IsFavorite = favorites.Any(i => i.Id == item.Id);
}
}
IllustCollection = collection;
@@ -404,7 +418,7 @@ namespace Pixiview.Illust
public class IllustFavorite
{
public DateTime LastFavoriteUtc { get; set; }
- public IllustItem[] Illusts { get; set; }
+ public List Illusts { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
diff --git a/Pixiview/Illust/MainPage.xaml.cs b/Pixiview/Illust/MainPage.xaml.cs
index 8951355..76bd2dc 100644
--- a/Pixiview/Illust/MainPage.xaml.cs
+++ b/Pixiview/Illust/MainPage.xaml.cs
@@ -14,11 +14,6 @@ namespace Pixiview.Illust
InitializeComponent();
}
- public override void OnLoad()
- {
- StartLoad();
- }
-
public override void OnUnload()
{
Illusts = IllustCollection.Empty;
diff --git a/Pixiview/Illust/RankingPage.xaml b/Pixiview/Illust/RankingPage.xaml
index d3d1f4a..ccee5e7 100644
--- a/Pixiview/Illust/RankingPage.xaml
+++ b/Pixiview/Illust/RankingPage.xaml
@@ -20,7 +20,7 @@
diff --git a/Pixiview/Illust/RankingPage.xaml.cs b/Pixiview/Illust/RankingPage.xaml.cs
index a652218..b55f4b7 100644
--- a/Pixiview/Illust/RankingPage.xaml.cs
+++ b/Pixiview/Illust/RankingPage.xaml.cs
@@ -28,11 +28,6 @@ namespace Pixiview.Illust
InitializeComponent();
}
- public override void OnLoad()
- {
- StartLoad();
- }
-
public override void OnUnload()
{
Illusts = IllustCollection.Empty;
diff --git a/Pixiview/Illust/RecommendsPage.xaml.cs b/Pixiview/Illust/RecommendsPage.xaml.cs
index 7eca300..5d7c55f 100644
--- a/Pixiview/Illust/RecommendsPage.xaml.cs
+++ b/Pixiview/Illust/RecommendsPage.xaml.cs
@@ -36,11 +36,6 @@ namespace Pixiview.Illust
InitializeComponent();
}
- public override void OnLoad()
- {
- StartLoad();
- }
-
public override void OnUnload()
{
Illusts = IllustCollection.Empty;
diff --git a/Pixiview/Illust/ViewIllustPage.xaml.cs b/Pixiview/Illust/ViewIllustPage.xaml.cs
index 11b46ef..1b866fd 100644
--- a/Pixiview/Illust/ViewIllustPage.xaml.cs
+++ b/Pixiview/Illust/ViewIllustPage.xaml.cs
@@ -68,9 +68,10 @@ namespace Pixiview.Illust
fontIconLove = (ImageSource)Application.Current.Resources[ThemeBase.FontIconLove];
fontIconNotLove = (ImageSource)Application.Current.Resources[ThemeBase.FontIconNotLove];
- if (page.Favorites != null)
+ var favorites = Stores.Favorites;
+ if (favorites != null)
{
- FavoriteIcon = page.Favorites.Any(i => i.Id == illust.Id)
+ FavoriteIcon = favorites.Any(i => i.Id == illust.Id)
? fontIconLove
: fontIconNotLove;
}
@@ -100,12 +101,7 @@ namespace Pixiview.Illust
if (collectionPage is IllustDataCollectionPage)
{
- var favorite = new IllustFavorite
- {
- LastFavoriteUtc = DateTime.UtcNow,
- Illusts = collectionPage.Favorites.ToArray()
- };
- Stores.SaveFavoritesIllusts(favorite);
+ Stores.SaveFavoritesIllusts();
}
Screen.SetHomeIndicatorAutoHidden(Shell.Current, false);
}
@@ -236,21 +232,23 @@ namespace Pixiview.Illust
private void Favorite_Clicked(object sender, EventArgs e)
{
- if (collectionPage.Favorites == null)
+ var favorites = Stores.Favorites;
+ if (favorites == null)
{
return;
}
- var index = collectionPage.Favorites.FindIndex(i => i.Id == IllustItem.Id);
+ var illust = IllustItem;
+ var index = favorites.FindIndex(i => i.Id == illust.Id);
if (index < 0)
{
- collectionPage.Favorites.Insert(0, IllustItem);
- IllustItem.IsFavorite = true;
+ illust.IsFavorite = true;
+ favorites.Insert(0, illust);
FavoriteIcon = fontIconLove;
}
else
{
- collectionPage.Favorites.RemoveAt(index);
- IllustItem.IsFavorite = false;
+ illust.IsFavorite = false;
+ favorites.RemoveAt(index);
FavoriteIcon = fontIconNotLove;
}
}
diff --git a/Pixiview/UI/Theme/DarkTheme.cs b/Pixiview/UI/Theme/DarkTheme.cs
index 5a8247c..2b7daa2 100644
--- a/Pixiview/UI/Theme/DarkTheme.cs
+++ b/Pixiview/UI/Theme/DarkTheme.cs
@@ -3,7 +3,7 @@ using Xamarin.Forms;
namespace Pixiview.UI.Theme
{
- public partial class DarkTheme : ThemeBase
+ public class DarkTheme : ThemeBase
{
private static DarkTheme _instance;
@@ -29,11 +29,10 @@ namespace Pixiview.UI.Theme
{
Add(StatusBarStyle, StatusBarStyles.WhiteText);
Add(WindowColor, Color.Black);
+ Add(TintColor, Color.FromRgb(0x00, 0x96, 0xfa));
Add(TextColor, Color.White);
Add(SubTextColor, Color.LightGray);
- Add(MainColor, Color.FromRgb(0x11, 0x11, 0x11));
- Add(MainTextColor, Color.White);
- Add(SubColor, Color.FromRgb(0x33, 0x33, 0x33));
+ Add(CardBackgroundColor, Color.FromRgb(0x33, 0x33, 0x33));
Add(MaskColor, Color.FromRgba(0xff, 0xff, 0xff, 0x50));
Add(NavColor, Color.Black);
Add(NavSelectedColor, Color.FromRgb(0x22, 0x22, 0x22));
diff --git a/Pixiview/UI/Theme/LightTheme.cs b/Pixiview/UI/Theme/LightTheme.cs
index 7cde795..cc67833 100644
--- a/Pixiview/UI/Theme/LightTheme.cs
+++ b/Pixiview/UI/Theme/LightTheme.cs
@@ -3,7 +3,7 @@ using Xamarin.Forms;
namespace Pixiview.UI.Theme
{
- public partial class LightTheme : ThemeBase
+ public class LightTheme : ThemeBase
{
private static LightTheme _instance;
@@ -29,13 +29,12 @@ namespace Pixiview.UI.Theme
{
Add(StatusBarStyle, StatusBarStyles.DarkText);
Add(WindowColor, Color.White);
+ Add(TintColor, Color.FromRgb(0x00, 0x96, 0xfa)); // 0x7f, 0x99, 0xc6
Add(TextColor, Color.Black);
Add(SubTextColor, Color.DimGray);
- Add(MainColor, Color.FromRgb(0xf0, 0xf0, 0xf0)); // Color.FromRgb(0x7f, 0x99, 0xc6)
- Add(MainTextColor, Color.Black);
- Add(SubColor, Color.FromRgb(0xf0, 0xf0, 0xf0)); // Color.FromRgb(0xfa, 0xfa, 0xf0)
+ Add(CardBackgroundColor, Color.FromRgb(0xfa, 0xfa, 0xf0));
Add(MaskColor, Color.FromRgba(0, 0, 0, 0x50));
- Add(NavColor, Color.FromRgb(0xee, 0xee, 0xee));
+ Add(NavColor, Color.FromRgb(0xf0, 0xf0, 0xf0));
Add(NavSelectedColor, Color.LightGray);
}
}
diff --git a/Pixiview/UI/Theme/ThemeBase.cs b/Pixiview/UI/Theme/ThemeBase.cs
index 901f61c..3c8a634 100644
--- a/Pixiview/UI/Theme/ThemeBase.cs
+++ b/Pixiview/UI/Theme/ThemeBase.cs
@@ -4,8 +4,6 @@ namespace Pixiview.UI.Theme
{
public class ThemeBase : ResourceDictionary
{
- 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);
@@ -18,11 +16,10 @@ namespace Pixiview.UI.Theme
public const string StatusBarStyle = nameof(StatusBarStyle);
public const string WindowColor = nameof(WindowColor);
+ public const string TintColor = nameof(TintColor);
public const string TextColor = nameof(TextColor);
public const string SubTextColor = nameof(SubTextColor);
- public const string MainColor = nameof(MainColor);
- public const string MainTextColor = nameof(MainTextColor);
- public const string SubColor = nameof(SubColor);
+ public const string CardBackgroundColor = nameof(CardBackgroundColor);
public const string MaskColor = nameof(MaskColor);
public const string NavColor = nameof(NavColor);
public const string NavSelectedColor = nameof(NavSelectedColor);
@@ -58,43 +55,19 @@ namespace Pixiview.UI.Theme
}
}
- var mainColor = (Color)this[MainTextColor];
+ var tintColor = (Color)this[TextColor];
+ var regularFontFamily = (string)this[IconRegularFontFamily];
var solidFontFamily = (string)this[IconSolidFontFamily];
- Add(TitleLabel, new Style(typeof(Label))
- {
- Setters =
- {
- new Setter { Property = View.VerticalOptionsProperty, Value = LayoutOptions.Center },
- new Setter { Property = View.HorizontalOptionsProperty, Value = LayoutOptions.Fill },
- new Setter { Property = Label.HorizontalTextAlignmentProperty, Value = TextAlignment.Center },
- new Setter { Property = Label.FontSizeProperty, Value = StyleDefinition.FontSizeTitle },
- new Setter { Property = Label.TextColorProperty, Value = mainColor }
- }
- });
-
- Add(TitleButton, new Style(typeof(Button))
- {
- Setters =
- {
- new Setter { Property = Button.BorderWidthProperty, Value = 0.0 },
- new Setter { Property = VisualElement.BackgroundColorProperty, Value = Color.Transparent },
- new Setter { Property = Button.FontFamilyProperty, Value = solidFontFamily },
- new Setter { Property = Button.FontSizeProperty, Value = StyleDefinition.FontSizeTitleIcon },
- new Setter { Property = Button.TextColorProperty, Value = mainColor }
- }
- });
-
-
- Add(FontIconUser, GetSolidIcon(StyleDefinition.IconUser, solidFontFamily, mainColor));
- Add(FontIconSparkles, GetSolidIcon(StyleDefinition.IconSparkles, solidFontFamily, mainColor));
- Add(FontIconOrder, GetSolidIcon(StyleDefinition.IconOrder, solidFontFamily, mainColor));
- Add(FontIconRefresh, GetSolidIcon(StyleDefinition.IconRefresh, solidFontFamily, mainColor));
+ Add(FontIconUser, GetSolidIcon(StyleDefinition.IconUser, solidFontFamily, tintColor));
+ Add(FontIconSparkles, GetSolidIcon(StyleDefinition.IconSparkles, solidFontFamily, tintColor));
+ Add(FontIconOrder, GetSolidIcon(StyleDefinition.IconOrder, solidFontFamily, tintColor));
+ Add(FontIconRefresh, GetSolidIcon(StyleDefinition.IconRefresh, solidFontFamily, tintColor));
Add(FontIconLove, GetSolidIcon(StyleDefinition.IconLove, solidFontFamily, StyleDefinition.ColorRedBackground));
- Add(FontIconNotLove, GetSolidIcon(StyleDefinition.IconLove, (string)this[IconRegularFontFamily], mainColor));
- Add(FontIconOption, GetSolidIcon(StyleDefinition.IconOption, solidFontFamily, mainColor));
- Add(FontIconDownload, GetSolidIcon(StyleDefinition.IconDownload, solidFontFamily, mainColor));
- Add(FontIconFavorite, GetSolidIcon(StyleDefinition.IconFavorite, solidFontFamily, mainColor));
+ Add(FontIconNotLove, GetSolidIcon(StyleDefinition.IconLove, regularFontFamily, tintColor));
+ Add(FontIconOption, GetSolidIcon(StyleDefinition.IconOption, solidFontFamily, tintColor));
+ Add(FontIconDownload, GetSolidIcon(StyleDefinition.IconDownload, solidFontFamily, tintColor));
+ Add(FontIconFavorite, GetSolidIcon(StyleDefinition.IconFavorite, solidFontFamily, tintColor));
}
private FontImageSource GetSolidIcon(string icon, string family, Color color)
diff --git a/Pixiview/Utils/Stores.cs b/Pixiview/Utils/Stores.cs
index ac7f4d3..d826ffa 100644
--- a/Pixiview/Utils/Stores.cs
+++ b/Pixiview/Utils/Stores.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
@@ -11,7 +12,7 @@ using Xamarin.Forms;
namespace Pixiview.Utils
{
- public class Stores
+ public static class Stores
{
public static readonly string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
public static readonly string CacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
@@ -43,6 +44,48 @@ namespace Pixiview.Utils
}
}
+ private static IllustFavorite favoriteObject;
+ public static IllustFavorite FavoriteObject
+ {
+ get
+ {
+ lock (sync)
+ {
+ if (favoriteObject == null)
+ {
+ var favorites = LoadFavoritesIllusts();
+ if (favorites != null)
+ {
+ favoriteObject = favorites;
+ }
+ }
+ return favoriteObject;
+ }
+ }
+ }
+
+ public static List Favorites => FavoriteObject.Illusts;
+
+ private static IllustFavorite LoadFavoritesIllusts()
+ {
+ var file = Path.Combine(PersonalFolder, favoriteFile);
+ lock (sync)
+ {
+ return ReadObject(file);
+ }
+ }
+
+ public static void SaveFavoritesIllusts()
+ {
+ var file = Path.Combine(PersonalFolder, favoriteFile);
+ lock (sync)
+ {
+ var data = FavoriteObject;
+ data.LastFavoriteUtc = DateTime.UtcNow;
+ WriteObject(file, data);
+ }
+ }
+
private static T LoadObject(string file, string url, string referer = null, bool force = false)
{
string content = null;
@@ -179,24 +222,6 @@ namespace Pixiview.Utils
return result;
}
- public static IllustFavorite LoadFavoritesIllusts()
- {
- var file = Path.Combine(PersonalFolder, favoriteFile);
- lock (sync)
- {
- return ReadObject(file);
- }
- }
-
- public static void SaveFavoritesIllusts(IllustFavorite data)
- {
- var file = Path.Combine(PersonalFolder, favoriteFile);
- lock (sync)
- {
- WriteObject(file, data);
- }
- }
-
public static ImageSource LoadIllustImage(string url)
{
return LoadImage(url, PersonalFolder, imageFolder);