feature: remember favorite type and add non r-18

This commit is contained in:
Tsanie Lily 2020-05-24 12:56:17 +08:00
parent 185aa95ab2
commit 4da7f4d101
6 changed files with 21 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.523" package="org.tsanie.pixiview" android:versionCode="12">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.524" package="org.tsanie.pixiview" android:versionCode="13">
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28" />
<application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -29,8 +29,8 @@
<string>com.apple.share-services</string>
</dict>
<key>CFBundleShortVersionString</key>
<string>1.0.523</string>
<string>1.0.524</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
</dict>
</plist>

View File

@ -79,8 +79,8 @@
</dict>
</array>
<key>CFBundleShortVersionString</key>
<string>1.0.523</string>
<string>1.0.524</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
</dict>
</plist>

View File

@ -70,6 +70,7 @@
TintColor="{DynamicResource CardBackgroundColor}">
<u:SegmentedControl.Children>
<u:SegmentedControlOption Text="{r:Text All}"/>
<u:SegmentedControlOption Text="{r:Text General}"/>
<u:SegmentedControlOption Text="{r:Text Animation}"/>
<u:SegmentedControlOption Text="{r:Text Online}"/>
</u:SegmentedControl.Children>

View File

@ -42,6 +42,7 @@ namespace Pixiview.Illust
gridFilter.TranslationY = -60;
panelFilter.TranslationY = -60;
SegmentType = Preferences.Get(Configs.FavoriteTypeKey, 0);
startIndex = -1;
nextIndex = 0;
}
@ -68,6 +69,14 @@ namespace Pixiview.Illust
}
}
protected override void OnDisappearing()
{
base.OnDisappearing();
// saving state
Preferences.Set(Configs.FavoriteTypeKey, SegmentType);
}
public override void OnUnload()
{
if (task != null)
@ -103,10 +112,13 @@ namespace Pixiview.Illust
}
switch (SegmentType)
{
case 1: // animation
case 1: // general (non r-18)
favs = favs.Where(f => !f.IsRestrict);
break;
case 2: // animation
favs = favs.Where(f => f.IllustType == IllustType.Anime);
break;
case 2: // online
case 3: // online
favs = favs.Where(f => f.BookmarkId != null);
break;
}

View File

@ -718,6 +718,7 @@ namespace Pixiview.Utils
public const string QueryModeKey = "query_mode";
public const string QueryTypeKey = "query_type";
public const string QueryDateKey = "query_date";
public const string FavoriteTypeKey = "favorite_type";
public const int MaxPageThreads = 3;
public const int MaxThreads = 4;