Compare commits

...
32 Commits
Author SHA1 Message Date
seven332 5fc0fb997a 1.6.0 2019-03-22 02:09:29 +08:00
seven332 aa01ddd594 Disable ChangeImageTransform on Android 5 2019-03-22 02:08:05 +08:00
seven332 8774268adf Check map null 2019-03-22 01:27:02 +08:00
seven332 265cbd0df5 Add GalleryInfoContentHelper to hold a data map 2019-03-22 01:19:40 +08:00
seven332 82cdfeb1b2 Remove gallery from local favourites in CommonOperations.removeFromFavorites() 2019-03-22 01:17:49 +08:00
seven332 71dd9d3693 Remove download listener and favourite listener in GalleryListScene.onDestroy() 2019-03-21 23:57:14 +08:00
seven332 fd9f1bd219 Add FavouriteStatusRouter to forward the favourite status 2019-03-21 23:17:09 +08:00
seven332 956b7455a3 Notify download status on GalleryListScene 2019-03-21 21:41:45 +08:00
seven332 b3c855a5dc Enrich gallery list item menu 2019-03-21 21:26:36 +08:00
seven332 06e624a1e3 Remove EhFilter 2019-03-21 20:38:21 +08:00
seven332 871c0a43ca Add disable default filters options 2019-03-21 20:19:00 +08:00
seven332 6775246d4c Add login tip for EHentai Setting and My Tags 2019-03-21 19:16:14 +08:00
seven332 a0b0109424 Switch to subscription search in subscription screen 2019-03-21 18:48:27 +08:00
seven332 c5566aa5e8 Add subscription search 2019-03-21 18:31:32 +08:00
seven332 1d70572d92 Add arrow icon callback on MyTagsActivity 2019-03-21 16:47:48 +08:00
seven332 5dc6446d64 Close #561, add launch page selector 2019-03-21 16:44:42 +08:00
seven332 13eb9e2f16 Add all cookie entries to CookieStore in WebViewSignIn 2019-03-21 15:47:09 +08:00
seven332 7e1e4a0f57 Only show tips for subscription if no watched tags 2019-03-21 15:30:33 +08:00
seven332 c0933eb8f0 Add tips for subscription 2019-03-21 15:14:31 +08:00
seven332 a0e6a847ab Remove help route 2019-03-21 15:07:26 +08:00
seven332 23a7053597 Adjust EhUrl fields 2019-03-21 14:36:31 +08:00
seven332 d463cf2295 Close #559, add subscription 2019-03-21 14:33:28 +08:00
seven332 94db37c899 Hide IME after searching 2019-03-21 13:08:46 +08:00
seven332 94f6eecbc7 Add the entry of My Tags 2019-03-21 12:57:03 +08:00
seven332 c0f20ca975 Always apply Name, Tags and Note on favourite search 2019-03-21 10:06:13 +08:00
seven332 749f2610af Use switch string 2019-03-20 20:31:46 +08:00
seven332 a2a6422917 Parse page from and page to from url 2019-03-20 20:25:00 +08:00
seven332 df72243bb6 Add page from and page to 2019-03-20 19:00:38 +08:00
seven332 50c7a23566 Fix description about show_jpn_title and show_gallery_pages 2019-03-20 14:59:02 +08:00
seven332 1cbb725920 Add nextPage field to avoid require duplicate page 2019-03-20 14:30:49 +08:00
seven332 8b76eaa740 Remove duplicate galleries 2019-03-20 13:43:25 +08:00
seven332 65f320f8f7 Close #550, add language pattern for Japanese title 2019-03-20 11:07:18 +08:00
53 changed files with 1559 additions and 1198 deletions

No files matched your search

