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 {
|
||||
|
||||
Reference in new issue
Block a user