Compare commits

..
22 Commits
Author SHA1 Message Date
seven332 a02fe88765 1.0.20 2017-02-09 21:45:24 +08:00
seven332 6488de75f1 Adjust gallery detail actions order 2017-02-09 21:40:24 +08:00
seven332 439f199a10 Sanitize torrent filename 2017-02-09 21:36:44 +08:00
seven332 e535b2fa09 Fix TorrentParser 2017-02-09 21:30:07 +08:00
seven332 81ae752975 Fix Chinese translations 2017-02-09 21:24:28 +08:00
seven332 5dd584776a Fix Chinese translations 2017-02-09 21:19:36 +08:00
seven332 f617e62b85 Add android-chinese-string 2017-02-09 21:09:58 +08:00
Lin, Yi-Li 4d95a7163f use snackbar to tell users that H@H client is required for this feature 2017-01-29 17:27:56 +09:00
Lin, Yi-Li b5cae76de5 able to request archive download 2017-01-29 02:00:02 +09:00
seven332 9065e7457a 1.0.19 2017-01-26 13:30:48 +08:00
seven332 08ab9159a5 Fix RecyclerView crashing 2017-01-26 11:39:56 +08:00
seven332 6b5b961986 1.0.18 2017-01-25 13:22:09 +08:00
seven332 6a96035149 Avoid RecyclerView scrolling after detached 2017-01-25 13:19:23 +08:00
seven332 1ce035591a Fix GalleryPageParser 2017-01-25 00:13:55 +08:00
seven332 6cc78802ee 1.0.17 2017-01-24 19:41:23 +08:00
seven332 636c011c23 Rename XXX_G to XXX_E 2017-01-24 19:39:05 +08:00
seven332 92490ca1a6 e-hentai switched to HTTPS 2017-01-24 19:34:24 +08:00
seven332 b6a5d237ac Add EhUrl.getFixedPreviewThumbUrl() 2017-01-24 19:22:58 +08:00
seven332 8be0b5c588 Don't use jack anymore 2016-12-31 19:29:33 +08:00
seven332 fcbe129b6e Fix URL_PREFIX_THUMB_EX 2016-12-30 12:10:59 +08:00
seven332 befbcd6720 Add fix thumb url 2016-12-29 21:50:26 +08:00
seven332 ee5062d4c7 Add round icon 2016-12-19 00:38:26 +08:00
38 changed files with 650 additions and 107 deletions

No files matched your search

