Close #559, add subscription
This commit is contained in:
1 parent
94db37c899
commit
d463cf2295
11 files changed
+79
-3
No files matched your search
@@ -64,6 +64,9 @@ public class EhUrl {
|
||||
public static final String MY_TAGS_E = HOST_E + "mytags";
|
||||
public static final String MY_TAGS_EX = HOST_EX + "mytags";
|
||||
|
||||
public static final String WATCHED_E = HOST_E + "watched";
|
||||
public static final String WATCHED_EX = HOST_EX + "watched";
|
||||
|
||||
private static final String URL_PREFIX_THUMB_E = "https://ul.ehgt.org/";
|
||||
private static final String URL_PREFIX_THUMB_EX = "https://exhentai.org/t/";
|
||||
|
||||
@@ -190,6 +193,17 @@ public class EhUrl {
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getWatchedUrl() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
case SITE_E:
|
||||
return WATCHED_E;
|
||||
case SITE_EX:
|
||||
return WATCHED_EX;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getThumbUrlPrefix() {
|
||||
switch (Settings.getGallerySite()) {
|
||||
default:
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.net.URLEncoder;
|
||||
|
||||
public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
|
||||
@IntDef({MODE_NORMAL, MODE_UPLOADER, MODE_TAG, MODE_WHATS_HOT, MODE_IMAGE_SEARCH})
|
||||
@IntDef({MODE_NORMAL, MODE_UPLOADER, MODE_TAG, MODE_WHATS_HOT, MODE_IMAGE_SEARCH, MODE_SUBSCRIPTION})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
private @interface Mode {}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
public static final int MODE_TAG = 0x2;
|
||||
public static final int MODE_WHATS_HOT = 0x3;
|
||||
public static final int MODE_IMAGE_SEARCH = 0x4;
|
||||
public static final int MODE_SUBSCRIPTION = 0x5;
|
||||
|
||||
public static final int DEFAULT_ADVANCE = AdvanceSearchTable.SNAME | AdvanceSearchTable.STAGS;
|
||||
public static final int DEFAULT_MIN_RATING = 2;
|
||||
@@ -442,8 +443,16 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
public String build() {
|
||||
switch (mMode) {
|
||||
default:
|
||||
case MODE_NORMAL: {
|
||||
UrlBuilder ub = new UrlBuilder(EhUrl.getHost());
|
||||
case MODE_NORMAL:
|
||||
case MODE_SUBSCRIPTION: {
|
||||
String url;
|
||||
if (mMode == MODE_NORMAL) {
|
||||
url = EhUrl.getHost();
|
||||
} else {
|
||||
url = EhUrl.getWatchedUrl();
|
||||
}
|
||||
|
||||
UrlBuilder ub = new UrlBuilder(url);
|
||||
if (mCategory != EhUtils.NONE) {
|
||||
ub.addQuery("f_cats", (~mCategory) & EhConfig.ALL_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -695,6 +695,11 @@ public final class MainActivity extends StageActivity
|
||||
args.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_HOMEPAGE);
|
||||
startSceneFirstly(new Announcer(GalleryListScene.class)
|
||||
.setArgs(args));
|
||||
} else if (id == R.id.nav_subscription) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_SUBSCRIPTION);
|
||||
startSceneFirstly(new Announcer(GalleryListScene.class)
|
||||
.setArgs(args));
|
||||
} else if (id == R.id.nav_whats_hot) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_WHATS_HOT);
|
||||
|
||||
@@ -119,6 +119,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
public final static String KEY_ACTION = "action";
|
||||
public final static String ACTION_HOMEPAGE = "action_homepage";
|
||||
public final static String ACTION_SUBSCRIPTION = "action_subscription";
|
||||
public final static String ACTION_WHATS_HOT = "action_whats_hot";
|
||||
public final static String ACTION_LIST_URL_BUILDER = "action_list_url_builder";
|
||||
|
||||
@@ -232,7 +233,11 @@ public final class GalleryListScene extends BaseScene
|
||||
String action = args.getString(KEY_ACTION);
|
||||
if (ACTION_HOMEPAGE.equals(action)) {
|
||||
mUrlBuilder.reset();
|
||||
} else if (ACTION_SUBSCRIPTION.equals(action)) {
|
||||
mUrlBuilder.reset();
|
||||
mUrlBuilder.setMode(ListUrlBuilder.MODE_SUBSCRIPTION);
|
||||
} else if (ACTION_WHATS_HOT.equals(action)) {
|
||||
mUrlBuilder.reset();
|
||||
mUrlBuilder.setMode(ListUrlBuilder.MODE_WHATS_HOT);
|
||||
} else if (ACTION_LIST_URL_BUILDER.equals(action)) {
|
||||
ListUrlBuilder builder = args.getParcelable(KEY_LIST_URL_BUILDER);
|
||||
@@ -416,6 +421,8 @@ public final class GalleryListScene extends BaseScene
|
||||
EhUtils.NONE == category &&
|
||||
TextUtils.isEmpty(keyword)) {
|
||||
return resources.getString(appName ? R.string.app_name : R.string.homepage);
|
||||
} else if (ListUrlBuilder.MODE_SUBSCRIPTION == urlBuilder.getMode()) {
|
||||
return resources.getString(R.string.subscription);
|
||||
} else if (ListUrlBuilder.MODE_WHATS_HOT == urlBuilder.getMode()) {
|
||||
return resources.getString(R.string.whats_hot);
|
||||
} else if (!TextUtils.isEmpty(keyword)) {
|
||||
@@ -459,6 +466,8 @@ public final class GalleryListScene extends BaseScene
|
||||
EhUtils.NONE == category &&
|
||||
TextUtils.isEmpty(keyword)) {
|
||||
checkedItemId = R.id.nav_homepage;
|
||||
} else if (ListUrlBuilder.MODE_SUBSCRIPTION == builder.getMode()) {
|
||||
checkedItemId = R.id.nav_subscription;
|
||||
} else if (ListUrlBuilder.MODE_WHATS_HOT == builder.getMode()) {
|
||||
checkedItemId = R.id.nav_whats_hot;
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/black"
|
||||
android:pathData="@string/pd_eh_subscription"/>
|
||||
|
||||
</vector>
|
||||
@@ -23,6 +23,11 @@
|
||||
android:title="@string/homepage"
|
||||
android:icon="@drawable/v_homepage_black_x24"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_subscription"
|
||||
android:title="@string/subscription"
|
||||
android:icon="@drawable/v_eh_subscription_black_x24"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_whats_hot"
|
||||
android:title="@string/whats_hot"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<string name="theme_black">黑色主题</string>
|
||||
|
||||
<string name="homepage">主页</string>
|
||||
<string name="subscription">订阅</string>
|
||||
<string name="whats_hot">热门</string>
|
||||
<string name="favourite">收藏</string>
|
||||
<string name="history">历史</string>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<string name="theme_black">黑色主題</string>
|
||||
|
||||
<string name="homepage">主頁</string>
|
||||
<string name="subscription">訂閲</string>
|
||||
<string name="whats_hot">熱門</string>
|
||||
<string name="favourite">收藏</string>
|
||||
<string name="history">歷史</string>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<string name="theme_black">黑色主題</string>
|
||||
|
||||
<string name="homepage">首頁</string>
|
||||
<string name="subscription">訂閱</string>
|
||||
<string name="whats_hot">熱門</string>
|
||||
<string name="favourite">收藏</string>
|
||||
<string name="history">歷史</string>
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<string name="pd_check" translatable="false">M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z</string>
|
||||
<string name="pd_reorder" translatable="false">M3,15H21V13H3V15M3,19H21V17H3V19M3,11H21V9H3V11M3,5V7H21V5H3Z</string>
|
||||
<string name="pd_file_image" translatable="false">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6,20H15L18,20V12L14,16L12,14L6,20M8,9A2,2 0 0,0 6,11A2,2 0 0,0 8,13A2,2 0 0,0 10,11A2,2 0 0,0 8,9Z</string>
|
||||
<string name="pd_eh_subscription" translatable="false">M20,8H4V6h16V8 M18,2H6v2h12V2 M20,10H4c-1.1,0-2,0.9-2,2v8c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2v-8C22,10.9,21.1,10,20,10zM11,14H7v1h4v2H7v1h4v2H5v-8h6V14z M19,20h-2v-3h-2v3h-2v-8h2v3h2v-3h2V20z</string>
|
||||
|
||||
<string name="pd_big_label" translatable="false">M12.88,2H4V11L14.97,22.14L24,13.1L12.88,2ZM7.26,5.26C7.96,4.58,9.06,4.58,9.74,5.26C10.42,5.96,10.42,7.06,9.74,7.74S7.94,8.42,7.26,7.74S6.58,5.94,7.26,5.26ZM14.98,19.3L8.76,12.95L14.88,6.83L21.18,13.11L14.98,19.31ZM11.6,21.56L10.23,23L0,12.74V5H2V11.9L11.6,21.56Z</string>
|
||||
<string name="pd_big_search" translatable="false">M20.46,14.65C21.86,16.15,20.31,18.6,18.32,17.87C19.78,17.57,20.79,16.37,20.46,14.65ZM4.32,17.87C6.32,18.6,7.86,16.17,6.46,14.65C6.79,16.38,5.78,17.55,4.32,17.87ZM16.87,4.3C16.6,3.56,15.87,3,15,3C13.7,3,12.7,4.24,13.1,5.58C14.2,5.18,15.44,4.48,16.87,4.31ZM24,16C24,18.76,21.76,21,19,21C14.96,21,14.84,16.88,12,16.88S9.04,21,5,21C2.24,21,0,18.76,0,16C0,13.87,1.53,11.43,3.94,7.18C5.84,3.81,8.69,5.92,10.76,6.58C11.54,6.85,12.41,6.88,13.24,6.58C15.3,5.92,18.14,3.81,20.06,7.18C22.46,11.43,24,13.88,24,16ZM8,16C8,14.35,6.65,13,5,13S2,14.35,2,16S3.35,19,5,19S8,17.65,8,16ZM13,14C13,13.45,12.55,13,12,13S11,13.45,11,14S11.45,15,12,15S13,14.55,13,14ZM22,16C22,14.35,20.65,13,19,13S16,14.35,16,16S17.35,19,19,19S22,17.65,22,16ZM9,3C8.14,3,7.4,3.55,7.13,4.3C8.56,4.48,9.79,5.2,10.9,5.58C11.3,4.24,10.3,3,9,3Z</string>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<string name="misc" translatable="false">MISC</string>
|
||||
|
||||
<string name="homepage">Homepage</string>
|
||||
<string name="subscription">Subscription</string>
|
||||
<string name="whats_hot">What\'s hot</string>
|
||||
<string name="favourite">Favourite</string>
|
||||
<string name="history">History</string>
|
||||
|
||||
Reference in new issue
Block a user