+2 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 28
versionCode 96
versionName "1.5.0"
versionCode 97
versionName "1.6.0"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
"es", "ja", "ko", "fr", "de", "th"
+6 -6
View File
@@ -152,12 +152,6 @@
android:theme="@style/AppTheme.Toolbar"
android:label="@string/license"/>
<activity
android:name="com.hippo.ehviewer.ui.FilterActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/filter"/>
<activity
android:name="com.hippo.ehviewer.ui.SetSecurityActivity"
android:configChanges="screenSize|uiMode"
@@ -170,6 +164,12 @@
android:theme="@style/AppTheme.Toolbar"
android:label="@string/u_config"/>
<activity
android:name="com.hippo.ehviewer.ui.MyTagsActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/my_tags"/>
<activity
android:name="com.hippo.ehviewer.ui.HostsActivity"
android:configChanges="screenSize|uiMode"
@@ -92,6 +92,7 @@ public class EhApplication extends RecordingApplication {
private SimpleDiskCache mSpiderInfoCache;
private DownloadManager mDownloadManager;
private Hosts mHosts;
private FavouriteStatusRouter mFavouriteStatusRouter;
private final List<Activity> mActivityList = new ArrayList<>();
@@ -342,6 +343,12 @@ public class EhApplication extends RecordingApplication {
if (application.mGalleryDetailCache == null) {
// Max size 25, 3 min timeout
application.mGalleryDetailCache = new LruCache<>(25);
application.mFavouriteStatusRouter.addListener((gid, slot) -> {
GalleryDetail gd = application.mGalleryDetailCache.get(gid);
if (gd != null) {
gd.favoriteSlot = slot;
}
});
}
return application.mGalleryDetailCache;
}
@@ -379,6 +386,20 @@ public class EhApplication extends RecordingApplication {
return application.mHosts;
}
@NonNull
public static FavouriteStatusRouter getFavouriteStatusRouter() {
return getFavouriteStatusRouter(getInstance());
}
@NonNull
public static FavouriteStatusRouter getFavouriteStatusRouter(@NonNull Context context) {
EhApplication application = ((EhApplication) context.getApplicationContext());
if (application.mFavouriteStatusRouter == null) {
application.mFavouriteStatusRouter = new FavouriteStatusRouter();
}
return application.mFavouriteStatusRouter;
}
@NonNull
public static String getDeveloperEmail() {
return "ehviewersu$gmail.com".replace('$', '@');
+20 -5
View File
@@ -89,10 +89,9 @@ public class EhDB {
private static void upgradeDB(SQLiteDatabase db, int oldVersion) {
switch (oldVersion) {
case 1: // 1 to 2
case 1: // 1 to 2, add FILTER
FilterDao.createTable(db, true);
break;
case 2: // add ENABLE column to table FILTER
case 2: // 2 to 3, add ENABLE column to table FILTER
db.execSQL("CREATE TABLE " + "\"FILTER2\" (" +
"\"_id\" INTEGER PRIMARY KEY ," +
"\"MODE\" INTEGER NOT NULL ," +
@@ -102,8 +101,24 @@ public class EhDB {
"_id, MODE, TEXT, ENABLE)" +
"SELECT _id, MODE, TEXT, 1 FROM FILTER;");
db.execSQL("DROP TABLE FILTER");
db.execSQL("ALTER TABLE FILTER2 RENAME TO FILTER");
break;
db.execSQL("ALTER TABLE FILTER2 RENAME TO FILTER");
case 3: // 3 to 4, add PAGE_FROM and PAGE_TO column to QUICK_SEARCH
db.execSQL("CREATE TABLE " + "\"QUICK_SEARCH2\" (" +
"\"_id\" INTEGER PRIMARY KEY ," +
"\"NAME\" TEXT," +
"\"MODE\" INTEGER NOT NULL ," +
"\"CATEGORY\" INTEGER NOT NULL ," +
"\"KEYWORD\" TEXT," +
"\"ADVANCE_SEARCH\" INTEGER NOT NULL ," +
"\"MIN_RATING\" INTEGER NOT NULL ," +
"\"PAGE_FROM\" INTEGER NOT NULL ," +
"\"PAGE_TO\" INTEGER NOT NULL ," +
"\"TIME\" INTEGER NOT NULL );");
db.execSQL("INSERT INTO \"QUICK_SEARCH2\" (" +
"_id, NAME, MODE, CATEGORY, KEYWORD, ADVANCE_SEARCH, MIN_RATING, PAGE_FROM, PAGE_TO, TIME)" +
"SELECT _id, NAME, MODE, CATEGORY, KEYWORD, ADVANCE_SEARCH, MIN_RATING, -1, -1, TIME FROM QUICK_SEARCH;");
db.execSQL("DROP TABLE QUICK_SEARCH");
db.execSQL("ALTER TABLE QUICK_SEARCH2 RENAME TO QUICK_SEARCH");
}
}
@@ -0,0 +1,72 @@
/*
* 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.
*/
package com.hippo.ehviewer;
import android.annotation.SuppressLint;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.yorozuya.IntIdGenerator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FavouriteStatusRouter {
private static final String KEY_DATA_MAP_NEXT_ID = "data_map_next_id";
private final IntIdGenerator idGenerator = new IntIdGenerator(Settings.getInt(KEY_DATA_MAP_NEXT_ID, 0));
@SuppressLint("UseSparseArrays")
private final HashMap<Integer, Map<Long, GalleryInfo>> maps = new HashMap<>();
private List<Listener> listeners = new ArrayList<>();
public int saveDataMap(Map<Long, GalleryInfo> map) {
int id = idGenerator.nextId();
maps.put(id, map);
Settings.putInt(KEY_DATA_MAP_NEXT_ID, idGenerator.nextId());
return id;
}
public Map<Long, GalleryInfo> restoreDataMap(int id) {
return maps.remove(id);
}
public void modifyFavourites(long gid, int slot) {
for (Map<Long, GalleryInfo> map : maps.values()) {
GalleryInfo info = map.get(gid);
if (info != null) {
info.favoriteSlot = slot;
}
}
for (Listener listener : listeners) {
listener.onModifyFavourites(gid, slot);
}
}
public void addListener(Listener listener) {
listeners.add(listener);
}
public void removeListener(Listener listener) {
listeners.remove(listener);
}
public interface Listener {
void onModifyFavourites(long gid, int slot);
}
}
@@ -28,6 +28,7 @@ import com.hippo.ehviewer.client.EhConfig;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.FavListUrlBuilder;
import com.hippo.ehviewer.ui.CommonOperations;
import com.hippo.ehviewer.ui.scene.GalleryListScene;
import com.hippo.glgallery.GalleryView;
import com.hippo.unifile.UniFile;
import com.hippo.util.ExceptionUtils;
@@ -278,6 +279,22 @@ public class Settings {
putIntToStr(KEY_GALLERY_SITE, value);
}
private static final String KEY_LAUNCH_PAGE = "launch_page";
private static final int DEFAULT_LAUNCH_PAGE = 0;
public static String getLaunchPageGalleryListSceneAction() {
int value = getIntFromStr(KEY_LAUNCH_PAGE, DEFAULT_LAUNCH_PAGE);
switch (value) {
default:
case 0:
return GalleryListScene.ACTION_HOMEPAGE;
case 1:
return GalleryListScene.ACTION_SUBSCRIPTION;
case 2:
return GalleryListScene.ACTION_WHATS_HOT;
}
}
public static final String KEY_LIST_MODE = "list_mode";
private static final int DEFAULT_LIST_MODE = 0;
@@ -82,11 +82,7 @@ public class EhEngine {
private static final Pattern PATTERN_NEED_HATH_CLIENT = Pattern.compile("(You must have a H@H client assigned to your account to use this feature\\.)");
public static EhFilter sEhFilter;
public static void initialize() {
sEhFilter = EhFilter.getInstance();
}
public static void initialize() { }
private static void doThrowException(Call call, int code, @Nullable Headers headers,
@Nullable String body, Throwable e) throws Throwable {
@@ -174,18 +170,6 @@ public class EhEngine {
}
private static void fillGalleryList(@Nullable EhClient.Task task, OkHttpClient okHttpClient, List<GalleryInfo> list, String url, boolean filter) throws Throwable {
// Filter title and uploader
if (filter) {
for (int i = 0, n = list.size(); i < n; i++) {
GalleryInfo info = list.get(i);
if (!sEhFilter.filterTitle(info) || !sEhFilter.filterUploader(info)) {
list.remove(i);
i--;
n--;
}
}
}
boolean hasTags = false;
boolean hasPages = false;
boolean hasRated = false;
@@ -201,25 +185,11 @@ public class EhEngine {
}
}
boolean needApi = (filter && sEhFilter.needTags() && !hasTags) ||
(Settings.getShowGalleryPages() && !hasPages) ||
hasRated;
boolean needApi = (Settings.getShowGalleryPages() && !hasPages) || hasRated;
if (needApi) {
fillGalleryListByApi(task, okHttpClient, list, url);
}
// Filter tag
if (filter) {
for (int i = 0, n = list.size(); i < n; i++) {
GalleryInfo info = list.get(i);
if (!sEhFilter.filterTag(info) || !sEhFilter.filterTagNamespace(info)) {
list.remove(i);
i--;
n--;
}
}
}
for (GalleryInfo info : list) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
@@ -1,282 +0,0 @@
/*
* Copyright 2016 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.
*/
package com.hippo.ehviewer.client;
import android.util.Log;
import com.hippo.ehviewer.EhDB;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.dao.Filter;
import java.util.ArrayList;
import java.util.List;
public final class EhFilter {
private static final String TAG = EhFilter.class.getSimpleName();
public static final int MODE_TITLE = 0;
public static final int MODE_UPLOADER = 1;
public static final int MODE_TAG = 2;
public static final int MODE_TAG_NAMESPACE = 3;
private final List<Filter> mTitleFilterList = new ArrayList<>();
private final List<Filter> mUploaderFilterList = new ArrayList<>();
private final List<Filter> mTagFilterList = new ArrayList<>();
private final List<Filter> mTagNamespaceFilterList = new ArrayList<>();
private static EhFilter sInstance;
public static EhFilter getInstance() {
if (sInstance == null) {
sInstance = new EhFilter();
}
return sInstance;
}
private EhFilter() {
List<Filter> list = EhDB.getAllFilter();
for (int i = 0, n = list.size(); i < n; i++) {
Filter filter = list.get(i);
switch (filter.mode) {
case MODE_TITLE:
filter.text = filter.text.toLowerCase();
mTitleFilterList.add(filter);
break;
case MODE_UPLOADER:
mUploaderFilterList.add(filter);
break;
case MODE_TAG:
filter.text = filter.text.toLowerCase();
mTagFilterList.add(filter);
break;
case MODE_TAG_NAMESPACE:
filter.text = filter.text.toLowerCase();
mTagNamespaceFilterList.add(filter);
break;
default:
Log.d(TAG, "Unknown mode: " + filter.mode);
break;
}
}
}
public List<Filter> getTitleFilterList() {
return mTitleFilterList;
}
public List<Filter> getUploaderFilterList() {
return mUploaderFilterList;
}
public List<Filter> getTagFilterList() {
return mTagFilterList;
}
public List<Filter> getTagNamespaceFilterList() {
return mTagNamespaceFilterList;
}
public synchronized void addFilter(Filter filter) {
// enable filter by default before it is added to database
filter.enable = true;
EhDB.addFilter(filter);
switch (filter.mode) {
case MODE_TITLE:
filter.text = filter.text.toLowerCase();
mTitleFilterList.add(filter);
break;
case MODE_UPLOADER:
mUploaderFilterList.add(filter);
break;
case MODE_TAG:
filter.text = filter.text.toLowerCase();
mTagFilterList.add(filter);
break;
case MODE_TAG_NAMESPACE:
filter.text = filter.text.toLowerCase();
mTagNamespaceFilterList.add(filter);
break;
default:
Log.d(TAG, "Unknown mode: " + filter.mode);
break;
}
}
public synchronized void triggerFilter(Filter filter) {
EhDB.triggerFilter(filter);
}
public synchronized void deleteFilter(Filter filter) {
EhDB.deleteFilter(filter);
switch (filter.mode) {
case MODE_TITLE:
mTitleFilterList.remove(filter);
break;
case MODE_UPLOADER:
mUploaderFilterList.remove(filter);
break;
case MODE_TAG:
mTagFilterList.remove(filter);
break;
case MODE_TAG_NAMESPACE:
mTagNamespaceFilterList.remove(filter);
break;
default:
Log.d(TAG, "Unknown mode: " + filter.mode);
break;
}
}
public synchronized boolean needTags() {
return 0 != mTagFilterList.size() || 0 != mTagNamespaceFilterList.size();
}
public synchronized boolean filterTitle(GalleryInfo info) {
if (null == info) {
return false;
}
// Title
String title = info.title;
List<Filter> filters = mTitleFilterList;
if (null != title && filters.size() > 0) {
title = title.toLowerCase();
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).enable && title.contains(filters.get(i).text)) {
return false;
}
}
}
return true;
}
public synchronized boolean filterUploader(GalleryInfo info) {
if (null == info) {
return false;
}
// Uploader
String uploader = info.uploader;
List<Filter> filters = mUploaderFilterList;
if (null != uploader && filters.size() > 0) {
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).enable && uploader.equals(filters.get(i).text)) {
return false;
}
}
}
return true;
}
private boolean matchTag(String tag, String filter) {
if (null == tag || null == filter) {
return false;
}
String tagNamespace;
String tagName;
String filterNamespace;
String filterName;
int index = tag.indexOf(':');
if (index < 0) {
tagNamespace = null;
tagName = tag;
} else {
tagNamespace = tag.substring(0, index);
tagName = tag.substring(index + 1);
}
index = filter.indexOf(':');
if (index < 0) {
filterNamespace = null;
filterName = filter;
} else {
filterNamespace = filter.substring(0, index);
filterName = filter.substring(index + 1);
}
if (null != tagNamespace && null != filterNamespace &&
!tagNamespace.equals(filterNamespace)) {
return false;
}
if (!tagName.equals(filterName)) {
return false;
}
return true;
}
public synchronized boolean filterTag(GalleryInfo info) {
if (null == info) {
return false;
}
// Tag
String[] tags = info.simpleTags;
List<Filter> filters = mTagFilterList;
if (null != tags && filters.size() > 0) {
for (String tag: tags) {
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).enable && matchTag(tag, filters.get(i).text)) {
return false;
}
}
}
}
return true;
}
private boolean matchTagNamespace(String tag, String filter) {
if (null == tag || null == filter) {
return false;
}
String tagNamespace;
int index = tag.indexOf(':');
if (index >= 0) {
tagNamespace = tag.substring(0, index);
return tagNamespace.equals(filter);
} else {
return false;
}
}
public synchronized boolean filterTagNamespace(GalleryInfo info) {
if (null == info) {
return false;
}
String[] tags = info.simpleTags;
List<Filter> filters = mTagNamespaceFilterList;
if (null != tags && filters.size() > 0) {
for (String tag: tags) {
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).enable && matchTagNamespace(tag, filters.get(i).text)) {
return false;
}
}
}
}
return true;
}
}
@@ -58,8 +58,14 @@ public class EhUrl {
public static final String ORIGIN_EX = REFERER_EX;
public static final String ORIGIN_E = REFERER_E;
public static final String UCONFIG_E = HOST_E + "uconfig.php";
public static final String UCONFIG_EX = HOST_EX + "uconfig.php";
public static final String URL_UCONFIG_E = HOST_E + "uconfig.php";
public static final String URL_UCONFIG_EX = HOST_EX + "uconfig.php";
public static final String URL_MY_TAGS_E = HOST_E + "mytags";
public static final String URL_MY_TAGS_EX = HOST_EX + "mytags";
public static final String URL_WATCHED_E = HOST_E + "watched";
public static final String URL_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/";
@@ -122,9 +128,19 @@ public class EhUrl {
switch (Settings.getGallerySite()) {
default:
case SITE_E:
return UCONFIG_E;
return URL_UCONFIG_E;
case SITE_EX:
return UCONFIG_EX;
return URL_UCONFIG_EX;
}
}
public static String getMyTagsUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_E:
return URL_MY_TAGS_E;
case SITE_EX:
return URL_MY_TAGS_EX;
}
}
@@ -177,6 +193,17 @@ public class EhUrl {
}
}
@NonNull
public static String getWatchedUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_E:
return URL_WATCHED_E;
case SITE_EX:
return URL_WATCHED_EX;
}
}
public static String getThumbUrlPrefix() {
switch (Settings.getGallerySite()) {
default:
@@ -69,11 +69,18 @@ public class FavListUrlBuilder implements Parcelable {
UrlBuilder ub = new UrlBuilder(EhUrl.getFavoritesUrl());
if (isValidFavCat(mFavCat)) {
ub.addQuery("favcat", Integer.toString(mFavCat));
} else if (mFavCat == FAV_CAT_ALL) {
ub.addQuery("favcat", "all");
}
if (!TextUtils.isEmpty(mKeyword)) {
try {
ub.addQuery("f_search", URLEncoder.encode(mKeyword, "UTF-8"));
ub.addQuery("f_apply", "Search+Favorites");
// Name
ub.addQuery("sn", "on");
// Tags
ub.addQuery("st", "on");
// Note
ub.addQuery("sf", "on");
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "Can't URLEncoder.encode " + mKeyword);
}
@@ -61,21 +61,21 @@ public class GalleryInfo implements Parcelable {
};
public static final Pattern[] S_LANG_PATTERNS = {
Pattern.compile("[(\\[]eng(?:lish)?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]eng(?:lish)?[)\\]]|英訳", Pattern.CASE_INSENSITIVE),
// [((\[]ch(?:inese)?[))\]]|[汉漢]化|中[国國][语語]|中文|中国翻訳
Pattern.compile("[(\uFF08\\[]ch(?:inese)?[)\uFF09\\]]|[汉漢]化|中[国國][语語]|中文|中国翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]spanish[)\\]]|[(\\[]Español[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]korean?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]rus(?:sian)?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]fr(?:ench)?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]portuguese", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]thai(?: ภาษาไทย)?[)\\]]|แปลไทย", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]german[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]italiano?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]vietnamese(?: Tiếng Việt)?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]polish[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]hun(?:garian)?[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]dutch[)\\]]", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]spanish[)\\]]|[(\\[]Español[)\\]]|スペイン翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]korean?[)\\]]|韓国翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]rus(?:sian)?[)\\]]|ロシア翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]fr(?:ench)?[)\\]]|フランス翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]portuguese|ポルトガル翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]thai(?: ภาษาไทย)?[)\\]]|แปลไทย|タイ翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]german[)\\]]|ドイツ翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]italiano?[)\\]]|イタリア翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]vietnamese(?: Tiếng Việt)?[)\\]]|ベトナム翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]polish[)\\]]|ポーランド翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]hun(?:garian)?[)\\]]|ハンガリー翻訳", Pattern.CASE_INSENSITIVE),
Pattern.compile("[(\\[]dutch[)\\]]|オランダ翻訳", Pattern.CASE_INSENSITIVE),
};
public static final String[] S_LANG_TAGS = {
@@ -124,8 +124,6 @@ public class GalleryInfo implements Parcelable {
public int favoriteSlot = -2;
public String favoriteName;
public boolean downloaded;
public final void generateSLang() {
if (simpleTags != null) {
generateSLangFromTags();
@@ -182,7 +180,6 @@ public class GalleryInfo implements Parcelable {
dest.writeInt(this.spanGroupIndex);
dest.writeInt(this.favoriteSlot);
dest.writeString(this.favoriteName);
dest.writeByte(this.downloaded ? (byte) 1 : (byte) 0);
}
public GalleryInfo() {}
@@ -207,7 +204,6 @@ public class GalleryInfo implements Parcelable {
this.spanGroupIndex = in.readInt();
this.favoriteSlot = in.readInt();
this.favoriteName = in.readString();
this.downloaded = in.readByte() != 0;
}
public static final Parcelable.Creator<GalleryInfo> CREATOR = new Parcelable.Creator<GalleryInfo>() {
@@ -27,6 +27,7 @@ import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.dao.QuickSearch;
import com.hippo.ehviewer.widget.AdvanceSearchTable;
import com.hippo.network.UrlBuilder;
import com.hippo.yorozuya.NumberUtils;
import com.hippo.yorozuya.StringUtils;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Retention;
@@ -36,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 {}
@@ -46,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;
@@ -60,6 +62,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
private int mAdvanceSearch = -1;
private int mMinRating = -1;
private int mPageFrom = -1;
private int mPageTo = -1;
private String mImagePath;
private boolean mUseSimilarityScan;
@@ -76,6 +80,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
mKeyword = null;
mAdvanceSearch = -1;
mMinRating = -1;
mPageFrom = -1;
mPageTo = -1;
mImagePath = null;
mUseSimilarityScan = false;
mOnlySearchCovers = false;
@@ -140,6 +146,22 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
mMinRating = minRating;
}
public int getPageFrom() {
return mPageFrom;
}
public void setPageFrom(int pageFrom) {
mPageFrom = pageFrom;
}
public int getPageTo() {
return mPageTo;
}
public void setPageTo(int pageTo) {
mPageTo = pageTo;
}
@Nullable
public String getImagePath() {
return mImagePath;
@@ -184,6 +206,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
mKeyword = lub.mKeyword;
mAdvanceSearch = lub.mAdvanceSearch;
mMinRating = lub.mMinRating;
mPageFrom = lub.mPageFrom;
mPageTo = lub.mPageTo;
mImagePath = lub.mImagePath;
mUseSimilarityScan = lub.mUseSimilarityScan;
mOnlySearchCovers = lub.mOnlySearchCovers;
@@ -196,6 +220,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
mKeyword = q.keyword;
mAdvanceSearch = q.advanceSearch;
mMinRating = q.minRating;
mPageFrom = q.pageFrom;
mPageTo = q.pageTo;
mImagePath = null;
mUseSimilarityScan = false;
mOnlySearchCovers = false;
@@ -209,6 +235,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
q.keyword = mKeyword;
q.advanceSearch = mAdvanceSearch;
q.minRating = mMinRating;
q.pageFrom = mPageFrom;
q.pageTo = mPageTo;
return q;
}
@@ -232,6 +260,12 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
if (q.minRating != mMinRating) {
return false;
}
if (q.pageFrom != mPageFrom) {
return false;
}
if (q.pageTo != mPageTo) {
return false;
}
return true;
}
@@ -248,124 +282,166 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
}
String[] querys = StringUtils.split(query, '&');
boolean apply = false;
int category = 0;
String keyword = null;
boolean enableAdvanceSearch = false;
int advanceSearch = 0;
boolean enableMinRating = false;
int minRating = 0;
for (int i = 0, size = querys.length; i < size; i++) {
String str = querys[i];
int minRating = -1;
boolean enablePage = false;
int pageFrom = -1;
int pageTo = -1;
for (String str : querys) {
int index = str.indexOf('=');
if (index < 0) {
continue;
}
String key = str.substring(0, index);
String value = str.substring(index + 1);
if ("f_doujinshi".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.DOUJINSHI;
}
} else if ("f_manga".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.MANGA;
}
} else if ("f_artistcg".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.ARTIST_CG;
}
} else if ("f_gamecg".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.GAME_CG;
}
} else if ("f_western".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.WESTERN;
}
} else if ("f_non-h".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.NON_H;
}
} else if ("f_imageset".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.IMAGE_SET;
}
} else if ("f_cosplay".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.COSPLAY;
}
} else if ("f_asianporn".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.ASIAN_PORN;
}
} else if ("f_misc".equals(key)) {
if ("1".equals(value)) {
category |= EhConfig.MISC;
}
} else if ("f_search".equals(key)) {
try {
keyword = URLDecoder.decode(value, "utf-8");
} catch (UnsupportedEncodingException | IllegalArgumentException e) {
// Ignore
}
} else if ("advsearch".equals(key)) {
if ("1".equals(value)) {
enableAdvanceSearch = true;
}
} else if ("f_sname".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SNAME;
}
} else if ("f_stags".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STAGS;
}
} else if ("f_sdesc".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDESC;
}
} else if ("f_storr".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STORR;
}
} else if ("f_sto".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STO;
}
} else if ("f_sdt1".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDT1;
}
} else if ("f_sdt2".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDT2;
}
} else if ("f_sh".equals(key)) {
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SH;
}
} else if ("f_sr".equals(key)) {
if ("on".equals(value)) {
enableMinRating = true;
}
} else if ("f_srdd".equals(key)) {
try {
minRating = Integer.parseInt(value);
} catch (NumberFormatException e) {
// Ignore
}
} else if ("f_apply".equals(key)) {
if ("Apply+Filter".equals(value)) {
apply = true;
}
switch (key) {
case "f_cats":
int cats = NumberUtils.parseIntSafely(value, EhConfig.ALL_CATEGORY);
category |= (~cats) & EhConfig.ALL_CATEGORY;
break;
case "f_doujinshi":
if ("1".equals(value)) {
category |= EhConfig.DOUJINSHI;
}
break;
case "f_manga":
if ("1".equals(value)) {
category |= EhConfig.MANGA;
}
break;
case "f_artistcg":
if ("1".equals(value)) {
category |= EhConfig.ARTIST_CG;
}
break;
case "f_gamecg":
if ("1".equals(value)) {
category |= EhConfig.GAME_CG;
}
break;
case "f_western":
if ("1".equals(value)) {
category |= EhConfig.WESTERN;
}
break;
case "f_non-h":
if ("1".equals(value)) {
category |= EhConfig.NON_H;
}
break;
case "f_imageset":
if ("1".equals(value)) {
category |= EhConfig.IMAGE_SET;
}
break;
case "f_cosplay":
if ("1".equals(value)) {
category |= EhConfig.COSPLAY;
}
break;
case "f_asianporn":
if ("1".equals(value)) {
category |= EhConfig.ASIAN_PORN;
}
break;
case "f_misc":
if ("1".equals(value)) {
category |= EhConfig.MISC;
}
break;
case "f_search":
try {
keyword = URLDecoder.decode(value, "utf-8");
} catch (UnsupportedEncodingException | IllegalArgumentException e) {
// Ignore
}
break;
case "advsearch":
if ("1".equals(value)) {
enableAdvanceSearch = true;
}
break;
case "f_sname":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SNAME;
}
break;
case "f_stags":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STAGS;
}
break;
case "f_sdesc":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDESC;
}
break;
case "f_storr":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STORR;
}
break;
case "f_sto":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.STO;
}
break;
case "f_sdt1":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDT1;
}
break;
case "f_sdt2":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SDT2;
}
break;
case "f_sh":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SH;
}
break;
case "f_sfl":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SFL;
}
break;
case "f_sfu":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SFU;
}
break;
case "f_sft":
if ("on".equals(value)) {
advanceSearch |= AdvanceSearchTable.SFT;
}
break;
case "f_sr":
if ("on".equals(value)) {
enableMinRating = true;
}
break;
case "f_srdd":
minRating = NumberUtils.parseIntSafely(value, -1);
break;
case "f_sp":
if ("on".equals(value)) {
enablePage = true;
}
break;
case "f_spf":
pageFrom = NumberUtils.parseIntSafely(value, -1);
break;
case "f_spt":
pageTo = NumberUtils.parseIntSafely(value, -1);
break;
}
}
if (!apply) {
return;
}
mCategory = category;
mKeyword = keyword;
if (enableAdvanceSearch) {
@@ -375,6 +451,13 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
} else {
mMinRating = -1;
}
if (enablePage) {
mPageFrom = pageFrom;
mPageTo = pageTo;
} else {
mPageFrom = -1;
mPageTo = -1;
}
} else {
mAdvanceSearch = -1;
}
@@ -383,8 +466,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);
}
@@ -414,11 +505,20 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
if((mAdvanceSearch & AdvanceSearchTable.SDT1) != 0) ub.addQuery("f_sdt1", "on");
if((mAdvanceSearch & AdvanceSearchTable.SDT2) != 0) ub.addQuery("f_sdt2", "on");
if((mAdvanceSearch & AdvanceSearchTable.SH) != 0) ub.addQuery("f_sh", "on");
if((mAdvanceSearch & AdvanceSearchTable.SFL) != 0) ub.addQuery("f_sfl", "on");
if((mAdvanceSearch & AdvanceSearchTable.SFU) != 0) ub.addQuery("f_sfu", "on");
if((mAdvanceSearch & AdvanceSearchTable.SFT) != 0) ub.addQuery("f_sft", "on");
// Set min star
if (mMinRating != -1) {
ub.addQuery("f_sr", "on");
ub.addQuery("f_srdd", mMinRating);
}
// Pages
if (mPageFrom != -1 || mPageTo != -1) {
ub.addQuery("f_sp", "on");
ub.addQuery("f_spf", mPageFrom != -1 ? Integer.toString(mPageFrom) : "");
ub.addQuery("f_spt", mPageTo != -1 ? Integer.toString(mPageTo) : "");
}
}
return ub.build();
}
@@ -468,6 +568,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
dest.writeString(this.mKeyword);
dest.writeInt(this.mAdvanceSearch);
dest.writeInt(this.mMinRating);
dest.writeInt(this.mPageFrom);
dest.writeInt(this.mPageTo);
dest.writeString(this.mImagePath);
dest.writeByte(mUseSimilarityScan ? (byte) 1 : (byte) 0);
dest.writeByte(mOnlySearchCovers ? (byte) 1 : (byte) 0);
@@ -485,6 +587,8 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
this.mKeyword = in.readString();
this.mAdvanceSearch = in.readInt();
this.mMinRating = in.readInt();
this.mPageFrom = in.readInt();
this.mPageTo = in.readInt();
this.mImagePath = in.readString();
this.mUseSimilarityScan = in.readByte() != 0;
this.mOnlySearchCovers = in.readByte() != 0;
@@ -36,6 +36,7 @@ public class FavoritesParser {
public String[] catArray; // Size 10
public int[] countArray; // Size 10
public int pages;
public int nextPage;
public List<GalleryInfo> galleryInfoList;
}
@@ -71,6 +72,7 @@ public class FavoritesParser {
re.catArray = catArray;
re.countArray = countArray;
re.pages = result.pages;
re.nextPage = result.nextPage;
re.galleryInfoList = result.galleryInfoList;
return re;
@@ -18,7 +18,6 @@ package com.hippo.ehviewer.client.parser;
import android.util.Log;
import androidx.annotation.NonNull;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.EhDB;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryInfo;
@@ -46,6 +45,7 @@ public class GalleryListParser {
private static final Pattern PATTERN_THUMB_SIZE = Pattern.compile("height:(\\d+)px;width:(\\d+)px");
private static final Pattern PATTERN_FAVORITE_SLOT = Pattern.compile("background-color:rgba\\((\\d+),(\\d+),(\\d+),");
private static final Pattern PATTERN_PAGES = Pattern.compile("(\\d+) page");
private static final Pattern PATTERN_NEXT_PAGE = Pattern.compile("page=(\\d+)");
private static final String[][] FAVORITE_SLOT_RGB = new String[][] {
new String[] { "0", "0", "0"},
@@ -62,6 +62,8 @@ public class GalleryListParser {
public static class Result {
public int pages;
public int nextPage;
public boolean noWatchedTags;
public List<GalleryInfo> galleryInfoList;
}
@@ -253,9 +255,6 @@ public class GalleryListParser {
}
}
// Downloaded
gi.downloaded = EhApplication.getDownloadManager().containDownloadInfo(gi.gid);
gi.generateSLang();
return gi;
@@ -269,8 +268,18 @@ public class GalleryListParser {
Element ptt = d.getElementsByClass("ptt").first();
Elements es = ptt.child(0).child(0).children();
result.pages = Integer.parseInt(es.get(es.size() - 2).text().trim());
Element e = es.get(es.size() - 1);
if (e != null) {
String href = e.child(0).attr("href");
Matcher matcher = PATTERN_NEXT_PAGE.matcher(href);
if (matcher.find()) {
result.nextPage = Integer.parseInt(matcher.group(1));
}
}
} catch (Throwable e) {
ExceptionUtils.throwIfFatal(e);
result.noWatchedTags = body.contains("<p>You do not have any watched tags");
if (body.contains("No hits found</p>")) {
result.pages = 0;
//noinspection unchecked
@@ -0,0 +1,72 @@
/*
* 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.
*/
package com.hippo.ehviewer.preference;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.client.EhCookieStore;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.preference.ActivityPreference;
import okhttp3.HttpUrl;
public class SignInRequiredActivityPreference extends ActivityPreference {
private View view;
public SignInRequiredActivityPreference(Context context) {
super(context);
}
public SignInRequiredActivityPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SignInRequiredActivityPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected View onCreateView(ViewGroup parent) {
return view = super.onCreateView(parent);
}
@Override
protected void onClick() {
EhCookieStore store = EhApplication.getEhCookieStore(getContext());
HttpUrl e = HttpUrl.get(EhUrl.HOST_E);
HttpUrl ex = HttpUrl.get(EhUrl.HOST_EX);
if (store.contains(e, EhCookieStore.KEY_IPD_MEMBER_ID) ||
store.contains(e, EhCookieStore.KEY_IPD_PASS_HASH) ||
store.contains(ex, EhCookieStore.KEY_IPD_MEMBER_ID) ||
store.contains(ex, EhCookieStore.KEY_IPD_PASS_HASH)) {
super.onClick();
} else {
if (view != null) {
Snackbar.make(view, R.string.error_please_login_first, 3000).show();
} else {
Toast.makeText(getContext(), R.string.error_please_login_first, Toast.LENGTH_LONG).show();
}
}
}
}
@@ -33,7 +33,6 @@ import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.UrlOpener;
import com.hippo.ehviewer.client.EhClient;
import com.hippo.ehviewer.client.EhRequest;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.dao.DownloadLabel;
import com.hippo.ehviewer.download.DownloadManager;
@@ -219,17 +218,13 @@ public final class CommonOperations {
System.arraycopy(favCat, 0, items, 1, 10);
if (slot >= -1 && slot <= 9) {
String newFavoriteName = slot >= 0 ? items[slot + 1] : null;
doAddToFavorites(activity, galleryInfo, slot, galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, newFavoriteName)
: listener);
doAddToFavorites(activity, galleryInfo, slot, new DelegateFavoriteCallback(listener, galleryInfo, newFavoriteName, slot));
} else {
new ListCheckBoxDialogBuilder(activity, items,
(builder, dialog, position) -> {
int slot1 = position - 1;
String newFavoriteName = (slot1 >= 0 && slot1 <= 9) ? items[slot1+1] : null;
doAddToFavorites(activity, galleryInfo, slot1, galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, newFavoriteName)
: listener);
doAddToFavorites(activity, galleryInfo, slot1, new DelegateFavoriteCallback(listener, galleryInfo, newFavoriteName, slot1));
if (builder.isChecked()) {
Settings.putDefaultFavSlot(slot1);
} else {
@@ -244,33 +239,36 @@ public final class CommonOperations {
public static void removeFromFavorites(Activity activity, GalleryInfo galleryInfo,
final EhClient.Callback<Void> listener) {
EhDB.removeLocalFavorites(galleryInfo.gid);
EhClient client = EhApplication.getEhClient(activity);
EhRequest request = new EhRequest();
request.setMethod(EhClient.METHOD_ADD_FAVORITES);
request.setArgs(galleryInfo.gid, galleryInfo.token, -1, "");
request.setCallback(galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, null)
: listener);
request.setCallback(new DelegateFavoriteCallback(listener, galleryInfo, null, -2));
client.execute(request);
}
private static class UpdateFavoriteNameCallback implements EhClient.Callback<Void> {
private static class DelegateFavoriteCallback implements EhClient.Callback<Void> {
private final EhClient.Callback<Void> delegate;
private final GalleryDetail detail;
private final GalleryInfo info;
private final String newFavoriteName;
private final int slot;
UpdateFavoriteNameCallback(EhClient.Callback<Void> delegate, GalleryDetail detail,
String newFavoriteName) {
DelegateFavoriteCallback(EhClient.Callback<Void> delegate, GalleryInfo info,
String newFavoriteName, int slot) {
this.delegate = delegate;
this.detail = detail;
this.info = info;
this.newFavoriteName = newFavoriteName;
this.slot = slot;
}
@Override
public void onSuccess(Void result) {
detail.favoriteName = newFavoriteName;
info.favoriteName = newFavoriteName;
info.favoriteSlot = slot;
delegate.onSuccess(result);
EhApplication.getFavouriteStatusRouter().modifyFavourites(info.gid, slot);
}
@Override
@@ -1,474 +0,0 @@
/*
* Copyright 2016 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.
*/
package com.hippo.ehviewer.ui;
import android.content.DialogInterface;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.textfield.TextInputLayout;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.client.EhFilter;
import com.hippo.ehviewer.dao.Filter;
import com.hippo.util.DrawableManager;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.ViewUtils;
import java.util.List;
public class FilterActivity extends ToolbarActivity {
@Nullable
private EasyRecyclerView mRecyclerView;
@Nullable
private ViewTransition mViewTransition;
@Nullable
private FilterAdapter mAdapter;
@Nullable
private FilterList mFilterList;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_filter);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
mFilterList = new FilterList();
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(this, R.id.recycler_view);
TextView tip = (TextView) ViewUtils.$$(this, R.id.tip);
mViewTransition = new ViewTransition(mRecyclerView, tip);
Drawable drawable = DrawableManager.getVectorDrawable(this, R.drawable.big_filter);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
tip.setCompoundDrawables(null, drawable, null, null);
mAdapter = new FilterAdapter();
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setClipToPadding(false);
mRecyclerView.setClipChildren(false);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.hasFixedSize();
mRecyclerView.setItemAnimator(null);
updateView(false);
}
private void updateView(boolean animation) {
if (null == mViewTransition) {
return;
}
if (null == mFilterList || 0 == mFilterList.size()) {
mViewTransition.showView(1, animation);
} else {
mViewTransition.showView(0, animation);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mRecyclerView = null;
mViewTransition = null;
mAdapter = null;
mFilterList = null;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.activity_filter, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.action_add:
showAddFilterDialog();
return true;
case R.id.action_tip:
showTipDialog();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void showTipDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.filter)
.setMessage(R.string.filter_tip)
.show();
}
private void showAddFilterDialog() {
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(R.string.add_filter)
.setView(R.layout.dialog_add_filter)
.setPositiveButton(R.string.add, null)
.show();
AddFilterDialogHelper helper = new AddFilterDialogHelper();
helper.setDialog(dialog);
}
private void showDeleteFilterDialog(final Filter filter) {
int messageId;
switch (filter.mode) {
case EhFilter.MODE_TITLE:
messageId = R.string.delete_title_filter;
break;
case EhFilter.MODE_UPLOADER:
messageId = R.string.delete_uploader_filter;
break;
case EhFilter.MODE_TAG:
messageId = R.string.delete_tag_filter;
break;
default:
messageId = R.string.delete_filter;
}
String message = getString(messageId, filter.text);
new AlertDialog.Builder(this)
.setMessage(message)
.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (DialogInterface.BUTTON_POSITIVE != which || null == mFilterList) {
return;
}
mFilterList.delete(filter);
if (null != mAdapter) {
mAdapter.notifyDataSetChanged();
}
updateView(true);
}
}).show();
}
private class AddFilterDialogHelper implements View.OnClickListener {
@Nullable
private AlertDialog mDialog;
@Nullable
private Spinner mSpinner;
@Nullable
private TextInputLayout mInputLayout;
@Nullable
private EditText mEditText;
public void setDialog(AlertDialog dialog) {
mDialog = dialog;
mSpinner = (Spinner) ViewUtils.$$(dialog, R.id.spinner);
mInputLayout = (TextInputLayout) ViewUtils.$$(dialog, R.id.text_input_layout);
mEditText = mInputLayout.getEditText();
View button = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (null != button) {
button.setOnClickListener(this);
}
}
@Override
public void onClick(View v) {
if (null == mFilterList || null == mDialog || null == mSpinner ||
null == mInputLayout || null == mEditText) {
return;
}
String text = mEditText.getText().toString().trim();
if (TextUtils.isEmpty(text)) {
mInputLayout.setError(getString(R.string.text_is_empty));
return;
} else {
mInputLayout.setError(null);
}
int mode = mSpinner.getSelectedItemPosition();
Filter filter = new Filter();
filter.mode = mode;
filter.text = text;
mFilterList.add(filter);
if (null != mAdapter) {
mAdapter.notifyDataSetChanged();
}
updateView(true);
mDialog.dismiss();
mDialog = null;
mSpinner = null;
mInputLayout = null;
mEditText = null;
}
}
private class FilterHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private final TextView text;
private final ImageView icon;
public FilterHolder(View itemView) {
super(itemView);
text = (TextView) ViewUtils.$$(itemView, R.id.text);
icon = (ImageView) itemView.findViewById(R.id.icon);
if (null != icon) {
icon.setOnClickListener(this);
}
// click on the filter text to enable/disable it
text.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int position = getAdapterPosition();
if (position < 0 || null == mFilterList) {
return;
}
Filter filter = mFilterList.get(position);
if (FilterList.MODE_HEADER != filter.mode) {
if (v instanceof ImageView) {
showDeleteFilterDialog(filter);
} else if (v instanceof TextView) {
mFilterList.trigger(filter);
//for updating delete line on filter text
mAdapter.notifyItemChanged(getAdapterPosition());
}
}
}
}
private class FilterAdapter extends RecyclerView.Adapter<FilterHolder> {
private static final int TYPE_ITEM = 0;
private static final int TYPE_HEADER = 1;
@Override
public int getItemViewType(int position) {
if (null == mFilterList) {
return TYPE_ITEM;
}
if (mFilterList.get(position).mode == FilterList.MODE_HEADER) {
return TYPE_HEADER;
} else {
return TYPE_ITEM;
}
}
@Override
public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) {
int layoutId;
switch (viewType) {
default:
case TYPE_ITEM:
layoutId = R.layout.item_filter;
break;
case TYPE_HEADER:
layoutId = R.layout.item_filter_header;
break;
}
FilterHolder holder = new FilterHolder(getLayoutInflater().inflate(layoutId, parent, false));
if (R.layout.item_filter == layoutId) {
holder.icon.setImageDrawable(
DrawableManager.getVectorDrawable(FilterActivity.this, R.drawable.v_delete_x24));
}
return holder;
}
@Override
public void onBindViewHolder(FilterHolder holder, int position) {
if (null == mFilterList) {
return;
}
Filter filter = mFilterList.get(position);
if (FilterList.MODE_HEADER == filter.mode) {
holder.text.setText(filter.text);
} else {
holder.text.setText(filter.text);
// add a delete line if the filter is disabled
if (!filter.enable) {
holder.text.setPaintFlags(holder.text.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
holder.text.setPaintFlags(holder.text.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
}
}
}
@Override
public int getItemCount() {
return null != mFilterList ? mFilterList.size() : 0;
}
}
private class FilterList {
public static final int MODE_HEADER = -1;
private final EhFilter mEhFilter;
private final List<Filter> mTitleFilterList;
private final List<Filter> mUploaderFilterList;
private final List<Filter> mTagFilterList;
private final List<Filter> mTagNamespaceFilterList;
private Filter mTitleHeader;
private Filter mUploaderHeader;
private Filter mTagHeader;
private Filter mTagNamespaceHeader;
public FilterList() {
mEhFilter = EhFilter.getInstance();
mTitleFilterList = mEhFilter.getTitleFilterList();
mUploaderFilterList = mEhFilter.getUploaderFilterList();
mTagFilterList = mEhFilter.getTagFilterList();
mTagNamespaceFilterList = mEhFilter.getTagNamespaceFilterList();
}
public int size() {
int count = 0;
int size = mTitleFilterList.size();
count += 0 == size ? 0 : size + 1;
size = mUploaderFilterList.size();
count += 0 == size ? 0 : size + 1;
size = mTagFilterList.size();
count += 0 == size ? 0 : size + 1;
size = mTagNamespaceFilterList.size();
count += 0 == size ? 0 : size + 1;
return count;
}
private Filter getTitleHeader() {
if (null == mTitleHeader) {
mTitleHeader = new Filter();
mTitleHeader.mode = MODE_HEADER;
mTitleHeader.text = getString(R.string.filter_title);
}
return mTitleHeader;
}
private Filter getUploaderHeader() {
if (null == mUploaderHeader) {
mUploaderHeader = new Filter();
mUploaderHeader.mode = MODE_HEADER;
mUploaderHeader.text = getString(R.string.filter_uploader);
}
return mUploaderHeader;
}
private Filter getTagHeader() {
if (null == mTagHeader) {
mTagHeader = new Filter();
mTagHeader.mode = MODE_HEADER;
mTagHeader.text = getString(R.string.filter_tag);
}
return mTagHeader;
}
private Filter getTagNamespaceHeader() {
if (null == mTagNamespaceHeader) {
mTagNamespaceHeader = new Filter();
mTagNamespaceHeader.mode = MODE_HEADER;
mTagNamespaceHeader.text = getString(R.string.filter_tag_namespace);
}
return mTagNamespaceHeader;
}
public Filter get(int index) {
int size = mTitleFilterList.size();
if (0 != size) {
if (index == 0) {
return getTitleHeader();
} else if (index <= size) {
return mTitleFilterList.get(index - 1);
} else {
index -= size + 1;
}
}
size = mUploaderFilterList.size();
if (0 != size) {
if (index == 0) {
return getUploaderHeader();
} else if (index <= size) {
return mUploaderFilterList.get(index - 1);
} else {
index -= size + 1;
}
}
size = mTagFilterList.size();
if (0 != size) {
if (index == 0) {
return getTagHeader();
} else if (index <= size) {
return mTagFilterList.get(index - 1);
} else {
index -= size + 1;
}
}
size = mTagNamespaceFilterList.size();
if (0 != size) {
if (index == 0) {
return getTagNamespaceHeader();
} else if (index <= size) {
return mTagNamespaceFilterList.get(index - 1);
} else {
index -= size + 1;
}
}
throw new IndexOutOfBoundsException();
}
public void add(Filter filter) {
mEhFilter.addFilter(filter);
}
public void delete(Filter filter) {
mEhFilter.deleteFilter(filter);
}
public void trigger(Filter filter) {
mEhFilter.triggerFilter(filter);
}
}
}
@@ -175,7 +175,7 @@ public final class MainActivity extends StageActivity
return new Announcer(SelectSiteScene.class);
} else {
Bundle args = new Bundle();
args.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_HOMEPAGE);
args.putString(GalleryListScene.KEY_ACTION, Settings.getLaunchPageGalleryListSceneAction());
return new Announcer(GalleryListScene.class).setArgs(args);
}
}
@@ -309,7 +309,7 @@ public final class MainActivity extends StageActivity
finish();
} else {
Bundle args = new Bundle();
args.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_HOMEPAGE);
args.putString(GalleryListScene.KEY_ACTION, Settings.getLaunchPageGalleryListSceneAction());
startScene(processAnnouncer(new Announcer(GalleryListScene.class).setArgs(args)));
}
}
@@ -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);
@@ -0,0 +1,109 @@
/*
* 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.
*/
package com.hippo.ehviewer.ui;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.Nullable;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.client.EhCookieStore;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.widget.DialogWebChromeClient;
import com.hippo.widget.ProgressView;
import okhttp3.Cookie;
import okhttp3.HttpUrl;
public class MyTagsActivity extends ToolbarActivity {
private WebView webView;
private ProgressView progress;
private String url;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// http://stackoverflow.com/questions/32284642/how-to-handle-an-uncatched-exception
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.flush();
cookieManager.removeAllCookies(null);
cookieManager.removeSessionCookies(null);
} else {
CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(this);
cookieSyncManager.startSync();
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieSyncManager.stopSync();
}
// Copy cookies from okhttp cookie store to CookieManager
url = EhUrl.getMyTagsUrl();
EhCookieStore store = EhApplication.getEhCookieStore(this);
for (Cookie cookie : store.getCookies(HttpUrl.parse(url))) {
cookieManager.setCookie(url, cookie.toString());
}
setContentView(R.layout.activity_my_tags);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new MyTagsWebViewClient());
webView.setWebChromeClient(new DialogWebChromeClient(this));
webView.loadUrl(url);
progress = findViewById(R.id.progress);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private class MyTagsWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// Never load other urls
return !url.equals(MyTagsActivity.this.url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
progress.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view, String url) {
progress.setVisibility(View.GONE);
}
}
}
@@ -21,8 +21,6 @@ package com.hippo.ehviewer.ui;
*/
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@@ -31,20 +29,15 @@ import android.view.MenuItem;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.snackbar.Snackbar;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.client.EhCookieStore;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.widget.DialogWebChromeClient;
import com.hippo.widget.ProgressView;
import okhttp3.Cookie;
import okhttp3.HttpUrl;
@@ -87,7 +80,7 @@ public class UConfigActivity extends ToolbarActivity {
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new UConfigWebViewClient());
webView.setWebChromeClient(new UConfigWebChromeClient());
webView.setWebChromeClient(new DialogWebChromeClient(this));
webView.loadUrl(url);
progress = (ProgressView) findViewById(R.id.progress);
@@ -183,69 +176,4 @@ public class UConfigActivity extends ToolbarActivity {
loaded = true;
}
}
private class UConfigWebChromeClient extends WebChromeClient {
private Context context = UConfigActivity.this;
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
final JsPromptResult result) {
View promptView = UConfigActivity.this.getLayoutInflater()
.inflate(R.layout.dialog_js_prompt, null, false);
TextView messageView = (TextView) promptView.findViewById(R.id.message);
messageView.setText(message);
final EditText valueView = (EditText) promptView.findViewById(R.id.value);
valueView.setText(defaultValue);
new AlertDialog.Builder(context)
.setView(promptView)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.confirm(valueView.getText().toString());
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
result.cancel();
}
})
.show();
return true;
}
private void showMessageDialog(String message, final JsResult result) {
new AlertDialog.Builder(context)
.setMessage(message)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.confirm();
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
result.cancel();
}
})
.show();
}
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
showMessageDialog(message, result);
return true;
}
@Override
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
showMessageDialog(message, result);
return true;
}
}
}
@@ -72,6 +72,7 @@ import com.hippo.ehviewer.ui.annotation.DrawerLifeCircle;
import com.hippo.ehviewer.ui.annotation.ViewLifeCircle;
import com.hippo.ehviewer.ui.annotation.WholeLifeCircle;
import com.hippo.ehviewer.widget.EhDrawerLayout;
import com.hippo.ehviewer.widget.GalleryInfoContentHelper;
import com.hippo.ehviewer.widget.SearchBar;
import com.hippo.refreshlayout.RefreshLayout;
import com.hippo.ripple.Ripple;
@@ -395,6 +396,7 @@ public class FavoritesScene extends BaseScene implements
}
if (null != mHelper) {
mHelper.destroy();
if (1 == mHelper.getShownViewIndex()) {
mHasFirstRefresh = false;
}
@@ -879,7 +881,7 @@ public class FavoritesScene extends BaseScene implements
updateSearchBar();
mHelper.setPages(taskId, result.pages);
mHelper.onGetPageData(taskId, result.galleryInfoList);
mHelper.onGetPageData(taskId, result.nextPage, result.galleryInfoList);
if (mDrawerAdapter != null) {
mDrawerAdapter.notifyDataSetChanged();
@@ -906,10 +908,10 @@ public class FavoritesScene extends BaseScene implements
if (list.size() == 0) {
mHelper.setPages(taskId, 0);
mHelper.onGetPageData(taskId, Collections.EMPTY_LIST);
mHelper.onGetPageData(taskId, 0, Collections.EMPTY_LIST);
} else {
mHelper.setPages(taskId, 1);
mHelper.onGetPageData(taskId, list);
mHelper.onGetPageData(taskId, 0, list);
}
if (TextUtils.isEmpty(keyword)) {
@@ -1028,7 +1030,7 @@ public class FavoritesScene extends BaseScene implements
}
}
private class FavoritesHelper extends ContentLayout.ContentHelper<GalleryInfo> {
private class FavoritesHelper extends GalleryInfoContentHelper {
@Override
protected void getPageData(final int taskId, int type, int page) {
@@ -1143,6 +1145,11 @@ public class FavoritesScene extends BaseScene implements
}
}
@Override
protected boolean isDuplicate(GalleryInfo d1, GalleryInfo d2) {
return d1.gid == d2.gid;
}
@Override
protected void onScrollToPosition(int postion) {
if (0 == postion) {
@@ -31,11 +31,13 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.hippo.drawable.TriangleDrawable;
import com.hippo.easyrecyclerview.MarginItemDecoration;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhCacheKeyFactory;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.download.DownloadManager;
import com.hippo.ehviewer.widget.TileThumb;
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
import com.hippo.yorozuya.ViewUtils;
@@ -64,6 +66,8 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
private int mType = TYPE_INVALID;
private boolean mShowFavourited;
private DownloadManager mDownloadManager;
public GalleryAdapter(@NonNull LayoutInflater inflater, @NonNull Resources resources,
@NonNull RecyclerView recyclerView, int type, boolean showFavourited) {
mInflater = inflater;
@@ -82,6 +86,8 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
mListThumbWidth = mListThumbHeight * 2 / 3;
setType(type);
mDownloadManager = EhApplication.getDownloadManager(inflater.getContext());
}
private void adjustPaddings() {
@@ -213,7 +219,7 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
holder.simpleLanguage.setVisibility(View.VISIBLE);
}
holder.favourited.setVisibility((mShowFavourited && gi.favoriteSlot >= -1 && gi.favoriteSlot <= 10) ? View.VISIBLE : View.GONE);
holder.downloaded.setVisibility(gi.downloaded ? View.VISIBLE : View.GONE);
holder.downloaded.setVisibility(mDownloadManager.containDownloadInfo(gi.gid) ? View.VISIBLE : View.GONE);
break;
}
case TYPE_GRID: {
@@ -67,7 +67,6 @@ import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.UrlOpener;
import com.hippo.ehviewer.client.EhCacheKeyFactory;
import com.hippo.ehviewer.client.EhClient;
import com.hippo.ehviewer.client.EhFilter;
import com.hippo.ehviewer.client.EhRequest;
import com.hippo.ehviewer.client.EhTagDatabase;
import com.hippo.ehviewer.client.EhUrl;
@@ -81,7 +80,6 @@ import com.hippo.ehviewer.client.data.PreviewSet;
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
import com.hippo.ehviewer.client.parser.RateGalleryParser;
import com.hippo.ehviewer.dao.DownloadInfo;
import com.hippo.ehviewer.dao.Filter;
import com.hippo.ehviewer.ui.CommonOperations;
import com.hippo.ehviewer.ui.GalleryActivity;
import com.hippo.ehviewer.ui.MainActivity;
@@ -482,8 +480,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mDownload.setOnLongClickListener(this);
mRead.setOnClickListener(this);
mUploader.setOnLongClickListener(this);
mBelowHeader = mainView.findViewById(R.id.below_header);
View belowHeader = mBelowHeader;
@@ -1213,11 +1209,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
} else if (mHeartGroup == v) {
if (mGalleryDetail != null && !mModifingFavorites) {
boolean remove = false;
if (EhDB.containLocalFavorites(mGalleryDetail.gid)) {
EhDB.removeLocalFavorites(mGalleryDetail.gid);
remove = true;
}
if (mGalleryDetail.isFavorited) {
if (EhDB.containLocalFavorites(mGalleryDetail.gid) || mGalleryDetail.isFavorited) {
mModifingFavorites = true;
CommonOperations.removeFromFavorites(activity, mGalleryDetail,
new ModifyFavoritesListener(context,
@@ -1327,43 +1319,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
}
}
private void showBlockUploaderDialog() {
Context context = getContext2();
if (null == context) {
return;
}
final String uploader = getUploader();
if (null == uploader) {
return;
}
new AlertDialog.Builder(context)
.setMessage(getString(R.string.block_the_uploader, uploader))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (DialogInterface.BUTTON_POSITIVE != which) {
return;
}
Filter filter = new Filter();
filter.mode = EhFilter.MODE_UPLOADER;
filter.text = uploader;
EhFilter.getInstance().addFilter(filter);
showTip(R.string.filter_added, LENGTH_SHORT);
}
}).show();
}
private void addTagFilter(String tag) {
Filter filter = new Filter();
filter.mode = EhFilter.MODE_TAG;
filter.text = tag;
EhFilter.getInstance().addFilter(filter);
showTip(R.string.filter_added, LENGTH_SHORT);
}
private void showTagDialog(final String tag) {
final Context context = getContext2();
if (null == context) {
@@ -1387,9 +1342,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
case 0:
UrlOpener.openUrl(context, EhUrl.getTagDefinitionUrl(tag2), false);
break;
case 1:
addTagFilter(tag);
break;
}
}
}).show();
@@ -1402,9 +1354,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
return false;
}
if (mUploader == v) {
showBlockUploaderDialog();
} else if (mDownload == v) {
if (mDownload == v) {
GalleryInfo galleryInfo = getGalleryInfo();
if (galleryInfo != null) {
CommonOperations.startDownload(activity, galleryInfo, true);
@@ -64,6 +64,7 @@ import com.hippo.easyrecyclerview.FastScroller;
import com.hippo.ehviewer.Analytics;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.EhDB;
import com.hippo.ehviewer.FavouriteStatusRouter;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhClient;
@@ -76,9 +77,13 @@ import com.hippo.ehviewer.client.exception.EhException;
import com.hippo.ehviewer.client.parser.GalleryDetailUrlParser;
import com.hippo.ehviewer.client.parser.GalleryListParser;
import com.hippo.ehviewer.client.parser.GalleryPageUrlParser;
import com.hippo.ehviewer.dao.DownloadInfo;
import com.hippo.ehviewer.dao.QuickSearch;
import com.hippo.ehviewer.download.DownloadManager;
import com.hippo.ehviewer.ui.CommonOperations;
import com.hippo.ehviewer.ui.GalleryActivity;
import com.hippo.ehviewer.ui.MainActivity;
import com.hippo.ehviewer.widget.GalleryInfoContentHelper;
import com.hippo.ehviewer.widget.SearchBar;
import com.hippo.ehviewer.widget.SearchLayout;
import com.hippo.refreshlayout.RefreshLayout;
@@ -119,6 +124,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";
@@ -219,6 +225,11 @@ public final class GalleryListScene extends BaseScene
private ShowcaseView mShowcaseView;
private DownloadManager mDownloadManager;
private DownloadManager.DownloadInfoListener mDownloadInfoListener;
private FavouriteStatusRouter mFavouriteStatusRouter;
private FavouriteStatusRouter.Listener mFavouriteStatusRouterListener;
@Override
public int getNavCheckedItem() {
return mNavCheckedId;
@@ -232,7 +243,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);
@@ -262,6 +277,51 @@ public final class GalleryListScene extends BaseScene
Context context = getContext2();
AssertUtils.assertNotNull(context);
mClient = EhApplication.getEhClient(context);
mDownloadManager = EhApplication.getDownloadManager(context);
mFavouriteStatusRouter = EhApplication.getFavouriteStatusRouter(context);
mDownloadInfoListener = new DownloadManager.DownloadInfoListener() {
@Override
public void onAdd(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list, int position) {
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onUpdate(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list) { }
@Override
public void onUpdateAll() { }
@Override
public void onReload() {
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onChange() {
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onRenameLabel(String from, String to) { }
@Override
public void onRemove(@NonNull DownloadInfo info, @NonNull List<DownloadInfo> list, int position) {
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onUpdateLabels() { }
};
mDownloadManager.addDownloadInfoListener(mDownloadInfoListener);
mFavouriteStatusRouterListener = (gid, slot) -> {
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
};
mFavouriteStatusRouter.addListener(mFavouriteStatusRouterListener);
if (savedInstanceState == null) {
onInit();
@@ -303,6 +363,8 @@ public final class GalleryListScene extends BaseScene
mClient = null;
mUrlBuilder = null;
mDownloadManager.removeDownloadInfoListener(mDownloadInfoListener);
mFavouriteStatusRouter.removeListener(mFavouriteStatusRouterListener);
}
private void setSearchBarHint(Context context, SearchBar searchBar) {
@@ -414,8 +476,20 @@ public final class GalleryListScene extends BaseScene
if (ListUrlBuilder.MODE_NORMAL == urlBuilder.getMode() &&
EhUtils.NONE == category &&
TextUtils.isEmpty(keyword)) {
TextUtils.isEmpty(keyword) &&
urlBuilder.getAdvanceSearch() == -1 &&
urlBuilder.getMinRating() == -1 &&
urlBuilder.getPageFrom() == -1 &&
urlBuilder.getPageTo() == -1) {
return resources.getString(appName ? R.string.app_name : R.string.homepage);
} else if (ListUrlBuilder.MODE_SUBSCRIPTION == urlBuilder.getMode() &&
EhUtils.NONE == category &&
TextUtils.isEmpty(keyword) &&
urlBuilder.getAdvanceSearch() == -1 &&
urlBuilder.getMinRating() == -1 &&
urlBuilder.getPageFrom() == -1 &&
urlBuilder.getPageTo() == -1) {
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)) {
@@ -438,6 +512,11 @@ public final class GalleryListScene extends BaseScene
String keyword = builder.getKeyword();
int category = builder.getCategory();
// Update normal search mode
mSearchLayout.setNormalSearchMode(builder.getMode() == ListUrlBuilder.MODE_SUBSCRIPTION
? R.id.search_subscription_search
: R.id.search_normal_search);
// Update search edit text
if (!TextUtils.isEmpty(keyword) && null != mSearchBar) {
mSearchBar.setText(keyword);
@@ -459,6 +538,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 {
@@ -497,7 +578,6 @@ public final class GalleryListScene extends BaseScene
mViewTransition = new ViewTransition(contentLayout, mSearchLayout);
mHelper = new GalleryListHelper();
mHelper.setEmptyString(resources.getString(R.string.gallery_list_empty_hit));
contentLayout.setHelper(mHelper);
contentLayout.getFastScroller().setOnDragHandlerListener(this);
@@ -604,6 +684,7 @@ public final class GalleryListScene extends BaseScene
mSearchBarMover = null;
}
if (null != mHelper) {
mHelper.destroy();
if (1 == mHelper.getShownViewIndex()) {
mHasFirstRefresh = false;
}
@@ -855,6 +936,7 @@ public final class GalleryListScene extends BaseScene
public void onClick(View v) {
if (STATE_NORMAL != mState && null != mSearchBar) {
mSearchBar.applySearch();
hideSoftInput();
}
}
@@ -957,21 +1039,60 @@ public final class GalleryListScene extends BaseScene
return true;
}
boolean download;
switch (mDownloadManager.getDownloadState(gi.gid)) {
default:
case DownloadInfo.STATE_INVALID:
download = true;
break;
case DownloadInfo.STATE_NONE:
download = true;
break;
case DownloadInfo.STATE_WAIT:
download = false;
break;
case DownloadInfo.STATE_DOWNLOAD:
download = false;
break;
case DownloadInfo.STATE_FINISH:
download = true;
break;
case DownloadInfo.STATE_FAILED:
download = true;
break;
}
boolean favourite = gi.favoriteSlot == -2;
CharSequence[] items = new CharSequence[] {
context.getString(R.string.read),
context.getString(download ? R.string.download : R.string.stop_downloading),
context.getString(favourite ? R.string.add_to_favourites : R.string.remove_from_favourites),
};
new AlertDialog.Builder(context)
.setTitle(EhUtils.getSuitableTitle(gi))
.setItems(R.array.gallery_list_menu_entries, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0: // Download
.setItems(items, (dialog, which) -> {
switch (which) {
case 0: // Read
Intent intent = new Intent(activity, GalleryActivity.class);
intent.setAction(GalleryActivity.ACTION_EH);
intent.putExtra(GalleryActivity.KEY_GALLERY_INFO, gi);
startActivity(intent);
break;
case 1: // Download
if (download) {
CommonOperations.startDownload(activity, gi, false);
break;
case 1: // Favorites
CommonOperations.addToFavorites(activity, gi,
new addToFavoriteListener(context,
activity.getStageId(), getTag()));
break;
}
} else {
mDownloadManager.stopDownload(gi.gid);
}
break;
case 2: // Favorites
if (favourite) {
CommonOperations.addToFavorites(activity, gi, new AddToFavoriteListener(context, activity.getStageId(), getTag()));
} else {
CommonOperations.removeFromFavorites(activity, gi, new RemoveFromFavoriteListener(context, activity.getStageId(), getTag()));
}
break;
}
}).show();
return true;
@@ -1354,7 +1475,7 @@ public final class GalleryListScene extends BaseScene
}
}
private class GalleryListHelper extends ContentLayout.ContentHelper<GalleryInfo> {
private class GalleryListHelper extends GalleryInfoContentHelper {
@Override
protected void getPageData(int taskId, int type, int page) {
@@ -1425,6 +1546,11 @@ public final class GalleryListScene extends BaseScene
showActionFab();
}
@Override
protected boolean isDuplicate(GalleryInfo d1, GalleryInfo d2) {
return d1.gid == d2.gid;
}
@Override
protected void onScrollToPosition(int postion) {
if (0 == postion) {
@@ -1439,8 +1565,12 @@ public final class GalleryListScene extends BaseScene
private void onGetGalleryListSuccess(GalleryListParser.Result result, int taskId) {
if (mHelper != null && mSearchBarMover != null &&
mHelper.isCurrentTask(taskId)) {
String emptyString = getResources2().getString(mUrlBuilder.getMode() == ListUrlBuilder.MODE_SUBSCRIPTION && result.noWatchedTags
? R.string.gallery_list_empty_hit_subscription
: R.string.gallery_list_empty_hit);
mHelper.setEmptyString(emptyString);
mHelper.setPages(taskId, result.pages);
mHelper.onGetPageData(taskId, result.galleryInfoList);
mHelper.onGetPageData(taskId, result.nextPage, result.galleryInfoList);
}
}
@@ -1485,9 +1615,9 @@ public final class GalleryListScene extends BaseScene
}
}
private static class addToFavoriteListener extends EhCallback<GalleryListScene, Void> {
private static class AddToFavoriteListener extends EhCallback<GalleryListScene, Void> {
public addToFavoriteListener(Context context, int stageId, String sceneTag) {
public AddToFavoriteListener(Context context, int stageId, String sceneTag) {
super(context, stageId, sceneTag);
}
@@ -1509,4 +1639,29 @@ public final class GalleryListScene extends BaseScene
return scene instanceof GalleryListScene;
}
}
private static class RemoveFromFavoriteListener extends EhCallback<GalleryListScene, Void> {
public RemoveFromFavoriteListener(Context context, int stageId, String sceneTag) {
super(context, stageId, sceneTag);
}
@Override
public void onSuccess(Void result) {
showTip(R.string.remove_from_favorite_success, LENGTH_SHORT);
}
@Override
public void onFailure(Exception e) {
showTip(R.string.remove_from_favorite_failure, LENGTH_LONG);
}
@Override
public void onCancel() {}
@Override
public boolean isInstance(SceneFragment scene) {
return scene instanceof GalleryListScene;
}
}
}
@@ -330,6 +330,11 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
mAdapter.notifyItemRangeInserted(positionStart, itemCount);
}
}
@Override
protected boolean isDuplicate(GalleryPreview d1, GalleryPreview d2) {
return false;
}
}
private void onGetPreviewSetSuccess(Pair<PreviewSet, Integer> result, int taskId) {
@@ -342,7 +347,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
}
mHelper.setPages(taskId, result.second);
mHelper.onGetPageData(taskId, list);
mHelper.onGetPageData(taskId, 0, list);
}
}
@@ -81,7 +81,7 @@ public class SolidScene extends BaseScene {
startScene(new Announcer(clazz).setArgs(targetArgs));
} else {
Bundle newArgs = new Bundle();
newArgs.putString(GalleryListScene.KEY_ACTION, GalleryListScene.ACTION_HOMEPAGE);
newArgs.putString(GalleryListScene.KEY_ACTION, Settings.getLaunchPageGalleryListSceneAction());
startScene(new Announcer(GalleryListScene.class).setArgs(newArgs));
}
break;
@@ -132,23 +132,18 @@ public class WebViewSignInScene extends SolidScene {
return;
}
String cookieString = CookieManager.getInstance().getCookie(url);
String cookieString = CookieManager.getInstance().getCookie(EhUrl.HOST_E);
List<Cookie> cookies = parseCookies(httpUrl, cookieString);
boolean getId = false;
boolean getHash = false;
for (Cookie cookie: cookies) {
if (EhCookieStore.KEY_IPD_MEMBER_ID.equals(cookie.name())) {
getId = true;
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
} else if (EhCookieStore.KEY_IPD_PASS_HASH.equals(cookie.name())) {
getHash = true;
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
} else if (EhCookieStore.KEY_IGNEOUS.equals(cookie.name())) {
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
}
addCookie(context, EhUrl.DOMAIN_EX, cookie);
addCookie(context, EhUrl.DOMAIN_E, cookie);
}
if (getId && getHash) {
@@ -21,19 +21,22 @@ import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TableLayout;
import com.hippo.ehviewer.R;
import com.hippo.yorozuya.NumberUtils;
public class AdvanceSearchTable extends TableLayout {
public class AdvanceSearchTable extends LinearLayout {
private static final String STATE_KEY_SUPER = "super";
private static final String STATE_KEY_ADVANCE_SEARCH = "advance_search";
private static final String STATE_KEY_MIN_RATING = "min_rating";
private static final String STATE_KEY_PAGE_FROM = "page_from";
private static final String STATE_KEY_PAGE_TO = "page_to";
public static final int SNAME = 0x1;
public static final int STAGS = 0x2;
@@ -43,6 +46,9 @@ public class AdvanceSearchTable extends TableLayout {
public static final int SDT1 = 0x20;
public static final int SDT2 = 0x40;
public static final int SH = 0x80;
public static final int SFL = 0x100;
public static final int SFU = 0x200;
public static final int SFT = 0x400;
private CheckBox mSname;
private CheckBox mStags;
@@ -54,6 +60,12 @@ public class AdvanceSearchTable extends TableLayout {
private CheckBox mSh;
private CheckBox mSr;
private Spinner mMinRating;
private CheckBox mSp;
private EditText mSpf;
private EditText mSpt;
private CheckBox mSfl;
private CheckBox mSfu;
private CheckBox mSft;
public AdvanceSearchTable(Context context) {
super(context);
@@ -66,6 +78,8 @@ public class AdvanceSearchTable extends TableLayout {
}
public void init(Context context) {
setOrientation(LinearLayout.VERTICAL);
LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(R.layout.widget_advance_search_table, this);
@@ -88,6 +102,25 @@ public class AdvanceSearchTable extends TableLayout {
ViewGroup row4 = (ViewGroup) getChildAt(4);
mSr = (CheckBox) row4.getChildAt(0);
mMinRating = (Spinner) row4.getChildAt(1);
ViewGroup row5 = (ViewGroup) getChildAt(5);
mSp = (CheckBox) row5.getChildAt(0);
mSpf = (EditText) row5.getChildAt(1);
mSpt = (EditText) row5.getChildAt(3);
ViewGroup row7 = (ViewGroup) getChildAt(7);
mSfl = (CheckBox) row7.getChildAt(0);
mSfu = (CheckBox) row7.getChildAt(1);
mSft = (CheckBox) row7.getChildAt(2);
// Avoid java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus!
mSpt.setOnEditorActionListener((v, actionId, event) -> {
View nextView = v.focusSearch(View.FOCUS_DOWN);
if (nextView != null) {
nextView.requestFocus(View.FOCUS_DOWN);
}
return true;
});
}
public int getAdvanceSearch() {
@@ -100,6 +133,9 @@ public class AdvanceSearchTable extends TableLayout {
if (mSdt1.isChecked()) advanceSearch |= SDT1;
if (mSdt2.isChecked()) advanceSearch |= SDT2;
if (mSh.isChecked()) advanceSearch |= SH;
if (mSfl.isChecked()) advanceSearch |= SFL;
if (mSfu.isChecked()) advanceSearch |= SFU;
if (mSft.isChecked()) advanceSearch |= SFT;
return advanceSearch;
}
@@ -112,6 +148,20 @@ public class AdvanceSearchTable extends TableLayout {
}
}
public int getPageFrom() {
if (mSp.isChecked()) {
return NumberUtils.parseIntSafely(mSpf.getText().toString(), -1);
}
return -1;
}
public int getPageTo() {
if (mSp.isChecked()) {
return NumberUtils.parseIntSafely(mSpt.getText().toString(), -1);
}
return -1;
}
public void setAdvanceSearch(int advanceSearch) {
mSname.setChecked(NumberUtils.int2boolean(advanceSearch & SNAME));
mStags.setChecked(NumberUtils.int2boolean(advanceSearch & STAGS));
@@ -121,6 +171,9 @@ public class AdvanceSearchTable extends TableLayout {
mSdt1.setChecked(NumberUtils.int2boolean(advanceSearch & SDT1));
mSdt2.setChecked(NumberUtils.int2boolean(advanceSearch & SDT2));
mSh.setChecked(NumberUtils.int2boolean(advanceSearch & SH));
mSfl.setChecked(NumberUtils.int2boolean(advanceSearch & SFL));
mSfu.setChecked(NumberUtils.int2boolean(advanceSearch & SFU));
mSft.setChecked(NumberUtils.int2boolean(advanceSearch & SFT));
}
public void setMinRating(int minRating) {
@@ -132,12 +185,34 @@ public class AdvanceSearchTable extends TableLayout {
}
}
public void setPageFrom(int pageFrom) {
if (pageFrom > 0) {
mSpf.setText(Integer.toString(pageFrom));
mSp.setChecked(true);
} else {
mSp.setChecked(false);
mSpf.setText(null);
}
}
public void setPageTo(int pageTo) {
if (pageTo > 0) {
mSpt.setText(Integer.toString(pageTo));
mSp.setChecked(true);
} else {
mSp.setChecked(false);
mSpt.setText(null);
}
}
@Override
public Parcelable onSaveInstanceState() {
final Bundle state = new Bundle();
state.putParcelable(STATE_KEY_SUPER, super.onSaveInstanceState());
state.putInt(STATE_KEY_ADVANCE_SEARCH, getAdvanceSearch());
state.putInt(STATE_KEY_MIN_RATING, getMinRating());
state.putInt(STATE_KEY_PAGE_FROM, getPageFrom());
state.putInt(STATE_KEY_PAGE_TO, getPageTo());
return state;
}
@@ -148,6 +223,8 @@ public class AdvanceSearchTable extends TableLayout {
super.onRestoreInstanceState(savedState.getParcelable(STATE_KEY_SUPER));
setAdvanceSearch(savedState.getInt(STATE_KEY_ADVANCE_SEARCH));
setMinRating(savedState.getInt(STATE_KEY_MIN_RATING));
setPageFrom(savedState.getInt(STATE_KEY_PAGE_FROM));
setPageTo(savedState.getInt(STATE_KEY_PAGE_TO));
}
}
}
@@ -0,0 +1,77 @@
/*
* 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.
*/
package com.hippo.ehviewer.widget;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.hippo.ehviewer.R;
public class DialogWebChromeClient extends WebChromeClient {
private Context context;
public DialogWebChromeClient(Context context) {
this.context = context;
}
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
new AlertDialog.Builder(view.getContext())
.setMessage(message)
.setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm())
.setOnCancelListener(dialog -> result.cancel())
.show();
return true;
}
@Override
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
new AlertDialog.Builder(view.getContext())
.setMessage(message)
.setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm())
.setNegativeButton(android.R.string.cancel, (dialog, which) -> result.cancel())
.setOnCancelListener(dialog -> result.cancel())
.show();
return true;
}
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
LayoutInflater inflater = LayoutInflater.from(context);
View promptView = inflater.inflate(R.layout.dialog_js_prompt, null, false);
TextView messageView = promptView.findViewById(R.id.message);
messageView.setText(message);
final EditText valueView = promptView.findViewById(R.id.value);
valueView.setText(defaultValue);
new AlertDialog.Builder(context)
.setView(promptView)
.setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm(valueView.getText().toString()))
.setOnCancelListener(dialog -> result.cancel())
.show();
return true;
}
}
@@ -0,0 +1,109 @@
/*
* 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.
*/
package com.hippo.ehviewer.widget;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Parcelable;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.FavouriteStatusRouter;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.widget.ContentLayout;
import com.hippo.yorozuya.IntIdGenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class GalleryInfoContentHelper extends ContentLayout.ContentHelper<GalleryInfo> {
private static final String KEY_DATA_MAP = "data_map";
@SuppressLint("UseSparseArrays")
private Map<Long, GalleryInfo> map = new HashMap<>();
private FavouriteStatusRouter.Listener listener;
public GalleryInfoContentHelper() {
listener = (gid, slot) -> {
GalleryInfo info = map.get(gid);
if (info != null) {
info.favoriteSlot = slot;
}
};
EhApplication.getFavouriteStatusRouter().addListener(listener);
}
public void destroy() {
EhApplication.getFavouriteStatusRouter().removeListener(listener);
}
@Override
protected void onAddData(GalleryInfo data) {
map.put(data.gid, data);
}
@Override
protected void onAddData(List<GalleryInfo> data) {
for (GalleryInfo info : data) {
map.put(info.gid, info);
}
}
@Override
protected void onRemoveData(GalleryInfo data) {
map.remove(data.gid);
}
@Override
protected void onRemoveData(List<GalleryInfo> data) {
for (GalleryInfo info : data) {
map.remove(info.gid);
}
}
@Override
protected void onClearData() {
map.clear();
}
@Override
protected Parcelable saveInstanceState(Parcelable superState) {
Bundle bundle = (Bundle) super.saveInstanceState(superState);
// TODO It's a bad design
FavouriteStatusRouter router = EhApplication.getFavouriteStatusRouter();
int id = router.saveDataMap(map);
bundle.putInt(KEY_DATA_MAP, id);
return bundle;
}
@Override
protected Parcelable restoreInstanceState(Parcelable state) {
Bundle bundle = (Bundle) state;
int id = bundle.getInt(KEY_DATA_MAP, IntIdGenerator.INVALID_ID);
if (id != IntIdGenerator.INVALID_ID) {
FavouriteStatusRouter router = EhApplication.getFavouriteStatusRouter();
Map<Long, GalleryInfo> map = router.restoreDataMap(id);
if (map != null) {
this.map = map;
}
}
return super.restoreInstanceState(state);
}
}
@@ -168,6 +168,10 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
mImageView.setImageUri(imageUri);
}
public void setNormalSearchMode(int id) {
mNormalSearchMode.check(id);
}
@Override
public void onSelectImage() {
if (mHelper != null) {
@@ -243,6 +247,9 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
case R.id.search_normal_search:
urlBuilder.setMode(ListUrlBuilder.MODE_NORMAL);
break;
case R.id.search_subscription_search:
urlBuilder.setMode(ListUrlBuilder.MODE_SUBSCRIPTION);
break;
case R.id.search_specify_uploader:
urlBuilder.setMode(ListUrlBuilder.MODE_UPLOADER);
break;
@@ -255,6 +262,8 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
if (mEnableAdvance) {
urlBuilder.setAdvanceSearch(mTableAdvanceSearch.getAdvanceSearch());
urlBuilder.setMinRating(mTableAdvanceSearch.getMinRating());
urlBuilder.setPageFrom(mTableAdvanceSearch.getPageFrom());
urlBuilder.setPageTo(mTableAdvanceSearch.getPageTo());
}
break;
case SEARCH_MODE_IMAGE:
@@ -46,6 +46,8 @@ import com.hippo.yorozuya.IntIdGenerator;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.collect.IntList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class ContentLayout extends FrameLayout {
@@ -167,6 +169,8 @@ public class ContentLayout extends FrameLayout {
private static final String TAG = ContentHelper.class.getSimpleName();
private static final int CHECK_DUPLICATE_RANGE = 50;
private static final String KEY_SUPER = "super";
private static final String KEY_SHOWN_VIEW = "shown_view";
private static final String KEY_TIP = "tip";
@@ -232,6 +236,8 @@ public class ContentLayout extends FrameLayout {
*/
private int mPages;
private int mNextPage;
private int mCurrentTaskId;
private int mCurrentTaskType;
private int mCurrentTaskPage;
@@ -268,6 +274,13 @@ public class ContentLayout extends FrameLayout {
public void onFooterRefresh() {
if (mEndPage < mPages) {
// Get next page
// Fill pages before NextPage with empty list
while (mNextPage > mEndPage) {
mCurrentTaskId = mIdGenerator.nextId();
mCurrentTaskType = TYPE_NEXT_PAGE_KEEP_POS;
mCurrentTaskPage = mEndPage;
onGetPageData(mCurrentTaskId, mNextPage, Collections.emptyList());
}
mCurrentTaskId = mIdGenerator.nextId();
mCurrentTaskType = TYPE_NEXT_PAGE_KEEP_POS;
mCurrentTaskPage = mEndPage;
@@ -321,7 +334,7 @@ public class ContentLayout extends FrameLayout {
}
/**
* Call {@link #onGetPageData(int, List)} when get data
* Call {@link #onGetPageData(int, int, List)} when get data
*
* @param taskId task id
* @param page the page to get
@@ -399,6 +412,7 @@ public class ContentLayout extends FrameLayout {
public void addAt(int index, E data) {
mData.add(index, data);
onAddData(data);
for (int i = 0, n = mPageDivider.size(); i < n; i++) {
int divider = mPageDivider.get(i);
@@ -411,7 +425,8 @@ public class ContentLayout extends FrameLayout {
}
public void removeAt(int index) {
mData.remove(index);
E data = mData.remove(index);
onRemoveData(data);
for (int i = 0, n = mPageDivider.size(); i < n; i++) {
int divider = mPageDivider.get(i);
@@ -423,7 +438,33 @@ public class ContentLayout extends FrameLayout {
notifyItemRangeRemoved(index, 1);
}
public void onGetPageData(int taskId, List<E> data) {
protected abstract boolean isDuplicate(E d1, E d2);
private void removeDuplicateData(List<E> data, int start, int end) {
start = Math.max(0, start);
end = Math.min(mData.size(), end);
for (Iterator<E> iterator = data.iterator(); iterator.hasNext();) {
E d = iterator.next();
for (int i = start; i < end; i++) {
if (isDuplicate(d, mData.get(i))) {
iterator.remove();
break;
}
}
}
}
protected void onAddData(E data) { }
protected void onAddData(List<E> data) { }
protected void onRemoveData(E data) { }
protected void onRemoveData(List<E> data) { }
protected void onClearData() { }
public void onGetPageData(int taskId, int nextPage, List<E> data) {
if (mCurrentTaskId == taskId) {
int dataSize;
@@ -431,11 +472,13 @@ public class ContentLayout extends FrameLayout {
case TYPE_REFRESH:
mStartPage = 0;
mEndPage = 1;
mNextPage = nextPage;
mPageDivider.clear();
mPageDivider.add(data.size());
if (data.isEmpty()) {
mData.clear();
onClearData();
notifyDataSetChanged();
if (true || mEndPage >= mPages) { // Not found
@@ -457,7 +500,9 @@ public class ContentLayout extends FrameLayout {
}
} else {
mData.clear();
onClearData();
mData.addAll(data);
onAddData(data);
notifyDataSetChanged();
// Ui change, show content
@@ -475,6 +520,7 @@ public class ContentLayout extends FrameLayout {
break;
case TYPE_PRE_PAGE:
case TYPE_PRE_PAGE_KEEP_POS:
removeDuplicateData(data, 0, CHECK_DUPLICATE_RANGE);
dataSize = data.size();
for (int i = 0, n = mPageDivider.size(); i < n; i++) {
mPageDivider.set(i, mPageDivider.get(i) + dataSize);
@@ -514,6 +560,7 @@ public class ContentLayout extends FrameLayout {
}
} else {
mData.addAll(0, data);
onAddData(data);
notifyItemRangeInserted(0, data.size());
// Ui change, show content
@@ -537,10 +584,12 @@ public class ContentLayout extends FrameLayout {
break;
case TYPE_NEXT_PAGE:
case TYPE_NEXT_PAGE_KEEP_POS:
removeDuplicateData(data, mData.size() - CHECK_DUPLICATE_RANGE, mData.size());
dataSize = data.size();
int oldDataSize = mData.size();
mPageDivider.add(oldDataSize + dataSize);
mEndPage++;
mNextPage = nextPage;
if (data.isEmpty()) {
if (true || mEndPage >= mPages) { // OK, that's all
@@ -573,6 +622,7 @@ public class ContentLayout extends FrameLayout {
}
} else {
mData.addAll(data);
onAddData(data);
notifyItemRangeInserted(oldDataSize, dataSize);
// Ui change, show content
@@ -595,11 +645,13 @@ public class ContentLayout extends FrameLayout {
case TYPE_SOMEWHERE:
mStartPage = mCurrentTaskPage;
mEndPage = mCurrentTaskPage + 1;
mNextPage = nextPage;
mPageDivider.clear();
mPageDivider.add(data.size());
if (data.isEmpty()) {
mData.clear();
onClearData();
notifyDataSetChanged();
if (true || mEndPage >= mPages) { // Not found
@@ -621,7 +673,9 @@ public class ContentLayout extends FrameLayout {
}
} else {
mData.clear();
onClearData();
mData.addAll(data);
onAddData(data);
notifyDataSetChanged();
// Ui change, show content
@@ -644,12 +698,20 @@ public class ContentLayout extends FrameLayout {
break;
}
if (mCurrentTaskPage == mEndPage - 1) {
mNextPage = nextPage;
}
int oldIndexStart = mCurrentTaskPage == mStartPage ? 0 : mPageDivider.get(mCurrentTaskPage - mStartPage - 1);
int oldIndexEnd = mPageDivider.get(mCurrentTaskPage - mStartPage);
mData.subList(oldIndexStart, oldIndexEnd).clear();
List<E> toRemove = mData.subList(oldIndexStart, oldIndexEnd);
onRemoveData(toRemove);
toRemove.clear();
removeDuplicateData(data, oldIndexStart - CHECK_DUPLICATE_RANGE, oldIndexStart + CHECK_DUPLICATE_RANGE);
int newIndexStart = oldIndexStart;
int newIndexEnd = newIndexStart + data.size();
mData.addAll(oldIndexStart, data);
onAddData(data);
notifyDataSetChanged();
for (int i = mCurrentTaskPage - mStartPage, n = mPageDivider.size(); i < n; i++) {
@@ -717,7 +779,7 @@ public class ContentLayout extends FrameLayout {
}
public void showText(CharSequence text) {
mTipView.setText(text + "\n\n" + getContext().getString(R.string.help_route));
mTipView.setText(text);
mViewTransition.showView(2);
}
@@ -867,7 +929,7 @@ public class ContentLayout extends FrameLayout {
private int mSavedDataId = IntIdGenerator.INVALID_ID;
private Parcelable saveInstanceState(Parcelable superState) {
protected Parcelable saveInstanceState(Parcelable superState) {
Bundle bundle = new Bundle();
bundle.putParcelable(KEY_SUPER, superState);
int shownView = mViewTransition.getShownViewIndex();
@@ -891,7 +953,7 @@ public class ContentLayout extends FrameLayout {
return bundle;
}
private Parcelable restoreInstanceState(Parcelable state) {
protected Parcelable restoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
mViewTransition.showView(bundle.getInt(KEY_SHOWN_VIEW), false);
@@ -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>
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 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.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.hippo.widget.ProgressView
android:id="@+id/progress"
style="@style/ProgressView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
</FrameLayout>
@@ -42,6 +42,12 @@
android:layout_height="wrap_content"
android:text="@string/search_normal_search"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/search_subscription_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search_subscription_search"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/search_specify_uploader"
android:layout_width="wrap_content"
@@ -16,13 +16,17 @@
<merge
xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:checked="true"
android:text="@string/search_sname"/>
@@ -30,88 +34,190 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:checked="true"
android:text="@string/search_stags"/>
</TableRow>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<TableRow>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sdesc"/>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_storr"/>
</TableRow>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<TableRow>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sto"/>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sdt1"/>
</TableRow>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<TableRow>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sdt2"/>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sh"/>
</TableRow>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<TableRow>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sr"/>
<Spinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:entries="@array/search_min_rating"/>
</TableRow>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sp"/>
<EditText
android:id="@+id/spf"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:inputType="number"
android:maxLines="1"
android:imeOptions="actionNext"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sp_to"
android:textColor="?android:attr/textColorPrimary"/>
<EditText
android:id="@+id/spt"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:inputType="number"
android:maxLines="1"
android:imeOptions="actionNone"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin"
android:layout_marginBottom="@dimen/advance_search_table_item_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/search_sf"
android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/advance_search_table_item_margin">
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sfl"/>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_marginRight="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sfu"/>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="@dimen/advance_search_table_item_margin"
android:layout_gravity="center_vertical"
android:text="@string/search_sft"/>
</LinearLayout>
</merge>
@@ -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"
@@ -0,0 +1,21 @@
<?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.
-->
<transitionSet>
<changeTransform/>
<changeBounds/>
</transitionSet>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2016 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.
-->
<transitionSet>
<changeTransform/>
<changeBounds/>
<changeImageTransform/>
</transitionSet>
+1 -4
View File
@@ -318,10 +318,7 @@
<string name="settings_eh_excluded_tag_namespaces">Ausgeschlossene Namensraum-Etiketten</string>
<string name="settings_eh_excluded_tag_namespaces_summary">Galerie in der ausgeschlossenen Namensraum werden vom Standard-Etikett-Suchen versteckt</string>
<string name="settings_eh_show_jpn_title">Japanische Titel anzeigen</string>
<string name="settings_eh_show_jpn_title_summary_on">Versuchen, japanische Titel anzuzeigen. Es wird länger dauern, Galerieliste zu laden.</string>
<string name="settings_eh_show_jpn_title_summary_off">Standardtitel anzeigen. Sie sind oft in Englisch.</string>
<string name="settings_eh_filter">Filter</string>
<string name="settings_eh_filter_summary">Nach Titel, Hochlader, Etikett und Etikett-Namensraum filtern</string>
<string name="settings_eh_cellular_network_warning">Achtung auf mobile Daten anzeigen</string>
<string name="settings_read">Lesen</string>
<string name="settings_read_screen_rotation">Richtung des Bildschirms</string>
@@ -512,5 +509,5 @@
<string name="settings_eh_identity_cookies_tourist">Du hast dich noch nicht angemeldet.</string>
<string name="settings_eh_identity_cookies_copy">Kopieren</string>
<string name="settings_eh_show_gallery_pages">Galerieseitenzahl anzeigen</string>
<string name="settings_eh_show_gallery_pages_summary">Die Galerieseitenzahle in der Galerieliste anzeigen. Es wird länger dauern, um Galerieliste zu laden.</string>
<string name="settings_eh_show_gallery_pages_summary">Die Galerieseitenzahle in der Galerieliste anzeigen</string>
</resources>
+2 -5
View File
@@ -367,12 +367,9 @@
<string name="settings_eh_excluded_tag_namespaces">Excluir etiquetas espacios de nombres</string>
<string name="settings_eh_excluded_tag_namespaces_summary">Excluir ciertos espacios de nombres de una búsqueda de etiquetas por defecto</string>
<string name="settings_eh_show_jpn_title">Mostrar títulos en japonés</string>
<string name="settings_eh_show_jpn_title_summary_on">Intentar mostrar títulos en japonés. Tomará más tiempo en cargar la lista de galerías</string>
<string name="settings_eh_show_jpn_title_summary_off">Mostrar títulos por defecto, usualmente es en inglés</string>
<string name="settings_eh_show_gallery_pages">Mostrar número de páginas de la galería</string>
<string name="settings_eh_show_gallery_pages_summary">Se verá cuántas páginas tiene una galería. Tomará más tiempo en cargar la lista de galerías</string>
<string name="settings_eh_show_gallery_pages">Mostrar número de páginas de la galería</string>
<string name="settings_eh_show_gallery_pages_summary">Se verá cuántas páginas tiene una galería</string>
<string name="settings_eh_filter">Filtros</string>
<string name="settings_eh_filter_summary">Filtrar por titulo, uploader, etiqueta y etiquetas variables</string>
<string name="settings_eh_cellular_network_warning">Advertencia de redes moviles</string>
<string name="settings_read">Lectura</string>
+1 -4
View File
@@ -392,10 +392,7 @@
<string name="settings_eh_excluded_tag_namespaces">Espaces de nom de tag exclues</string>
<string name="settings_eh_excluded_tag_namespaces_summary">Exclure espaces de nom spécifiées de une recherche de tag par défaut</string>
<string name="settings_eh_show_jpn_title">Montrer les titres japonais</string>
<string name="settings_eh_show_jpn_title_summary_on">Essayer de charger les titres japonais. Il prend plus de temps pour charger la liste des galeries.</string>
<string name="settings_eh_show_jpn_title_summary_off">Montrer les titres par défaut. Ils sont souvent en anglais.</string>
<string name="settings_eh_filter">Filtre</string>
<string name="settings_eh_filter_summary">Filtrer par le titre, l\'uploader, le tag et l\'espace de nom</string>
<string name="settings_eh_cellular_network_warning">Avertissement de données mobiles</string>
<string name="settings_read">Lecture</string>
@@ -661,6 +658,6 @@
<string name="settings_eh_identity_cookies_tourist">Vous ne vous êtes pas connecté.</string>
<string name="settings_eh_identity_cookies_copy">Copier</string>
<string name="settings_eh_show_gallery_pages">Montrer les nombres des pages des galeries</string>
<string name="settings_eh_show_gallery_pages_summary">Montrer le nombre des pages des galerie dans la liste des galeries. Il vas prendre plus de temps pour charger la liste.</string>
<string name="settings_eh_show_gallery_pages_summary">Montrer le nombre des pages des galerie dans la liste des galeries</string>
</resources>
+1 -4
View File
@@ -390,10 +390,7 @@
<string name="settings_eh_excluded_languages">言語を除外</string>
<string name="settings_eh_excluded_languages_summary">指定した言語のギャラリーをホームページと検索から隠す</string>
<string name="settings_eh_show_jpn_title">日本語タイトルを表示</string>
<string name="settings_eh_show_jpn_title_summary_on">日本語タイトルを表示しようとします。有効にすると、ギャラリーリストを取得するのにもっと時間がかかることがあります</string>
<string name="settings_eh_show_jpn_title_summary_off">デフォルトのタイトルを表示します。多くの場合は英語のタイトルです。</string>
<string name="settings_eh_filter">フィルター</string>
<string name="settings_eh_filter_summary">タイトル、アップローダ、タグとタグセットをフィルター</string>
<string name="settings_eh_cellular_network_warning">モバイルネットワーク警告</string>
<string name="settings_read">閲覧</string>
@@ -657,5 +654,5 @@
<string name="settings_eh_identity_cookies_tourist">まだログインしていません</string>
<string name="settings_eh_identity_cookies_copy">コピー</string>
<string name="settings_eh_show_gallery_pages">ギャラリーページ数を表示</string>
<string name="settings_eh_show_gallery_pages_summary">リストにギャラリーのページの数量を表示します。リストをロードするのにもっと時間がかかることがあります。</string>
<string name="settings_eh_show_gallery_pages_summary">リストにギャラリーのページの数量を表示します</string>
</resources>
+1 -4
View File
@@ -407,16 +407,13 @@
<string name="settings_eh_excluded_tag_namespaces">제외할 태그 네임스페이스</string>
<string name="settings_eh_excluded_tag_namespaces_summary">기본 태그 검색에서 특정 네임스페이스 제외</string>
<string name="settings_eh_show_jpn_title">일본어 제목 표시</string>
<string name="settings_eh_show_jpn_title_summary_on">가능하면 일본어 제목을 표시합니다. 갤러리 목록을 불러오는 데 시간이 좀 더 걸립니다.</string>
<string name="settings_eh_show_jpn_title_summary_off">기본 제목을 표시합니다. 대부분 영어로 표시됩니다.</string>
<string name="settings_eh_show_gallery_pages">갤러리 페이지 수 표시</string>
<string name="settings_eh_show_gallery_pages_summary">갤러리 목록에 해당 갤러리의 페이지 수를 표시합니다. 갤러리 목록을 불러오는 데 시간이 좀 더 걸립니다.</string>
<string name="settings_eh_show_gallery_pages_summary">갤러리 목록에 해당 갤러리의 페이지 수를 표시합니다</string>
<string name="settings_eh_show_tag_translations">번역된 태그 표시</string>
<string name="settings_eh_show_tag_translations_summary">영어 태그 대신 번역된 태그를 표시합니다. 데이터 파일을 다운로드하는데 시간이 걸립 수 있습니다.</string>
<string name="settings_eh_tag_translations_source">Placeholder</string>
<string name="settings_eh_tag_translations_source_url">https://placeholder</string>
<string name="settings_eh_filter">필터</string>
<string name="settings_eh_filter_summary">제목, 업로더, 태그 및 태그 네임스페이스를 기반으로 필터링</string>
<string name="settings_eh_cellular_network_warning">모바일 데이터 경고</string>
<string name="settings_read">읽기</string>
+1 -4
View File
@@ -425,16 +425,13 @@
<string name="settings_eh_excluded_tag_namespaces">แท็กเนมสเปซที่ยกเว้น</string>
<string name="settings_eh_excluded_tag_namespaces_summary">แยกเนมสเปซที่ตั้งไว้ออกจากที่ค้นหาแท็กที่เป็นค่าเริ่มต้น</string>
<string name="settings_eh_show_jpn_title">แสดงชื่อเรื่องญี่ปุ่น</string>
<string name="settings_eh_show_jpn_title_summary_on">พยายามแสดงแสดงชื่อเรื่องภาษาญี่ปุ่น อาจใช้เวลามากขึ้นในการแสดงรายการแกลเลอรี่</string>
<string name="settings_eh_show_jpn_title_summary_off">แสดงค่าเริ่มต้นของชื่อเรื่อง ซึ่งส่วนมากแล้วจะใช้ภาษาอังกฤษ</string>
<string name="settings_eh_show_gallery_pages">แสดงจำนวนหน้าของแกลเลอรี่</string>
<string name="settings_eh_show_gallery_pages_summary">แสดงจำนวนหน้าที่มีอยู่ในแต่ละแกลเลอรี่ อาจใช้เวลามากขึ้นในการดึงรายการแกลเลอรี่</string>
<string name="settings_eh_show_gallery_pages_summary">แสดงจำนวนหน้าที่มีอยู่ในแต่ละแกลเลอรี่</string>
<string name="settings_eh_show_tag_translations">แสดงแท็กการแปลภาษา</string>
<string name="settings_eh_show_tag_translations_summary">แสดงแท็กการแปลภาษาแทนที่ข้อความต้นฉบับ (อาจใช้เวลามากขึ้นเพื่อดาวน์โหลดไฟล์ข้อมูล)</string>
<string name="settings_eh_tag_translations_source">Placeholder</string>
<string name="settings_eh_tag_translations_source_url">https://placeholder</string>
<string name="settings_eh_filter">ตัวกรอง</string>
<string name="settings_eh_filter_summary">กรองโดยชื่อเรื่อง, ผู้อัพโหลด, แท็ก และแท็กเนมสเปซ</string>
<string name="settings_eh_cellular_network_warning">เตือนการใช้เครือข่ายมือถือ</string>
<string name="settings_read">การอ่าน</string>
+23 -5
View File
@@ -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>
@@ -89,6 +90,7 @@
<string name="error_cant_create_temp_file">无法创建临时文件</string>
<string name="error_cant_save_image">无法保存图片</string>
<string name="error_invalid_number">非法数字</string>
<string name="error_please_login_first">请先登陆</string>
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的任何后果负责。\n\n未成年人应在监护人指导下使用本应用。</string>
<string name="error_username_cannot_empty">用户名不可为空</string>
@@ -123,6 +125,7 @@
<string name="gallery_list_search_bar_hint_e_hentai">搜索 E-Hentai</string>
<string name="gallery_list_search_bar_open_gallery">打开画廊</string>
<string name="gallery_list_empty_hit">什么都没有找到</string>
<string name="gallery_list_empty_hit_subscription">请至 设置->EH->我的标签 订阅标签</string>
<string name="search">搜索</string>
@@ -133,11 +136,12 @@
<string name="search_advance">高级选项</string>
<string name="search_image">图片搜索</string>
<string name="search_normal_search">一般搜索</string>
<string name="search_subscription_search">订阅搜索</string>
<string name="search_specify_uploader">指定上传者</string>
<string name="search_specify_tag">指定标签</string>
<string name="search_enable_advance">启用高级选项</string>
<string name="search_tip">一般搜索:就是搜索。\n\n指定上传者:列出该上传者上传的画廊。其他选项会被忽略。\n\n指定标签:列出含有该标签的画廊。其他选项会被忽略。</string>
<string name="search_tip">一般搜索:就是搜索。\n\n订阅搜素:在订阅中搜索。\n\n指定上传者:列出该上传者上传的画廊。其他选项会被忽略。\n\n指定标签:列出含有该标签的画廊。其他选项会被忽略。</string>
<string name="search_sname">搜索画廊</string>
<string name="search_stags">搜索画廊标签</string>
@@ -148,6 +152,12 @@
<string name="search_sdt2">搜索差评标签</string>
<string name="search_sh">显示被删除的画廊</string>
<string name="search_sr">最低评分:</string>
<string name="search_sp">页数:</string>
<string name="search_sp_to">到</string>
<string name="search_sf">禁用排除项:</string>
<string name="search_sfl">语言</string>
<string name="search_sfu">上传者</string>
<string name="search_sft">标签</string>
<string name="select_image">选择图片</string>
<string name="search_uss">使用相似搜索</string>
@@ -156,6 +166,9 @@
<string name="select_image_first">请先选择图片</string>
<string name="add_to_favourites">收藏</string>
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下载</string>
<string name="quick_search">快速搜索</string>
<string name="quick_search_tip">点击“+”来添加快速搜索</string>
@@ -361,6 +374,9 @@
<string name="apply">应用</string>
<string name="apply_tip">点击右上角的对勾来保存设置</string>
<!-- My Tags Activity -->
<string name="my_tags">我的标签</string>
<!-- Hosts Activity -->
<string name="hosts">自定义 hosts.txt</string>
<string name="hosts_tip">hosts.txt</string>
@@ -399,12 +415,15 @@
<string name="settings_eh_identity_cookies_copy">复制</string>
<string name="settings_u_config">EHentai 设置</string>
<string name="settings_u_config_summary">EHentai 网站上的设置</string>
<string name="settings_my_tags">我的标签</string>
<string name="settings_my_tags_summary">EHentai 网站上的我的标签</string>
<string name="settings_eh_theme">主题</string>
<string name="settings_eh_theme_light">亮色</string>
<string name="settings_eh_theme_dark">暗色</string>
<string name="settings_eh_theme_black">黑色</string>
<string name="settings_eh_apply_nav_bar_theme_color">导航栏应用主题配色</string>
<string name="settings_eh_gallery_site">画廊站点</string>
<string name="settings_eh_launch_page">启动页</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">详情</string>
<string name="settings_eh_list_mode_thumb">缩略图</string>
@@ -426,16 +445,15 @@
<string name="settings_eh_excluded_languages">排除语言</string>
<string name="settings_eh_excluded_languages_summary">在主页与搜索中隐藏指定语言的画廊</string>
<string name="settings_eh_show_jpn_title">显示日文标题</string>
<string name="settings_eh_show_jpn_title_summary_on">尝试显示日文标题。这会使获取画廊列表花费更多时间</string>
<string name="settings_eh_show_jpn_title_summary_off">显示默认标题。一般是英文标题</string>
<string name="settings_eh_show_jpn_title_summary">需同时在 EHentai 网站设置中启用 Japanese Title</string>
<string name="settings_eh_show_gallery_pages">显示画廊页数</string>
<string name="settings_eh_show_gallery_pages_summary">在画廊列表中显示页数。这会使获取画廊列表花费更多时间</string>
<string name="settings_eh_show_gallery_pages_summary">在画廊列表中显示页数</string>
<string name="settings_eh_show_tag_translations">显示标签翻译</string>
<string name="settings_eh_show_tag_translations_summary">显示翻译后的标签而非原始文字(需花费时间来下载数据文件)</string>
<string name="settings_eh_tag_translations_source">补充翻译(由 EhTagTranslator 提供)</string>
<string name="settings_eh_tag_translations_source_url">https://github.com/Mapaler/EhTagTranslator/wiki</string>
<string name="settings_eh_filter">过滤</string>
<string name="settings_eh_filter_summary">过滤标题,上传者,标签和标签组</string>
<string name="settings_eh_filter_summary">请使用 EHentai 网站提供的过滤系统。查看 EHentai 设置 与 我的标签</string>
<string name="settings_eh_cellular_network_warning">移动网络警告</string>
<string name="settings_read">阅读</string>
+23 -5
View File
@@ -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>
@@ -89,6 +90,7 @@
<string name="error_cant_create_temp_file">無法創建臨時文件</string>
<string name="error_cant_save_image">無法保存圖片</string>
<string name="error_invalid_number">非法數字</string>
<string name="error_please_login_first">請先登陸</string>
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。\n\n未成年人應在監護人指導下使用本應用。</string>
<string name="error_username_cannot_empty">用户名不可為空</string>
@@ -123,6 +125,7 @@
<string name="gallery_list_search_bar_hint_e_hentai">搜索 E-Hentai</string>
<string name="gallery_list_search_bar_open_gallery">打開畫廊</string>
<string name="gallery_list_empty_hit">什麼都沒有找到</string>
<string name="gallery_list_empty_hit_subscription">請至 設置->EH->我的標籤 訂閲標籤</string>
<string name="search">搜索</string>
@@ -133,11 +136,12 @@
<string name="search_advance">高級選項</string>
<string name="search_image">圖片搜索</string>
<string name="search_normal_search">一般搜索</string>
<string name="search_subscription_search">訂閲搜索</string>
<string name="search_specify_uploader">指定上傳者</string>
<string name="search_specify_tag">指定標籤</string>
<string name="search_enable_advance">啟用高級選項</string>
<string name="search_tip">一般搜索:就是搜索。\n\n指定上傳者:列出該上傳者上傳的畫廊。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的畫廊。其他選項會被忽略。</string>
<string name="search_tip">一般搜索:就是搜索。\n\n訂閲搜素:在訂閲中搜索。\n\n指定上傳者:列出該上傳者上傳的畫廊。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的畫廊。其他選項會被忽略。</string>
<string name="search_sname">搜索畫廊</string>
<string name="search_stags">搜索畫廊標籤</string>
@@ -148,6 +152,12 @@
<string name="search_sdt2">搜索差評標籤</string>
<string name="search_sh">顯示被刪除的畫廊</string>
<string name="search_sr">最低評分:</string>
<string name="search_sp">頁數:</string>
<string name="search_sp_to">到</string>
<string name="search_sf">禁用排除項:</string>
<string name="search_sfl">語言</string>
<string name="search_sfu">上傳者</string>
<string name="search_sft">標籤</string>
<string name="select_image">選擇圖片</string>
<string name="search_uss">使用相似搜索</string>
@@ -156,6 +166,9 @@
<string name="select_image_first">請先選擇圖片</string>
<string name="add_to_favourites">收藏</string>
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下載</string>
<string name="quick_search">快速搜索</string>
<string name="quick_search_tip">點擊“+”來添加快速搜索</string>
@@ -361,6 +374,9 @@
<string name="apply">應用</string>
<string name="apply_tip">點擊右上角的對勾來保存設置</string>
<!-- My Tags Activity -->
<string name="my_tags">我的標籤</string>
<!-- Hosts Activity -->
<string name="hosts">自定義 hosts.txt</string>
<string name="hosts_tip">hosts.txt</string>
@@ -398,12 +414,15 @@
<string name="settings_eh_identity_cookies_copy">複製</string>
<string name="settings_u_config">EHentai 設置</string>
<string name="settings_u_config_summary">EHentai 網站上的設置</string>
<string name="settings_my_tags">我的標籤</string>
<string name="settings_my_tags_summary">EHentai 網站上的我的標籤</string>
<string name="settings_eh_theme">主題</string>
<string name="settings_eh_theme_light">亮色</string>
<string name="settings_eh_theme_dark">暗色</string>
<string name="settings_eh_theme_black">黑色</string>
<string name="settings_eh_apply_nav_bar_theme_color">導航欄應用主題配色</string>
<string name="settings_eh_gallery_site">畫廊站點</string>
<string name="settings_eh_launch_page">啟動頁</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">詳情</string>
<string name="settings_eh_list_mode_thumb">縮略圖</string>
@@ -425,16 +444,15 @@
<string name="settings_eh_excluded_languages">排除語言</string>
<string name="settings_eh_excluded_languages_summary">在主頁與搜索中隱藏指定語言的畫廊</string>
<string name="settings_eh_show_jpn_title">顯示日文標題</string>
<string name="settings_eh_show_jpn_title_summary_on">嘗試顯示日文標題。這會使獲取畫廊列表花費更多時間</string>
<string name="settings_eh_show_jpn_title_summary_off">顯示默認標題。一般是英文標題</string>
<string name="settings_eh_show_jpn_title_summary">需同時在 EHentai 網站設置中啟用 Japanese Title</string>
<string name="settings_eh_show_gallery_pages">顯示畫廊頁數</string>
<string name="settings_eh_show_gallery_pages_summary">在畫廊列表中顯示頁數。這會使獲取畫廊列表花費更多時間</string>
<string name="settings_eh_show_gallery_pages_summary">在畫廊列表中顯示頁數</string>
<string name="settings_eh_show_tag_translations">顯示標籤翻譯</string>
<string name="settings_eh_show_tag_translations_summary">顯示翻譯後的標籤而非原始文字(需花費時間來下載數據文件)</string>
<string name="settings_eh_tag_translations_source">補充翻譯(由 EhTagTranslator 提供)</string>
<string name="settings_eh_tag_translations_source_url">https://github.com/Mapaler/EhTagTranslator/wiki</string>
<string name="settings_eh_filter">過濾</string>
<string name="settings_eh_filter_summary">過濾標題,上傳者,標籤和標籤組</string>
<string name="settings_eh_filter_summary">請使用 EHentai 網站提供的過濾系統。查看 EHentai 設置 與 我的標籤</string>
<string name="settings_eh_cellular_network_warning">移動網絡警告</string>
<string name="settings_read">閲讀</string>
+23 -5
View File
@@ -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>
@@ -89,6 +90,7 @@
<string name="error_cant_create_temp_file">無法建立暫存檔案</string>
<string name="error_cant_save_image">無法儲存圖片</string>
<string name="error_invalid_number">無效的數字</string>
<string name="error_please_login_first">請先登陸</string>
<string name="app_waring">本應用程式中內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用程式的作者不會對由其所造成的任何影響負責。\n\n未成年人應在監護人指導下使用本應用程式。</string>
<string name="error_username_cannot_empty">使用者名稱欄位不能為空</string>
@@ -123,6 +125,7 @@
<string name="gallery_list_search_bar_hint_e_hentai">在 E-Hentai 搜尋</string>
<string name="gallery_list_search_bar_open_gallery">開啟圖庫</string>
<string name="gallery_list_empty_hit">什麼都沒找到</string>
<string name="gallery_list_empty_hit_subscription">請至 設定->EH->我的標籤 訂閱標籤</string>
<string name="search">搜尋</string>
@@ -133,11 +136,12 @@
<string name="search_advance">進階選項</string>
<string name="search_image">圖片搜尋</string>
<string name="search_normal_search">一般搜尋</string>
<string name="search_subscription_search">訂閱搜尋</string>
<string name="search_specify_uploader">指定上傳者</string>
<string name="search_specify_tag">指定標籤</string>
<string name="search_enable_advance">啟用進階選項</string>
<string name="search_tip">一般搜尋:就是搜尋。\n\n指定上傳者:列出該上傳者上傳的圖庫。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的圖庫。其他選項會被忽略。</string>
<string name="search_tip">一般搜尋:就是搜尋。\n\n訂閱搜素:在訂閱中搜索。\n\n指定上傳者:列出該上傳者上傳的畫廊。其他選項會被忽略。\n\n指定標籤:列出含有該標籤的畫廊。其他選項會被忽略。</string>
<string name="search_sname">搜尋圖庫</string>
<string name="search_stags">搜尋圖庫的標籤</string>
@@ -148,6 +152,12 @@
<string name="search_sdt2">搜尋標籤:被噓爆的</string>
<string name="search_sh">顯示已被移除的的圖庫</string>
<string name="search_sr">最低評分:</string>
<string name="search_sp">頁數:</string>
<string name="search_sp_to">到</string>
<string name="search_sf">禁用排除項:</string>
<string name="search_sfl">語言</string>
<string name="search_sfu">上傳者</string>
<string name="search_sft">標籤</string>
<string name="select_image">選擇圖片</string>
<string name="search_uss">使用相似性搜尋</string>
@@ -156,6 +166,9 @@
<string name="select_image_first">請先選擇圖片</string>
<string name="add_to_favourites">收藏</string>
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下載</string>
<string name="quick_search">快速搜尋</string>
<string name="quick_search_tip">點擊“+”以新增快速搜尋</string>
@@ -361,6 +374,9 @@
<string name="apply">套用</string>
<string name="apply_tip">點選右上角的勾勾以儲存設定</string>
<!-- My Tags Activity -->
<string name="my_tags">我的標籤</string>
<!-- Hosts Activity -->
<string name="hosts">自訂hosts.txt</string>
<string name="hosts_tip">hosts.txt</string>
@@ -398,12 +414,15 @@
<string name="settings_eh_identity_cookies_copy">複製</string>
<string name="settings_u_config">EHentai 設定</string>
<string name="settings_u_config_summary">EHentai 網站上的設定</string>
<string name="settings_my_tags">我的標籤</string>
<string name="settings_my_tags_summary">EHentai 網站上的我的標籤</string>
<string name="settings_eh_theme">主題</string>
<string name="settings_eh_theme_light">亮色</string>
<string name="settings_eh_theme_dark">暗色</string>
<string name="settings_eh_theme_black">黑色</string>
<string name="settings_eh_apply_nav_bar_theme_color">導航欄應用主題配色</string>
<string name="settings_eh_gallery_site">圖庫站台</string>
<string name="settings_eh_launch_page">啟動頁</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">詳細資料</string>
<string name="settings_eh_list_mode_thumb">縮圖</string>
@@ -425,16 +444,15 @@
<string name="settings_eh_excluded_languages">排除語言</string>
<string name="settings_eh_excluded_languages_summary">在首頁與搜尋中隱藏指定語言的圖庫</string>
<string name="settings_eh_show_jpn_title">顯示日文標題</string>
<string name="settings_eh_show_jpn_title_summary_on">嘗試顯示日文標題。這會使取得圖庫列表時間增加</string>
<string name="settings_eh_show_jpn_title_summary_off">顯示預設的標題。通常是英文的</string>
<string name="settings_eh_show_jpn_title_summary">需同時在 EHentai 網站設定中啟用 Japanese Title</string>
<string name="settings_eh_show_gallery_pages">顯示圖庫頁數</string>
<string name="settings_eh_show_gallery_pages_summary">在圖庫列表中顯示頁數。這會使取得圖庫列表時間增加</string>
<string name="settings_eh_show_gallery_pages_summary">在圖庫列表中顯示頁數</string>
<string name="settings_eh_show_tag_translations">顯示標籤翻譯</string>
<string name="settings_eh_show_tag_translations_summary">顯示翻譯後的標籤而非原始文字(需花費時間來下載資料檔案)</string>
<string name="settings_eh_tag_translations_source">補充翻譯(由 EhTagTranslator 提供)</string>
<string name="settings_eh_tag_translations_source_url">https://github.com/Mapaler/EhTagTranslator/wiki</string>
<string name="settings_eh_filter">篩選</string>
<string name="settings_eh_filter_summary">篩選標題,上傳者,標籤和標籤命名空間</string>
<string name="settings_eh_filter_summary">請使用 EHentai 網站提供的過濾系統。檢視 EHentai 設定 與 我的標籤</string>
<string name="settings_eh_cellular_network_warning">行動數據警告</string>
<string name="settings_read">閱讀</string>
+12
View File
@@ -49,6 +49,18 @@
<item>1</item>
</string-array>
<string-array name="launch_page_entries" translatable="false">
<item>@string/homepage</item>
<item>@string/subscription</item>
<item>@string/whats_hot</item>
</string-array>
<string-array name="launch_page_entry_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="detail_size_entries" translatable="false">
<item>@string/settings_eh_detail_size_long</item>
<item>@string/settings_eh_detail_size_short</item>
+1
View File
@@ -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>
+23 -5
View File
@@ -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>
@@ -131,6 +132,7 @@
<string name="error_cant_create_temp_file">Couldn\'t create temp file</string>
<string name="error_cant_save_image">Can\'t save image</string>
<string name="error_invalid_number">Invalid number</string>
<string name="error_please_login_first">Please login first</string>
<string name="app_waring">The content of this application is from the Internet. Some of it may do physical or mental harm to you. You have learnt the risks above and would like to undertake them.</string>
<string name="error_username_cannot_empty">Username cannot be an empty string</string>
@@ -165,6 +167,7 @@
<string name="gallery_list_search_bar_hint_e_hentai">Search E-Hentai</string>
<string name="gallery_list_search_bar_open_gallery">Open the gallery</string>
<string name="gallery_list_empty_hit">The World is Big and the panda sit alone</string>
<string name="gallery_list_empty_hit_subscription">Subscribe to tags in Settings->EH->My tags</string>
<string name="search">Search</string>
@@ -175,11 +178,12 @@
<string name="search_advance">Advance Options</string>
<string name="search_image">Image Search</string>
<string name="search_normal_search">Normal search</string>
<string name="search_subscription_search">Subscription search</string>
<string name="search_specify_uploader">Specify uploader</string>
<string name="search_specify_tag">Specify tag</string>
<string name="search_enable_advance">Enable advance options</string>
<string name="search_tip">Normal search: Simply search.\n\nSpecify uploader: Search for galleries uploaded by the specified uploader. All other options will be ignored.\n\nSpecify tag: Search for galleries that contain the specified tag. Only one tag accepted. Other options will be ignored.</string>
<string name="search_tip">Normal search: Simply search.\n\nSubscription search: Search in subscriptions.\n\nSpecify uploader: Search for galleries uploaded by the specified uploader. All other options will be ignored.\n\nSpecify tag: Search for galleries that contain the specified tag. Only one tag accepted. Other options will be ignored.</string>
<string name="search_sname">Search Gallery</string>
<string name="search_stags">Search Gallery Tags</string>
@@ -190,6 +194,12 @@
<string name="search_sdt2">Search Downvoted Tags</string>
<string name="search_sh">Show Expunged Galleries</string>
<string name="search_sr">Minimum Rating:</string>
<string name="search_sp">Pages:</string>
<string name="search_sp_to">to</string>
<string name="search_sf">Disable default filters for:</string>
<string name="search_sfl">Language</string>
<string name="search_sfu">Uploader</string>
<string name="search_sft">Tags</string>
<string name="select_image">Select image</string>
<string name="search_uss">Use similarity scan</string>
@@ -198,6 +208,9 @@
<string name="select_image_first">Please select image first</string>
<string name="add_to_favourites">Add to favourites</string>
<string name="remove_from_favourites">Remove from favourites</string>
<string name="stop_downloading">Stop downloading</string>
<string name="quick_search">Quick search</string>
<string name="quick_search_tip">Tap \"+\" to add Quick Search</string>
@@ -405,6 +418,9 @@
<string name="apply">Apply</string>
<string name="apply_tip">Tap the check mark to save the settings</string>
<!-- My Tags Activity -->
<string name="my_tags">My tags</string>
<!-- Hosts Activity -->
<string name="hosts">Custom hosts.txt</string>
<string name="hosts_tip">hosts.txt</string>
@@ -442,12 +458,15 @@
<string name="settings_eh_identity_cookies_copy">Copy</string>
<string name="settings_u_config">EHentai settings</string>
<string name="settings_u_config_summary">Settings on EHentai website</string>
<string name="settings_my_tags">My tags</string>
<string name="settings_my_tags_summary">My tags on EHentai website</string>
<string name="settings_eh_theme">Theme</string>
<string name="settings_eh_theme_light">Light</string>
<string name="settings_eh_theme_dark">Dark</string>
<string name="settings_eh_theme_black">Black</string>
<string name="settings_eh_apply_nav_bar_theme_color">Apply theme color to navigation bar</string>
<string name="settings_eh_gallery_site">Gallery site</string>
<string name="settings_eh_launch_page">Launch page</string>
<string name="settings_eh_list_mode">List mode</string>
<string name="settings_eh_list_mode_detail">Detail</string>
<string name="settings_eh_list_mode_thumb">Thumb</string>
@@ -469,16 +488,15 @@
<string name="settings_eh_excluded_tag_namespaces">Excluded tag namespaces</string>
<string name="settings_eh_excluded_tag_namespaces_summary">Exclude certain namespaces from a default tag search</string>
<string name="settings_eh_show_jpn_title">Show Japanese title</string>
<string name="settings_eh_show_jpn_title_summary_on">Attempt to show Japanese title. It takes more time to get gallery list</string>
<string name="settings_eh_show_jpn_title_summary_off">Show default titles, which are usually in English.</string>
<string name="settings_eh_show_jpn_title_summary">Require enabling Japanese Title in Settings on EHentai website</string>
<string name="settings_eh_show_gallery_pages">Show gallery pages</string>
<string name="settings_eh_show_gallery_pages_summary">Display the number of pages in the gallery list. It takes more time to load the gallery list</string>
<string name="settings_eh_show_gallery_pages_summary">Display the number of pages in the gallery list</string>
<string name="settings_eh_show_tag_translations">Show tag translations</string>
<string name="settings_eh_show_tag_translations_summary">Show tag translations instead of the original text (It takes time to download the data file)</string>
<string name="settings_eh_tag_translations_source">Placeholder</string>
<string name="settings_eh_tag_translations_source_url">https://placeholder</string>
<string name="settings_eh_filter">Filter</string>
<string name="settings_eh_filter_summary">Filter by title, uploader, tag and tag namespace</string>
<string name="settings_eh_filter_summary">Please use the filter system provided by EHentai website. Check EHentai settings and My tags</string>
<string name="settings_eh_cellular_network_warning">Cellular network warning</string>
<string name="settings_read">Read</string>
+17 -5
View File
@@ -37,12 +37,18 @@
app:entryValues="@array/gallery_site_entry_values"
android:defaultValue="1"/>
<com.hippo.preference.ActivityPreference
<com.hippo.ehviewer.preference.SignInRequiredActivityPreference
android:key="u_config"
android:title="@string/settings_u_config"
android:summary="@string/settings_u_config_summary"
app:activity="com.hippo.ehviewer.ui.UConfigActivity"/>
<com.hippo.ehviewer.preference.SignInRequiredActivityPreference
android:key="my_tags"
android:title="@string/settings_my_tags"
android:summary="@string/settings_my_tags_summary"
app:activity="com.hippo.ehviewer.ui.MyTagsActivity"/>
<com.hippo.preference.ListPreference
android:key="theme"
android:title="@string/settings_eh_theme"
@@ -56,6 +62,14 @@
android:title="@string/settings_eh_apply_nav_bar_theme_color"
android:defaultValue="false"/>
<com.hippo.preference.ListPreference
android:key="launch_page"
android:title="@string/settings_eh_launch_page"
android:summary="%s"
app:entries="@array/launch_page_entries"
app:entryValues="@array/launch_page_entry_values"
android:defaultValue="0"/>
<com.hippo.preference.ListPreference
android:key="list_mode"
android:title="@string/settings_eh_list_mode"
@@ -96,8 +110,7 @@
<com.hippo.preference.SwitchPreference
android:key="show_jpn_title"
android:title="@string/settings_eh_show_jpn_title"
app:summaryOn="@string/settings_eh_show_jpn_title_summary_on"
app:summaryOff="@string/settings_eh_show_jpn_title_summary_off"
android:summary="@string/settings_eh_show_jpn_title_summary"
android:defaultValue="false"/>
<com.hippo.preference.SwitchPreference
@@ -120,8 +133,7 @@
<com.hippo.preference.ActivityPreference
android:key="filter"
android:title="@string/settings_eh_filter"
android:summary="@string/settings_eh_filter_summary"
app:activity="com.hippo.ehviewer.ui.FilterActivity"/>
android:summary="@string/settings_eh_filter_summary"/>
<com.hippo.preference.SwitchPreference
android:key="cellular_network_warning"
@@ -32,7 +32,7 @@ public class EhDaoGenerator {
private static final String OUT_DIR = "../app/src/main/java-gen";
private static final String DELETE_DIR = "../app/src/main/java-gen/com/hippo/ehviewer/dao";
private static final int VERSION = 3;
private static final int VERSION = 4;
private static final String DOWNLOAD_INFO_PATH = "../app/src/main/java-gen/com/hippo/ehviewer/dao/DownloadInfo.java";
private static final String HISTORY_INFO_PATH = "../app/src/main/java-gen/com/hippo/ehviewer/dao/HistoryInfo.java";
@@ -138,6 +138,10 @@ public class EhDaoGenerator {
entity.addStringProperty("keyword");
entity.addIntProperty("advanceSearch").notNull();
entity.addIntProperty("minRating").notNull();
// Since 4
entity.addIntProperty("pageFrom").notNull();
// Since 4
entity.addIntProperty("pageTo").notNull();
entity.addLongProperty("time").notNull();
}
@@ -190,6 +194,7 @@ public class EhDaoGenerator {
entity.addIdProperty();
entity.addIntProperty("mode").notNull();
entity.addStringProperty("text");
// Since 3
entity.addBooleanProperty("enable");
}
@@ -352,6 +357,8 @@ public class EhDaoGenerator {
javaClass.getField("keyword").setPublic();
javaClass.getField("advanceSearch").setPublic();
javaClass.getField("minRating").setPublic();
javaClass.getField("pageFrom").setPublic();
javaClass.getField("pageTo").setPublic();
javaClass.getField("time").setPublic();
javaClass.addMethod("\t@Override\n" +