+3 -13
View File
@@ -1,6 +1,7 @@
import com.android.build.gradle.internal.tasks.DefaultAndroidTask
apply plugin: 'com.android.application'
apply plugin: 'android-chinese-string'
android {
compileSdkVersion 25
@@ -10,20 +11,10 @@ android {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 25
versionCode 69
versionName "1.0.16"
versionCode 73
versionName "1.0.20"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW"
jackOptions {
enabled true
additionalParameters("jack.dex.optimize" : "true")
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
@@ -50,7 +41,6 @@ task copyNotice(type: Copy) {
finalizedBy ":daogenerator:executeDaoGenerator"
}
// TODO What is jack task?
tasks.withType(DefaultAndroidTask) {
task -> task.dependsOn copyNotice
}
+1
View File
@@ -28,6 +28,7 @@
<application
android:name="com.hippo.ehviewer.EhApplication"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:allowBackup="true"
@@ -300,6 +300,13 @@ public class Settings {
return getIntFromStr(KEY_THUMB_RESOLUTION, DEFAULT_THUMB_RESOLUTION);
}
private static final String KEY_FIX_THUMB_URL = "fix_thumb_url";
private static final boolean DEFAULT_FIX_THUMB_URL = false;
public static boolean getFixThumbUrl() {
return getBoolean(KEY_FIX_THUMB_URL, DEFAULT_FIX_THUMB_URL);
}
private static final String KEY_SHOW_JPN_TITLE = "show_jpn_title";
private static final boolean DEFAULT_SHOW_JPN_TITLE = false;
@@ -59,6 +59,8 @@ public class EhClient {
public static final int METHOD_GET_PROFILE = 14;
public static final int METHOD_VOTE_COMMENT = 15;
public static final int METHOD_IMAGE_SEARCH = 16;
public static final int METHOD_ARCHIVE_LIST = 17;
public static final int METHOD_DOWNLOAD_ARCHIVE = 18;
private final ThreadPoolExecutor mRequestThreadPool;
private final OkHttpClient mOkHttpClient;
@@ -184,6 +186,10 @@ public class EhClient {
return EhEngine.voteComment(this, mOkHttpClient, (Long) params[0], (String) params[1], (Long) params[2], (String) params[3], (Long) params[4], (Integer) params[5]);
case METHOD_IMAGE_SEARCH:
return EhEngine.imageSearch(this, mOkHttpClient, (File) params[0], (Boolean) params[1], (Boolean) params[2], (Boolean) params[3]);
case METHOD_ARCHIVE_LIST:
return EhEngine.getArchiveList(this, mOkHttpClient, (String) params[0]);
case METHOD_DOWNLOAD_ARCHIVE:
return EhEngine.downloadArchive(this, mOkHttpClient, (Long) params[0], (String) params[1], (String) params[2], (String) params[3]);
default:
return new IllegalStateException("Can't detect method " + mMethod);
}
@@ -35,7 +35,7 @@ public class EhCookieStore extends CookieDBStore {
new Cookie.Builder()
.name(EhConfig.KEY_CONTENT_WARNING)
.value(EhConfig.CONTENT_WARNING_NOT_SHOW)
.domain(EhUrl.DOMAIN_G)
.domain(EhUrl.DOMAIN_E)
.path("/")
.expiresAt(Long.MAX_VALUE)
.build();
@@ -83,7 +83,7 @@ public class EhCookieStore extends CookieDBStore {
Object tag = request.tag();
String host = url.host();
boolean checkTips = domainMatch(host, EhUrl.DOMAIN_G);
boolean checkTips = domainMatch(host, EhUrl.DOMAIN_E);
boolean checkUconfig = (domainMatch(host, EhUrl.DOMAIN_E) || domainMatch(host, EhUrl.DOMAIN_EX)) && tag instanceof EhConfig;
if (checkTips || checkUconfig) {
@@ -30,7 +30,9 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.client.data.PreviewSet;
import com.hippo.ehviewer.client.exception.CancelledException;
import com.hippo.ehviewer.client.exception.EhException;
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
import com.hippo.ehviewer.client.exception.ParseException;
import com.hippo.ehviewer.client.parser.ArchiveParser;
import com.hippo.ehviewer.client.parser.FavoritesParser;
import com.hippo.ehviewer.client.parser.ForumsParser;
import com.hippo.ehviewer.client.parser.GalleryApiParser;
@@ -56,6 +58,8 @@ import org.jsoup.nodes.Document;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.Call;
import okhttp3.FormBody;
@@ -78,6 +82,8 @@ public class EhEngine {
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
private static final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
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() {
@@ -200,6 +206,10 @@ public class EhEngine {
}
}
for (GalleryInfo info : list) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
return result;
}
@@ -448,6 +458,10 @@ public class EhEngine {
fillGalleryListByApi(task, okHttpClient, result.galleryInfoList);
}
for (GalleryInfo info : result.galleryInfoList) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
return result;
}
@@ -555,6 +569,10 @@ public class EhEngine {
fillGalleryListByApi(task, okHttpClient, result.galleryInfoList);
}
for (GalleryInfo info : result.galleryInfoList) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
return result;
}
@@ -587,9 +605,82 @@ public class EhEngine {
return result;
}
public static Pair<String, Pair<String, String>[]> getArchiveList(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
String url) throws Exception {
Log.d(TAG, url);
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig()).build();
Call call = okHttpClient.newCall(request);
// Put call
if (null != task) {
task.setCall(call);
}
String body = null;
Headers headers = null;
Pair<String, Pair<String, String>[]> result;
int code = -1;
try {
Response response = call.execute();
code = response.code();
headers = response.headers();
body = response.body().string();
result = ArchiveParser.parse(body);
} catch (Exception e) {
throwException(call, code, headers, body, e);
throw e;
}
return result;
}
public static Void downloadArchive(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
long gid, String token, String or, String res) throws Exception {
if (or == null || or.length() == 0) {
throw new EhException("Invalid form param or: " + or);
}
if (res == null || res.length() == 0) {
throw new EhException("Invalid res: " + res);
}
FormBody.Builder builder = new FormBody.Builder();
builder.add("hathdl_xres", res);
String url = EhUrl.getDownloadArchive(gid, token, or);
Log.d(TAG, url);
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig())
.post(builder.build())
.build();
Call call = okHttpClient.newCall(request);
// Put call
if (null != task) {
task.setCall(call);
}
String body = null;
Headers headers = null;
int code = -1;
try {
Response response = call.execute();
code = response.code();
headers = response.headers();
body = response.body().string();
throwException(call, code, headers, body, null);
} catch (Exception e) {
throwException(call, code, headers, body, e);
throw e;
}
Matcher m = PATTERN_NEED_HATH_CLIENT.matcher(body);
if (m.find()) {
throw new NoHAtHClientException("No H@H client");
}
return null;
}
public static List<GalleryInfo> getWhatsHot(@Nullable EhClient.Task task,
OkHttpClient okHttpClient) throws Exception {
String url = EhUrl.HOST_G;
String url = EhUrl.HOST_E;
Log.d(TAG, url);
Request request = new EhRequestBuilder(url, null != task ? task.getEhConfig() : Settings.getEhConfig()).build();
Call call = okHttpClient.newCall(request);
@@ -619,6 +710,10 @@ public class EhEngine {
fillGalleryListByApi(task, okHttpClient, list);
}
for (GalleryInfo info : list) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
return list;
}
@@ -802,6 +897,10 @@ public class EhEngine {
}
}
for (GalleryInfo info : list) {
info.thumb = EhUrl.getFixedPreviewThumbUrl(info.thumb);
}
return result;
}
@@ -21,34 +21,40 @@ import android.support.annotation.NonNull;
import com.hippo.ehviewer.Settings;
import com.hippo.network.UrlBuilder;
import java.util.List;
import java.util.ListIterator;
import okhttp3.HttpUrl;
public class EhUrl {
public static final int SITE_G = 0;
public static final int SITE_E = 0;
public static final int SITE_EX = 1;
public static final String DOMAIN_EX = "exhentai.org";
public static final String DOMAIN_E = "e-hentai.org";
public static final String DOMAIN_G = "g.e-hentai.org";
public static final String DOMAIN_LOFI = "lofi.e-hentai.org";
public static final String HOST_E = "http://" + DOMAIN_E + "/";
public static final String HOST_EX = "https://" + DOMAIN_EX + "/";
public static final String HOST_G = "http://" + DOMAIN_G + "/";
public static final String HOST_E = "https://" + DOMAIN_E + "/";
public static final String API_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login&CODE=01";
public static final String API_G = HOST_G + "api.php";
public static final String API_E = HOST_E + "api.php";
public static final String API_EX = HOST_EX + "api.php";
public static final String URL_IMAGE_SEARCH_G = "https://upload.e-hentai.org/image_lookup.php";
public static final String URL_IMAGE_SEARCH_E = "https://upload.e-hentai.org/image_lookup.php";
public static final String URL_IMAGE_SEARCH_EX = "https://exhentai.org/upload/image_lookup.php";
public static final String URL_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login";
public static final String URL_REGISTER = "https://forums.e-hentai.org/index.php?act=Reg&CODE=00";
public static final String URL_FAVORITES_G = HOST_G + "favorites.php";
public static final String URL_FAVORITES_E = HOST_E + "favorites.php";
public static final String URL_FAVORITES_EX = HOST_EX + "favorites.php";
public static final String URL_FORUMS = "https://forums.e-hentai.org/";
private static final String URL_PREFIX_THUMB_E = "https://ehgt.org/t/";
private static final String URL_PREFIX_THUMB_EX = "https://exhentai.org/t/";
public static String getGalleryDetailUrl(long gid, String token) {
return getGalleryDetailUrl(gid, token, 0, false);
}
@@ -56,8 +62,8 @@ public class EhUrl {
public static String getHost() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return HOST_G;
case SITE_E:
return HOST_E;
case SITE_EX:
return HOST_EX;
}
@@ -66,8 +72,8 @@ public class EhUrl {
public static String getFavoritesUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return URL_FAVORITES_G;
case SITE_E:
return URL_FAVORITES_E;
case SITE_EX:
return URL_FAVORITES_EX;
}
@@ -76,8 +82,8 @@ public class EhUrl {
public static String getApiUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return API_G;
case SITE_E:
return API_E;
case SITE_EX:
return API_EX;
}
@@ -102,6 +108,10 @@ public class EhUrl {
return getHost() + "gallerypopups.php?gid=" + gid + "&t=" + token + "&act=addfav";
}
public static String getDownloadArchive(long gid, String token, String or) {
return getHost() + "archiver.php?gid=" + gid + "&token=" + token + "&or=" + or;
}
public static String getTagDefinitionUrl(String tag) {
return "https://ehwiki.org/wiki/" + tag.replace(' ', '_');
}
@@ -110,10 +120,50 @@ public class EhUrl {
public static String getImageSearchUrl() {
switch (Settings.getGallerySite()) {
default:
case SITE_G:
return URL_IMAGE_SEARCH_G;
case SITE_E:
return URL_IMAGE_SEARCH_E;
case SITE_EX:
return URL_IMAGE_SEARCH_EX;
}
}
public static String getThumbUrlPrefix() {
switch (Settings.getGallerySite()) {
default:
//case SITE_E:
return URL_PREFIX_THUMB_E;
//case SITE_EX:
// return URL_PREFIX_THUMB_EX;
}
}
public static String getFixedPreviewThumbUrl(String originUrl) {
HttpUrl url = HttpUrl.parse(originUrl);
if (url == null) return originUrl;
List<String> pathSegments = url.pathSegments();
if (pathSegments == null || pathSegments.size() < 3) return originUrl;
ListIterator<String> iterator = pathSegments.listIterator(pathSegments.size());
// The last segments, like
// 317a1a254cd9c3269e71b2aa2671fe8d28c91097-260198-640-480-png_250.jpg
if (!iterator.hasPrevious()) return originUrl;
String lastSegment = iterator.previous();
// The second last segments, like
// 7a
if (!iterator.hasPrevious()) return originUrl;
String secondLastSegment = iterator.previous();
// The third last segments, like
// 31
if (!iterator.hasPrevious()) return originUrl;
String thirdLastSegment = iterator.previous();
// Check path segments
if (lastSegment != null && secondLastSegment != null
&& thirdLastSegment != null
&& lastSegment.startsWith(thirdLastSegment)
&& lastSegment.startsWith(secondLastSegment, thirdLastSegment.length())) {
return getThumbUrlPrefix() + thirdLastSegment + "/" + secondLastSegment + "/" + lastSegment;
} else {
return originUrl;
}
}
}
@@ -27,6 +27,7 @@ public class GalleryDetail extends GalleryInfo {
public String apiKey;
public int torrentCount;
public String torrentUrl;
public String archiveUrl;
public String parent;
public String visible;
public String language;
@@ -50,6 +51,7 @@ public class GalleryDetail extends GalleryInfo {
super.writeToParcel(dest, flags);
dest.writeInt(this.torrentCount);
dest.writeString(this.torrentUrl);
dest.writeString(this.archiveUrl);
dest.writeString(this.parent);
dest.writeString(this.visible);
dest.writeString(this.language);
@@ -71,6 +73,7 @@ public class GalleryDetail extends GalleryInfo {
super(in);
this.torrentCount = in.readInt();
this.torrentUrl = in.readString();
this.archiveUrl = in.readString();
this.parent = in.readString();
this.visible = in.readString();
this.language = in.readString();
@@ -0,0 +1,25 @@
/*
* 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.exception;
public class NoHAtHClientException extends EhException {
public NoHAtHClientException(String detailMessage) {
super(detailMessage);
}
}
@@ -0,0 +1,48 @@
/*
* 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.parser;
import android.util.Pair;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ArchiveParser {
private static final Pattern PATTERN_FORM = Pattern.compile("<form id=\"hathdl_form\" action=\"[^\"]*?or=([^=\"]*?)\" method=\"post\">");
private static final Pattern PATTERN_ARCHIVE = Pattern.compile("<a href=\"[^\"]*\" onclick=\"return do_hathdl\\('([0-9]+|org)'\\)\">([^<]+)</a>");
@SuppressWarnings("unchecked")
public static Pair<String, Pair<String, String>[]> parse(String body) {
Matcher m = PATTERN_FORM.matcher(body);
if (!m.find()) {
return new Pair<String, Pair<String, String>[]>("", new Pair[0]);
}
String paramOr = m.group(1);
List<Pair<String, String>> archiveList = new ArrayList<>();
m = PATTERN_ARCHIVE.matcher(body);
while (m.find()) {
String res = ParserUtils.trim(m.group(1));
String name = ParserUtils.trim(m.group(2));
Pair<String, String> item = new Pair<>(res, name);
archiveList.add(item);
}
return new Pair<String, Pair<String, String>[]>(paramOr, archiveList.toArray(new Pair[archiveList.size()]));
}
}
@@ -20,6 +20,8 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryComment;
import com.hippo.ehviewer.client.data.GalleryDetail;
@@ -56,6 +58,7 @@ public class GalleryDetailParser {
private static final Pattern PATTERN_ERROR = Pattern.compile("<div class=\"d\">\n<p>([^<]+)</p>");
private static final Pattern PATTERN_DETAIL = Pattern.compile("var gid = (\\d+);.+?var token = \"([a-f0-9]+)\";.+?var apiuid = ([\\-\\d]+);.+?var apikey = \"([a-f0-9]+)\";", Pattern.DOTALL);
private static final Pattern PATTERN_TORRENT = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)</a>");
private static final Pattern PATTERN_ARCHIVE = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Archive Download</a>");
private static final Pattern PATTERN_TAG_GROUP = Pattern.compile("<tr><td[^<>]+>([\\w\\s]+):</td><td>(?:<div[^<>]+><a[^<>]+>[\\w\\s]+</a></div>)+</td></tr>");
private static final Pattern PATTERN_TAG = Pattern.compile("<div[^<>]+><a[^<>]+>([\\w\\s]+)</a></div>");
private static final Pattern PATTERN_COMMENT = Pattern.compile("<div class=\"c3\">Posted on ([^<>]+) by: &nbsp; <a[^<>]+>([^<>]+)</a>.+?<div class=\"c6\"[^>]*>(.+?)</div><div class=\"c[78]\"");
@@ -124,6 +127,13 @@ public class GalleryDetailParser {
gd.torrentUrl = "";
}
matcher = PATTERN_ARCHIVE.matcher(body);
if (matcher.find()) {
gd.archiveUrl = StringUtils.unescapeXml(StringUtils.trim(matcher.group(1)));
} else {
gd.archiveUrl = "";
}
try {
Element gm = JsoupUtils.getElementByClass(d, "gm");
@@ -511,6 +521,9 @@ public class GalleryDetailParser {
String pageUrl = element.attr("href");
element = element.child(0);
String imageUrl = element.attr("src");
if (Settings.getFixThumbUrl()) {
imageUrl = EhUrl.getFixedPreviewThumbUrl(imageUrl);
}
int index = Integer.parseInt(element.attr("alt")) - 1;
largePreviewSet.addItem(index, imageUrl, pageUrl);
}
@@ -529,8 +542,13 @@ public class GalleryDetailParser {
LargePreviewSet largePreviewSet = new LargePreviewSet();
while (m.find()) {
largePreviewSet.addItem(ParserUtils.parseInt(m.group(2)) - 1,
ParserUtils.trim(m.group(3)), ParserUtils.trim(m.group(1)));
int index = ParserUtils.parseInt(m.group(2)) - 1;
String imageUrl = ParserUtils.trim(m.group(3));
String pageUrl = ParserUtils.trim(m.group(1));
if (Settings.getFixThumbUrl()) {
imageUrl = EhUrl.getFixedPreviewThumbUrl(imageUrl);
}
largePreviewSet.addItem(index, imageUrl, pageUrl);
}
if (largePreviewSet.size() == 0) {
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
public final class GalleryDetailUrlParser {
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
@Nullable
public static Result parse(String url) {
@@ -29,7 +29,7 @@ import java.net.URLDecoder;
public final class GalleryListUrlParser {
private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_G, EhUrl.DOMAIN_LOFI};
private static final String[] VALID_HOSTS = {EhUrl.DOMAIN_EX, EhUrl.DOMAIN_E, EhUrl.DOMAIN_LOFI};
private static final String PATH_NORMAL = "/";
private static final String PATH_UPLOADER = "/uploader/";
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
public class GalleryPageParser {
private static final Pattern PATTERN_IMAGE_URL = Pattern.compile("<(?:/iframe|div id=\"i3\")[^>]*><a[^>]+><img[^>]*src=\"(.+?)\"");
private static final Pattern PATTERN_IMAGE_URL = Pattern.compile("<img[^>]*src=\"([^\"]+)\" style");
private static final Pattern PATTERN_SKIP_HATH_KEY = Pattern.compile("onclick=\"return nl\\('([^\\)]+)'\\)");
private static final Pattern PATTERN_ORIGIN_IMAGE_URL = Pattern.compile("<a href=\"([^\"]+)fullimg.php([^\"]+)\">");
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
public final class GalleryPageUrlParser {
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_E + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
public static Result parse(String url) {
if (url == null) {
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
public class TorrentParser {
private static final Pattern PATTERN_TORRENT = Pattern.compile("<td colspan=\"5\"> &nbsp; <a href=\"([^\"]+)\">([^<]+)</a></td>");
private static final Pattern PATTERN_TORRENT = Pattern.compile("<td colspan=\"5\"> &nbsp; <a href=\"([^\"]+)\"[^<]+>([^<]+)</a></td>");
@SuppressWarnings("unchecked")
public static Pair<String, String>[] parse(String body) {
@@ -389,7 +389,6 @@ public class FavoritesScene extends BaseScene implements
if (1 == mHelper.getShownViewIndex()) {
mHasFirstRefresh = false;
}
mHelper = null;
}
if (null != mRecyclerView) {
mRecyclerView.stopScroll();
@@ -74,6 +74,7 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.client.data.GalleryTagGroup;
import com.hippo.ehviewer.client.data.ListUrlBuilder;
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;
@@ -100,6 +101,7 @@ import com.hippo.widget.LoadImageView;
import com.hippo.widget.ObservedTextView;
import com.hippo.widget.ProgressView;
import com.hippo.widget.SimpleGridAutoSpanLayout;
import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.IOUtils;
import com.hippo.yorozuya.SimpleHandler;
import com.hippo.yorozuya.ViewUtils;
@@ -202,6 +204,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
@Nullable
private TextView mTorrent;
@Nullable
private TextView mArchive;
@Nullable
private TextView mShare;
@Nullable
private TextView mRate;
@@ -250,6 +254,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
private Pair<String, String>[] mTorrentList;
private String mArchiveFormParamOr;
private Pair<String, String>[] mArchiveList;
@State
private int mState = STATE_INIT;
@@ -464,18 +471,21 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mHeart = (TextView) ViewUtils.$$(mHeartGroup, R.id.heart);
mHeartOutline = (TextView) ViewUtils.$$(mHeartGroup, R.id.heart_outline);
mTorrent = (TextView) ViewUtils.$$(mActions, R.id.torrent);
mArchive = (TextView) ViewUtils.$$(mActions, R.id.archive);
mShare = (TextView) ViewUtils.$$(mActions, R.id.share);
mRate = (TextView) ViewUtils.$$(mActions, R.id.rate);
mSimilar = (TextView) ViewUtils.$$(mActions, R.id.similar);
mSearchCover = (TextView) ViewUtils.$$(mActions, R.id.search_cover);
Ripple.addRipple(mHeartGroup, false);
Ripple.addRipple(mTorrent, false);
Ripple.addRipple(mArchive, false);
Ripple.addRipple(mShare, false);
Ripple.addRipple(mRate, false);
Ripple.addRipple(mSimilar, false);
Ripple.addRipple(mSearchCover, false);
mHeartGroup.setOnClickListener(this);
mTorrent.setOnClickListener(this);
mArchive.setOnClickListener(this);
mShare.setOnClickListener(this);
mRate.setOnClickListener(this);
mSimilar.setOnClickListener(this);
@@ -564,6 +574,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mHeart = null;
mHeartOutline = null;
mTorrent = null;
mArchive = null;
mShare = null;
mRate = null;
mSimilar = null;
@@ -647,6 +658,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
setActionDrawable(mHeartOutline, heartOutline);
Drawable torrent = DrawableManager.getDrawable(context, R.drawable.v_utorrent_primary_x48);
setActionDrawable(mTorrent, torrent);
Drawable archive = DrawableManager.getDrawable(context, R.drawable.v_archive_primary_x48);
setActionDrawable(mArchive, archive);
Drawable share = DrawableManager.getDrawable(context, R.drawable.v_share_primary_x48);
setActionDrawable(mShare, share);
Drawable rate = DrawableManager.getDrawable(context, R.drawable.v_thumb_up_primary_x48);
@@ -1166,6 +1179,21 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
.show();
helper.setDialog(dialog, mGalleryDetail.torrentUrl);
}
} else if (mArchive == v) {
if (mGalleryDetail == null) {
return;
}
if (mGalleryDetail.apiUid < 0) {
showTip(R.string.sign_in_first, LENGTH_SHORT);
return;
}
ArchiveListDialogHelper helper = new ArchiveListDialogHelper();
Dialog dialog = new AlertDialog.Builder(context)
.setTitle(R.string.dialog_archive_title)
.setView(R.layout.dialog_archive_list)
.setOnDismissListener(helper)
.show();
helper.setDialog(dialog, mGalleryDetail.archiveUrl);
} else if (mRate == v) {
if (mGalleryDetail == null) {
return;
@@ -1546,6 +1574,150 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
}
}
private class DownloadArchiveListener extends EhCallback<GalleryDetailScene, Void> {
public DownloadArchiveListener(Context context, int stageId, String sceneTag) {
super(context, stageId, sceneTag);
}
@Override
public void onSuccess(Void result) {
showTip(R.string.download_archive_started, LENGTH_SHORT);
}
@Override
public void onFailure(Exception e) {
if (e instanceof NoHAtHClientException) {
showTip(R.string.download_archive_failure_no_hath, LENGTH_SHORT);
} else {
showTip(R.string.download_archive_failure, LENGTH_SHORT);
}
}
@Override
public void onCancel() {}
@Override
public boolean isInstance(SceneFragment scene) {
return scene instanceof GalleryDetailScene;
}
}
private class ArchiveListDialogHelper implements AdapterView.OnItemClickListener,
DialogInterface.OnDismissListener, EhClient.Callback<Pair<String, Pair<String, String>[]>> {
@Nullable
private ProgressView mProgressView;
@Nullable
private TextView mErrorText;
@Nullable
private ListView mListView;
@Nullable
private EhRequest mRequest;
@Nullable
private Dialog mDialog;
public void setDialog(@Nullable Dialog dialog, String url) {
mDialog = dialog;
mProgressView = (ProgressView) ViewUtils.$$(dialog, R.id.progress);
mErrorText = (TextView) ViewUtils.$$(dialog, R.id.text);
mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
mListView.setOnItemClickListener(this);
Context context = getContext2();
if (context != null) {
if (mArchiveList == null) {
mErrorText.setVisibility(View.GONE);
mListView.setVisibility(View.GONE);
mRequest = new EhRequest().setMethod(EhClient.METHOD_ARCHIVE_LIST)
.setArgs(url)
.setCallback(this);
EhApplication.getEhClient(context).execute(mRequest);
} else {
bind(mArchiveList);
}
}
}
private void bind(Pair<String, String>[] data) {
if (null == mDialog || null == mProgressView || null == mErrorText || null == mListView) {
return;
}
if (0 == data.length) {
mProgressView.setVisibility(View.GONE);
mErrorText.setVisibility(View.VISIBLE);
mListView.setVisibility(View.GONE);
mErrorText.setText(R.string.no_archives);
} else {
String[] nameArray = new String[data.length];
for (int i = 0, n = data.length; i < n; i++) {
nameArray[i] = data[i].second;
}
mProgressView.setVisibility(View.GONE);
mErrorText.setVisibility(View.GONE);
mListView.setVisibility(View.VISIBLE);
mListView.setAdapter(new ArrayAdapter<>(mDialog.getContext(), R.layout.item_select_dialog, nameArray));
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Context context = getContext2();
MainActivity activity = getActivity2();
if (null != context && null != activity && null != mArchiveList && position < mArchiveList.length) {
String res = mArchiveList[position].first;
EhRequest request = new EhRequest();
request.setMethod(EhClient.METHOD_DOWNLOAD_ARCHIVE);
request.setArgs(mGalleryDetail.gid, mGalleryDetail.token, mArchiveFormParamOr, res);
request.setCallback(new DownloadArchiveListener(context, activity.getStageId(), getTag()));
EhApplication.getEhClient(context).execute(request);
}
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
}
}
@Override
public void onDismiss(DialogInterface dialog) {
if (mRequest != null) {
mRequest.cancel();
mRequest = null;
}
mDialog = null;
mProgressView = null;
mErrorText = null;
mListView = null;
}
@Override
public void onSuccess(Pair<String, Pair<String, String>[]> result) {
if (mRequest != null) {
mRequest = null;
mArchiveFormParamOr = result.first;
mArchiveList = result.second;
bind(result.second);
}
}
@Override
public void onFailure(Exception e) {
mRequest = null;
Context context = getContext2();
if (null != context && null != mProgressView && null != mErrorText && null != mListView) {
mProgressView.setVisibility(View.GONE);
mErrorText.setVisibility(View.VISIBLE);
mListView.setVisibility(View.GONE);
mErrorText.setText(ExceptionUtils.getReadableString(e));
}
}
@Override
public void onCancel() { mRequest = null; }
}
private class TorrentListDialogHelper implements AdapterView.OnItemClickListener,
DialogInterface.OnDismissListener, EhClient.Callback<Pair<String, String>[]> {
@@ -1612,7 +1784,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
String name = mTorrentList[position].second;
// Use system download service
DownloadManager.Request r = new DownloadManager.Request(Uri.parse(url));
r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, name + ".torrent");
r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
FileUtils.sanitizeFilename(name + ".torrent"));
r.allowScanningByMediaScanner();
r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
@@ -518,7 +518,6 @@ public final class GalleryListScene extends BaseScene
if (1 == mHelper.getShownViewIndex()) {
mHasFirstRefresh = false;
}
mHelper = null;
}
if (null != mRecyclerView) {
mRecyclerView.stopScroll();
@@ -174,7 +174,6 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
if (1 == mHelper.getShownViewIndex()) {
mHasFirstRefresh = false;
}
mHelper = null;
}
if (null != mRecyclerView) {
mRecyclerView.stopScroll();
@@ -74,7 +74,7 @@ public class SelectSiteScene extends SolidScene implements View.OnClickListener
switch (id) {
case R.id.site_e:
Settings.putSelectSite(false);
Settings.putGallerySite(EhUrl.SITE_G);
Settings.putGallerySite(EhUrl.SITE_E);
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
finish();
break;
@@ -226,8 +226,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
} else if (mSignInViaCookies == v) {
startScene(new Announcer(CookieSignInScene.class).setRequestCode(this, REQUEST_CODE_COOKIE));
} else if (mSkipSigningIn == v) {
// Set gallery size SITE_G if skip sign in
Settings.putGallerySite(EhUrl.SITE_G);
// Set gallery size SITE_E if skip sign in
Settings.putGallerySite(EhUrl.SITE_E);
redirectTo();
}
}
@@ -457,9 +457,11 @@ public class ContentLayout extends FrameLayout {
showContent();
// RecyclerView scroll
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
if (mRecyclerView.isAttachedToWindow()) {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
}
}
break;
case TYPE_PRE_PAGE:
@@ -485,7 +487,7 @@ public class ContentLayout extends FrameLayout {
mRefreshLayout.setFooterRefreshing(false);
showContent();
if (mCurrentTaskType == TYPE_PRE_PAGE) {
if (mCurrentTaskType == TYPE_PRE_PAGE && mRecyclerView.isAttachedToWindow()) {
// RecyclerView scroll, to top
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
@@ -510,15 +512,17 @@ public class ContentLayout extends FrameLayout {
mRefreshLayout.setFooterRefreshing(false);
showContent();
// RecyclerView scroll
if (mCurrentTaskType == TYPE_PRE_PAGE_KEEP_POS) {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionProperly(mRecyclerView.getLayoutManager(), getContext(),
dataSize - 1, mOnScrollToPositionListener);
} else {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
if (mRecyclerView.isAttachedToWindow()) {
// RecyclerView scroll
if (mCurrentTaskType == TYPE_PRE_PAGE_KEEP_POS) {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionProperly(mRecyclerView.getLayoutManager(), getContext(),
dataSize - 1, mOnScrollToPositionListener);
} else {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
}
}
}
break;
@@ -542,7 +546,7 @@ public class ContentLayout extends FrameLayout {
mRefreshLayout.setFooterRefreshing(false);
showContent();
if (mCurrentTaskType == TYPE_NEXT_PAGE) {
if (mCurrentTaskType == TYPE_NEXT_PAGE && mRecyclerView.isAttachedToWindow()) {
// RecyclerView scroll
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
@@ -567,13 +571,15 @@ public class ContentLayout extends FrameLayout {
mRefreshLayout.setFooterRefreshing(false);
showContent();
if (mCurrentTaskType == TYPE_NEXT_PAGE_KEEP_POS) {
mRecyclerView.stopScroll();
mRecyclerView.smoothScrollBy(0, mNextPageScrollSize);
} else {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
onScrollToPosition(oldDataSize);
if (mRecyclerView.isAttachedToWindow()) {
if (mCurrentTaskType == TYPE_NEXT_PAGE_KEEP_POS) {
mRecyclerView.stopScroll();
mRecyclerView.smoothScrollBy(0, mNextPageScrollSize);
} else {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
onScrollToPosition(oldDataSize);
}
}
}
break;
@@ -614,10 +620,12 @@ public class ContentLayout extends FrameLayout {
mRefreshLayout.setFooterRefreshing(false);
showContent();
// RecyclerView scroll
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
if (mRecyclerView.isAttachedToWindow()) {
// RecyclerView scroll
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
onScrollToPosition(0);
}
}
break;
case TYPE_REFRESH_PAGE:
@@ -651,7 +659,7 @@ public class ContentLayout extends FrameLayout {
showContent();
// RecyclerView scroll
if (newIndexEnd > oldIndexEnd && newIndexEnd > 0) {
if (newIndexEnd > oldIndexEnd && newIndexEnd > 0 && mRecyclerView.isAttachedToWindow()) {
mRecyclerView.stopScroll();
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), newIndexEnd - 1, 0);
onScrollToPosition(newIndexEnd - 1);
@@ -0,0 +1,29 @@
<?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.
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/colorPrimary"
android:pathData="@string/pd_archive"/>
</vector>
@@ -0,0 +1,44 @@
<?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.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/abc_dialog_padding_top_material"
android:paddingBottom="@dimen/abc_dialog_padding_top_material">
<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"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
@@ -67,10 +67,11 @@
</FrameLayout>
<TextView
android:id="@+id/torrent"
android:id="@+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/rate"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
@@ -84,11 +85,19 @@
android:textColor="@color/primary_text_light"/>
<TextView
android:id="@+id/rate"
android:id="@+id/torrent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/rate"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
<TextView
android:id="@+id/archive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/archive"
android:gravity="center_horizontal"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

+18 -11
View File
@@ -29,10 +29,10 @@
<string name="username">用户名</string>
<string name="password">密码</string>
<string name="sign_in">登陆</string>
<string name="sign_in">登录</string>
<string name="register">注册</string>
<string name="sign_in_via_webview">通过网页登陆</string>
<string name="sign_in_via_cookies">通过 Cookie 登陆</string>
<string name="sign_in_via_webview">通过网页登录</string>
<string name="sign_in_via_cookies">通过 Cookie 登录</string>
<string name="display_name_dialog_title">输入昵称</string>
<string name="display_name">昵称</string>
<string name="display_name_is_empty">昵称为空</string>
@@ -40,7 +40,7 @@
<string name="default_display_name">Little Hippo</string>
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n请输入特定的 Cookie 来登陆。</string>
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n请输入特定的 Cookie 来登录。</string>
<string name="text_is_empty">文本为空</string>
<string name="waring">警告</string>
<string name="wrong_cookie_warning">看起来您输入的 Cookie 是错误的,最好检查一下。</string>
@@ -81,9 +81,9 @@
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的任何后果负责。</string>
<string name="error_username_cannot_empty">用户名不可为空</string>
<string name="error_password_cannot_empty">密码不可为空</string>
<string name="skip_signing_in">跳过登陆</string>
<string name="sign_in_failed">登陆失败</string>
<string name="sign_in_failed_plain">这可能是网站更新导致的,也有可能是发生了奇怪的事情。您可以选择在登陆按钮下方通过网页登陆或者输入 cookie,或者跳过登陆。跳过登陆可能导致无法正常使用应用。如果你已经在 0.6.x 版登陆过了,请优先尝试选择“通过 Cookie 登陆”。</string>
<string name="skip_signing_in">跳过登录</string>
<string name="sign_in_failed">登录失败</string>
<string name="sign_in_failed_plain">这可能是网站更新导致的,也有可能是发生了奇怪的事情。您可以选择在登录按钮下方通过网页登录或者输入 cookie,或者跳过登录。跳过登录可能导致无法正常使用应用。如果你已经在 0.6.x 版登录过了,请优先尝试选择“通过 Cookie 登录”。</string>
<string name="press_twice_exit">再按一次退出</string>
<string name="content_layout_restore_tip">点击重试</string>
<string name="write_rationale">EhViewer 将申请设备存储空间访问权限以便下载画廊。您愿意授权吗?</string>
@@ -99,7 +99,7 @@
<!-- Select scene -->
<string name="select_scene">你想选择哪个画廊站点?</string>
<string name="select_scene_explain">e-hentai:对任何人开放\nexhentai:仅对登陆用户开放</string>
<string name="select_scene_explain">e-hentai:对任何人开放\nexhentai:仅对登录用户开放</string>
<string name="no_select">请选择一个站点</string>
<!-- Update -->
@@ -354,11 +354,11 @@
<!-- Settings -->
<string name="settings_eh">EH</string>
<string name="settings_eh_sign_out">退出登陆</string>
<string name="settings_eh_sign_out_summary">退出登陆后重启应用以便再次登陆</string>
<string name="settings_eh_sign_out">退出登录</string>
<string name="settings_eh_sign_out_summary">退出登录后重启应用以便再次登录</string>
<string name="settings_eh_sign_out_warning">天哪,我的老伙计,你要退出登录吗?我是说,你真的要退出登录吗?</string>
<string name="settings_eh_sign_out_yes">是的,我是说,真的</string>
<string name="settings_eh_sign_out_tip">已退出登陆,重启应用以便再次登陆</string>
<string name="settings_eh_sign_out_tip">已退出登录,重启应用以便再次登录</string>
<string name="settings_eh_gallery_site">画廊站点</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">详情</string>
@@ -373,6 +373,7 @@
<string name="settings_eh_thumb_resolution">缩略图分辨率</string>
<string name="settings_eh_thumb_resolution_summary">%s,指定分辨率可能使获取缩略图失败</string>
<string name="settings_eh_thumb_resolution_auto">自动</string>
<string name="settings_eh_fix_thumb_url">修正缩略图链接</string>
<string name="settings_eh_default_categories">主页分类显示</string>
<string name="settings_eh_default_categories_summary">默认在主页所显示的分类</string>
<string name="settings_eh_excluded_tag_namespaces">排除标签组</string>
@@ -604,5 +605,11 @@
<plurals name="year">
<item quantity="other">年</item>
</plurals>
<string name="dialog_archive_title">通过 H@H 下载</string>
<string name="no_archives">没有压缩包</string>
<string name="download_archive_started">开始下载压缩包</string>
<string name="download_archive_failure">无法下载压缩包</string>
<string name="archive">压缩包</string>
<string name="download_archive_failure_no_hath">下载压缩包需要 H@H 客户端</string>
</resources>
+18 -11
View File
@@ -29,10 +29,10 @@
<string name="username">用户名</string>
<string name="password">密碼</string>
<string name="sign_in">登陸</string>
<string name="sign_in">登錄</string>
<string name="register">註冊</string>
<string name="sign_in_via_webview">通過網頁登陸</string>
<string name="sign_in_via_cookies">通過 Cookie 登陸</string>
<string name="sign_in_via_webview">通過網頁登錄</string>
<string name="sign_in_via_cookies">通過 Cookie 登錄</string>
<string name="display_name_dialog_title">輸入暱稱</string>
<string name="display_name">暱稱</string>
<string name="display_name_is_empty">暱稱為空</string>
@@ -40,7 +40,7 @@
<string name="default_display_name">Little Hippo</string>
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n請輸入特定的 Cookie 來登陸。</string>
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n請輸入特定的 Cookie 來登錄。</string>
<string name="text_is_empty">文本為空</string>
<string name="waring">警告</string>
<string name="wrong_cookie_warning">看起來您輸入的 Cookie 是錯誤的,最好檢查一下。</string>
@@ -81,9 +81,9 @@
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。</string>
<string name="error_username_cannot_empty">用户名不可為空</string>
<string name="error_password_cannot_empty">密碼不可為空</string>
<string name="skip_signing_in">跳過登陸</string>
<string name="sign_in_failed">登陸失敗</string>
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登陸按鈕下方通過網頁登陸或者輸入 cookie,或者跳過登陸。跳過登陸可能導致無法正常使用應用。如果你已經在 0.6.x 版登陸過了,請優先嚐試選擇“通過 Cookie 登陸”。</string>
<string name="skip_signing_in">跳過登錄</string>
<string name="sign_in_failed">登錄失敗</string>
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登錄按鈕下方通過網頁登錄或者輸入 cookie,或者跳過登錄。跳過登錄可能導致無法正常使用應用。如果你已經在 0.6.x 版登錄過了,請優先嚐試選擇“通過 Cookie 登錄”。</string>
<string name="press_twice_exit">再按一次退出</string>
<string name="content_layout_restore_tip">點擊重試</string>
<string name="write_rationale">EhViewer 將申請設備存儲空間訪問權限以便下載畫廊。您願意授權嗎?</string>
@@ -99,7 +99,7 @@
<!-- Select scene -->
<string name="select_scene">你想選擇哪個畫廊站點?</string>
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登陸用户開放</string>
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登錄用户開放</string>
<string name="no_select">請選擇一個站點</string>
<!-- Update -->
@@ -354,11 +354,11 @@
<!-- Settings -->
<string name="settings_eh">EH</string>
<string name="settings_eh_sign_out">退出登陸</string>
<string name="settings_eh_sign_out_summary">退出登陸後重啟應用以便再次登陸</string>
<string name="settings_eh_sign_out">退出登錄</string>
<string name="settings_eh_sign_out_summary">退出登錄後重啟應用以便再次登錄</string>
<string name="settings_eh_sign_out_warning">天哪,我的老夥計,你要退出登錄嗎?我是説,你真的要退出登錄嗎?</string>
<string name="settings_eh_sign_out_yes">是的,我是説,真的</string>
<string name="settings_eh_sign_out_tip">已退出登陸,重啟應用以便再次登陸</string>
<string name="settings_eh_sign_out_tip">已退出登錄,重啟應用以便再次登錄</string>
<string name="settings_eh_gallery_site">畫廊站點</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">詳情</string>
@@ -373,6 +373,7 @@
<string name="settings_eh_thumb_resolution">縮略圖分辨率</string>
<string name="settings_eh_thumb_resolution_summary">%s,指定分辨率可能使獲取縮略圖失敗</string>
<string name="settings_eh_thumb_resolution_auto">自動</string>
<string name="settings_eh_fix_thumb_url">修正縮略圖鏈接</string>
<string name="settings_eh_default_categories">主頁分類顯示</string>
<string name="settings_eh_default_categories_summary">默認在主頁所顯示的分類</string>
<string name="settings_eh_excluded_tag_namespaces">排除標籤組</string>
@@ -604,5 +605,11 @@
<plurals name="year">
<item quantity="other">年</item>
</plurals>
<string name="dialog_archive_title">通過 H@H 下載</string>
<string name="no_archives">沒有壓縮包</string>
<string name="download_archive_started">開始下載壓縮包</string>
<string name="download_archive_failure">無法下載壓縮包</string>
<string name="archive">壓縮包</string>
<string name="download_archive_failure_no_hath">下載壓縮包需要 H@H 客户端</string>
</resources>
+18 -11
View File
@@ -29,10 +29,10 @@
<string name="username">使用者名稱</string>
<string name="password">密碼</string>
<string name="sign_in">登陸</string>
<string name="sign_in">登入</string>
<string name="register">註冊</string>
<string name="sign_in_via_webview">通過網頁登陸</string>
<string name="sign_in_via_cookies">通過 Cookie 登陸</string>
<string name="sign_in_via_webview">通過網頁登入</string>
<string name="sign_in_via_cookies">通過 Cookie 登入</string>
<string name="display_name_dialog_title">輸入暱稱</string>
<string name="display_name">暱稱</string>
<string name="display_name_is_empty">暱稱為空</string>
@@ -40,7 +40,7 @@
<string name="default_display_name">Little Hippo</string>
<string name="cookie_explain">Cookie 是儲存在瀏覽器裡的一小塊資料。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜尋一下。\n\n請輸入特定的 Cookie 來登陸。</string>
<string name="cookie_explain">Cookie 是儲存在瀏覽器裡的一小塊資料。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜尋一下。\n\n請輸入特定的 Cookie 來登入。</string>
<string name="text_is_empty">文字為空</string>
<string name="waring">警告</string>
<string name="wrong_cookie_warning">看起來您輸入的 Cookie 是錯誤的,最好檢查一下。</string>
@@ -81,9 +81,9 @@
<string name="app_waring">本應用中內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。</string>
<string name="error_username_cannot_empty">使用者名稱不可為空</string>
<string name="error_password_cannot_empty">密碼不可為空</string>
<string name="skip_signing_in">跳過登陸</string>
<string name="sign_in_failed">登陸失敗</string>
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登陸按鈕下方通過網頁登陸或者輸入 cookie,或者跳過登陸。跳過登陸可能導致無法正常使用應用。如果你已經在 0.6.x 版登陸過了,請優先嚐試選擇“通過 Cookie 登陸”。</string>
<string name="skip_signing_in">跳過登入</string>
<string name="sign_in_failed">登入失敗</string>
<string name="sign_in_failed_plain">這可能是網站更新導致的,也有可能是發生了奇怪的事情。您可以選擇在登入按鈕下方通過網頁登入或者輸入 cookie,或者跳過登入。跳過登入可能導致無法正常使用應用。如果你已經在 0.6.x 版登入過了,請優先嚐試選擇“通過 Cookie 登入”。</string>
<string name="press_twice_exit">再按一次退出</string>
<string name="content_layout_restore_tip">點選重試</string>
<string name="write_rationale">EhViewer 將申請裝置儲存空間訪問許可權以便下載畫廊。您願意授權嗎?</string>
@@ -99,7 +99,7 @@
<!-- Select scene -->
<string name="select_scene">你想選擇哪個畫廊站點?</string>
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登陸使用者開放</string>
<string name="select_scene_explain">e-hentai:對任何人開放\nexhentai:僅對登入使用者開放</string>
<string name="no_select">請選擇一個站點</string>
<!-- Update -->
@@ -354,11 +354,11 @@
<!-- Settings -->
<string name="settings_eh">EH</string>
<string name="settings_eh_sign_out">退出登陸</string>
<string name="settings_eh_sign_out_summary">退出登陸後重啟應用以便再次登陸</string>
<string name="settings_eh_sign_out">退出登入</string>
<string name="settings_eh_sign_out_summary">退出登入後重啟應用以便再次登入</string>
<string name="settings_eh_sign_out_warning">天哪,我的老夥計,你要退出登入嗎?我是說,你真的要退出登入嗎?</string>
<string name="settings_eh_sign_out_yes">是的,我是說,真的</string>
<string name="settings_eh_sign_out_tip">已退出登陸,重啟應用以便再次登陸</string>
<string name="settings_eh_sign_out_tip">已退出登入,重啟應用以便再次登入</string>
<string name="settings_eh_gallery_site">畫廊站點</string>
<string name="settings_eh_list_mode">列表模式</string>
<string name="settings_eh_list_mode_detail">詳情</string>
@@ -373,6 +373,7 @@
<string name="settings_eh_thumb_resolution">縮圖解析度</string>
<string name="settings_eh_thumb_resolution_summary">%s,指定解析度可能使獲取縮圖失敗</string>
<string name="settings_eh_thumb_resolution_auto">自動</string>
<string name="settings_eh_fix_thumb_url">修正縮圖連結</string>
<string name="settings_eh_default_categories">主頁分類顯示</string>
<string name="settings_eh_default_categories_summary">預設在主頁所顯示的分類</string>
<string name="settings_eh_excluded_tag_namespaces">排除標籤組</string>
@@ -604,5 +605,11 @@
<plurals name="year">
<item quantity="other">年</item>
</plurals>
<string name="dialog_archive_title">通過 H@H 下載</string>
<string name="no_archives">沒有壓縮包</string>
<string name="download_archive_started">開始下載壓縮包</string>
<string name="download_archive_failure">無法下載壓縮包</string>
<string name="archive">壓縮包</string>
<string name="download_archive_failure_no_hath">下載壓縮包需要 H@H 客戶端</string>
</resources>
+1
View File
@@ -77,5 +77,6 @@
<string name="pd_sad_panda_nose" translatable="false">M12,17C12.8,17,13.5,17.4,13.5,18S12.8,19,12,19S10.5,18.6,10.5,18S11.2,17,12,17Z</string>
<string name="pd_sad_panda" translatable="false">M21.1,7.8C22.2,7.4,23,6.3,23,5C23,3.3,21.7,2,20,2C18.9,2,17.9,2.6,17.4,3.6L21.1,7.8M6.6,3.6C6.1,2.6,5.1,2,4,2C2.3,2,1,3.3,1,5C1,6.3,1.8,7.4,2.9,7.8L6.6,3.6M10.1,13L8,15.1C7.4,15.7,6.5,15.7,5.9,15.1L5.9,15.1C5.3,14.5,5.3,13.6,5.9,13L8,10.9C8.6,10.3,9.5,10.3,10.1,10.9L10.1,10.9C10.7,11.5,10.7,12.4,10.1,13M16,15.1L13.9,13C13.3,12.4,13.3,11.5,13.9,10.9L13.9,10.9C14.5,10.3,15.4,10.3,16,10.9L18.1,13C18.7,13.6,18.7,14.5,18.1,15.1L18.1,15.1C17.5,15.7,16.6,15.7,16,15.1M12,17C12.8,17,13.5,17.4,13.5,18S12.8,19,12,19S10.5,18.6,10.5,18S11.2,17,12,17Z</string>
<string name="pd_sad_panda_face" translatable="false">M17.4,3.6C15.8,2.6,14,2,12,2S8.2,2.6,6.6,3.6L2.9,7.8C2.3,9.1,2,10.5,2,12C2,17.5,6.5,22,12,22S22,17.5,22,12C22,10.5,21.7,9.1,21.1,7.8L17.4,3.6Z</string>
<string name="pd_archive" translatable="false">M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM10,17l-3.5,-3.5 1.41,-1.41L10,14.17 15.18,9l1.41,1.41L10,17z</string>
</resources>
+7
View File
@@ -416,6 +416,7 @@
<string name="settings_eh_thumb_resolution">Thumb resolution</string>
<string name="settings_eh_thumb_resolution_summary">%s, special resolutions might cause getting thumb failed</string>
<string name="settings_eh_thumb_resolution_auto">Auto</string>
<string name="settings_eh_fix_thumb_url">Fix thumb url</string>
<string name="settings_eh_default_categories">Categories on Homepage</string>
<string name="settings_eh_default_categories_summary">The categories shown as default on Homepage</string>
<string name="settings_eh_excluded_languages">Excluded languages</string>
@@ -654,5 +655,11 @@
<item quantity="one">year</item>
<item quantity="other">years</item>
</plurals>
<string name="dialog_archive_title">H@H Downloader</string>
<string name="no_archives">No Archives</string>
<string name="download_archive_started">Archive download started</string>
<string name="download_archive_failure">Failed to download archive</string>
<string name="archive">Archive</string>
<string name="download_archive_failure_no_hath">Need H@H client for archive download</string>
</resources>
+5
View File
@@ -64,6 +64,11 @@
app:entryValues="@array/thumb_resolution_entry_values"
android:defaultValue="0"/>
<com.hippo.preference.SwitchPreference
android:key="fix_thumb_url"
android:title="@string/settings_eh_fix_thumb_url"
android:defaultValue="false"/>
<com.hippo.ehviewer.preference.DefaultCategoryPreference
android:key="default_categories"
android:title="@string/settings_eh_default_categories"
+2
View File
@@ -3,9 +3,11 @@
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.seven332:android-chinese-string-gradle-plugin:0.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files