Compare commits

..
34 Commits
Author SHA1 Message Date
seven332 ba6d41b91f DEPRECATED 2019-08-09 12:50:16 +08:00
seven332 6a9e0198a2 Add cookie to torrent request 2019-08-07 11:05:38 +08:00
seven332 92f716170c Fix plain txt checking 2019-08-07 09:55:21 +08:00
seven332 d72f686d5a Fix data exporting 2019-08-01 17:02:36 +08:00
seven332 28eade9451 Fix check plain txt 2019-07-31 20:06:02 +08:00
seven332 7b95bc804a Check plain text after downloading 2019-07-31 19:41:51 +08:00
seven332 47c9d48787 Close #659, fix parsing gallery parent 2019-07-29 14:04:27 +08:00
seven332 8a7adbe838 1.7.3 2019-07-27 01:35:04 +08:00
seven332 0248fd4e02 Add kokomade tip 2019-07-26 21:22:26 +08:00
seven332 1cd5f7bbf7 Update libraries 2019-07-13 13:16:27 +08:00
seven332 db893b899d Add preset download dir 2019-07-13 12:59:51 +08:00
seven332 d86dd3bc06 1.7.2 2019-07-01 10:28:12 +08:00
seven332 49f420c1eb Remove useless import 2019-07-01 10:23:41 +08:00
seven332 c9103caad8 Add a tip about signing in 2019-06-21 15:08:04 +08:00
seven332 ee0ffc48d2 Remove recaptcha 2019-06-21 13:41:37 +08:00
seven332 ed7eba7ef4 Update issue templates 2019-06-20 20:30:39 +08:00
seven332 b6a16d1d58 Filter uploader for thumbnail mode 2019-06-20 19:50:02 +08:00
seven332 04521dfeb6 Remove gallery if it's downloaded 2019-06-20 19:32:08 +08:00
seven332 d00f6e6cc6 Show a confirm dialog before deleting galleries 2019-06-20 18:48:16 +08:00
seven332 7a47b2504d Show icon in selection dialogs 2019-06-20 18:21:52 +08:00
seven332 2da10a5855 Show delete downloads option if the gallery is downloaded 2019-06-20 16:37:32 +08:00
seven332 323b36c58a Remove old github issue template 2019-06-20 16:18:46 +08:00
seven332 9834d45ca9 Close #627, add quotation marks to titles for similar galleries 2019-06-20 16:17:38 +08:00
seven332 c058bb01f0 Update issue templates 2019-06-20 15:37:44 +08:00
seven332 f578c6cb8b Merge pull request #624 from dntil/master
Add auto screen rotation support.
2019-06-17 10:53:50 +08:00
liqichang 2c43589c1c Add auto screen rotation support. 2019-06-16 10:04:41 +08:00
seven332 6e73f03c19 Apply theme color to navigation bar in default 2019-06-16 00:39:58 +08:00
seven332 b7e2c5bce1 Use org.apache.http.legacy
Avoid crash in com.tencent.open.utils.HttpUtils.getHttpClient
2019-06-16 00:30:38 +08:00
seven332 9707ac470a Fix GalleryHeader 2019-06-15 12:02:53 +08:00
seven332 06fd28290c Fix GalleryHeader 2019-06-14 20:33:41 +08:00
seven332 21ef5897ef Add GalleryHeader avoid notch 2019-06-14 16:06:04 +08:00
seven332 bdd45b5f10 Readable time is more readable 2019-06-10 20:26:30 +08:00
seven332 e68d4ad2c4 Show last edited time of comments 2019-06-10 19:41:24 +08:00
seven332 2e56ba4ed0 Convert gallery title to lowercase before checking filter 2019-06-10 14:27:45 +08:00
49 changed files with 986 additions and 599 deletions

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
感谢您提交 Issue,请在提交前仔细阅读以下信息。
请在阅读完毕后,删除这些文字,并写下对该 Issue 的描述。
若您能熟练使用现代标准汉语,请务必使用该语言描述 Issue。
Issue 的内容仅可为
* Bug 反馈
* 功能申请
若您希望得到使用指导(譬如如何删除快速搜索),请至 [G+ 社区](https://plus.google.com/u/1/communities/103823982034655188459) 发贴。若有其他问题,可在应用内找到开发者的邮箱地址,使用电子邮件与开发者交流。
若内容为 Bug 反馈,请先查看 [release 页面](https://github.com/seven332/EhViewer/releases),以帮助确认该 bug 是否存在于最新版中;同时应详细描述 bug 内容与重现方法,必要时可附加截图,但请确定截图符合风序良俗。
功能申请包括添加新功能与改进现有功能。
一个 Issue 只包含一个 Bug 反馈或者功能申请。若有多个需求,请提交多个 Issue。
尽量不提交重复的 Issue,可先进行搜索。对于重复的 Issue,开发者可能会直接关闭并添加 Duplicate 标签。
Thank you for taking the time to submit an issue. Before you proceed, please consider the following.
An issue can only be about:
* Bug Report
* Feature Request
If you need application instructions, please post your question in [G+ community](https://plus.google.com/u/1/communities/103823982034655188459). If you have other questions, please get the developer's email address in the application, and send him/her an email.
One issue one bug report or feature request.
@@ -0,0 +1,20 @@
---
name: 功能申请 / Feature request
about: 有个想法 / Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**这个功能是用来解决问题的吗? / Is your feature request related to a problem? Please describe.**
描述这个问题。
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**描述你想要的解决方法 / Describe the solution you'd like**
描述应通过何种行为来解决这个问题。
A clear and concise description of what you want to happen.
**备注 / Additional context**
还有别的想说的吗?
Add any other context or screenshots about the feature request here.
@@ -0,0 +1,41 @@
---
name: Bug 反馈 / Bug report
about: 出问题了 / Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**简略描述 / Describe the bug**
大概说下是什么问题。
A clear and concise description of what the bug is.
**如何重现 / To Reproduce**
重现的步骤:
1. 打开什么什么
2. 点击什么什么
3. 出现什么什么问题
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**预期行为 / Expected behavior**
应该是什么样子的?
A clear and concise description of what you expected to happen.
**截图 / Screenshots**
能截图的话就发截图,请注意风序良俗。
If applicable, add screenshots to help explain your problem.
**设备型号与 Android 版本 / Device model and Android version**
- 设备型号:【比如 Pixel 6 XXXL】
- Android 版本:【比如 Android 12.1】
- Device model: [e.g. Pixel 6 XXXL]
- Android version: [e.g. Android 12.1]
**备注 / Additional context**
还有什么想说的?
Add any other context about the problem here.
@@ -0,0 +1,11 @@
---
name: Sad Panda / 下载太慢 / Slow download speed
about: 所有其他问题 / All other questions
title: ''
labels: ''
assignees: ''
---
加入我们的 Telegram 群组,[https://t.me/ehviewer](https://t.me/ehviewer)。温柔[大小]姐姐手把手帮你解决问题。
Join our Telegram group, [https://t.me/ehviewer](https://t.me/ehviewer). Administrators will help you solve the problem.
+2
View File
@@ -1,3 +1,5 @@
# DEPRECATED
[![Telegram](https://img.shields.io/badge/chat-Telegram-blue.svg)](https://t.me/ehviewer)
# EhViewer
+3 -3
View File
@@ -12,8 +12,8 @@ android {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 28
versionCode 102
versionName "1.7.1-order"
versionCode 104
versionName "1.7.3"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
"es", "ja", "ko", "fr", "de", "th"
@@ -101,7 +101,7 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
implementation 'org.greenrobot:greendao:2.2.1'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'org.jsoup:jsoup:1.12.1'
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.2.1'
testImplementation 'org.jooq:joor:0.9.6'
+2
View File
@@ -39,6 +39,8 @@
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config">
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<meta-data android:name="android.max_aspect" android:value="2.1"/>
<activity
@@ -1,140 +0,0 @@
/*
* Copyright 2017 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.drawable;
/*
* Created by Hippo on 2017/9/6.
*/
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class TextDrawable extends Drawable {
private static final float STANDARD_TEXT_SIZE = 1000.0f;
private static final Paint STANDARD_PAINT = new Paint();
static {
STANDARD_PAINT.setTextSize(STANDARD_TEXT_SIZE);
}
private String text;
private float contentPercent;
private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private int textColor = Color.BLACK;
private int backgroundColor = Color.BLACK;
private float x = 0.0f;
private float y = 0.0f;
private boolean textSizeDirty = false;
private Rect textBounds = new Rect();
public TextDrawable(String text, float contentPercent) {
this.text = text;
this.contentPercent = contentPercent;
STANDARD_PAINT.getTextBounds(text, 0, text.length(), textBounds);
}
public int getTextColor() {
return textColor;
}
public void setTextColor(int textColor) {
if (this.textColor != textColor) {
this.textColor = textColor;
invalidateSelf();
}
}
public int getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(int backgroundColor) {
if (this.backgroundColor != backgroundColor) {
this.backgroundColor = backgroundColor;
invalidateSelf();
}
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
textSizeDirty = true;
}
private void updateTextSizeIfDirty(Rect bounds) {
if (!textSizeDirty) {
return;
}
textSizeDirty = false;
int contentWidth = (int) (bounds.width() * contentPercent);
int contentHeight = (int) (bounds.height() * contentPercent);
float widthRatio = (float) contentWidth / (float) textBounds.width();
float heightRatio = (float) contentHeight / (float) textBounds.height();
float ratio = Math.min(widthRatio, heightRatio);
float textSize = STANDARD_TEXT_SIZE * ratio;
textPaint.setTextSize(textSize);
x = (bounds.width() - textBounds.width() * ratio) / 2 - textBounds.left * ratio;
y = (bounds.height() - textBounds.height() * ratio) / 2 - textBounds.top * ratio;
}
@Override
public void draw(@NonNull Canvas canvas) {
Rect bounds = getBounds();
if (!bounds.isEmpty()) {
// Draw background
backgroundPaint.setColor(backgroundColor);
canvas.drawRect(bounds, backgroundPaint);
if (!TextUtils.isEmpty(text)) {
// Draw text
updateTextSizeIfDirty(bounds);
textPaint.setColor(textColor);
canvas.drawText(text, x, y, textPaint);
}
}
}
@Override
public void setAlpha(@IntRange(from = 0, to = 255) int alpha) {}
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
backgroundPaint.setColorFilter(colorFilter);
textPaint.setColorFilter(colorFilter);
invalidateSelf();
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
}
+57 -22
View File
@@ -44,10 +44,11 @@ import com.hippo.ehviewer.dao.QuickSearchDao;
import com.hippo.ehviewer.download.DownloadManager;
import com.hippo.util.ExceptionUtils;
import com.hippo.util.SqlUtils;
import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.IOUtils;
import com.hippo.yorozuya.ObjectUtils;
import com.hippo.yorozuya.collect.SparseJLArray;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.query.CloseableListIterator;
import de.greenrobot.dao.query.LazyList;
import java.io.File;
import java.io.FileInputStream;
@@ -645,30 +646,64 @@ public class EhDB {
sDaoSession.getFilterDao().update(filter);
}
public static synchronized boolean exportDB(Context context, File file) {
File dbFile = context.getDatabasePath("eh.db");
if (null == dbFile || !dbFile.isFile()) {
return false;
}
if (null == file || !FileUtils.ensureFile(file)) {
return false;
}
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(dbFile);
os = new FileOutputStream(file);
IOUtils.copy(is, os);
return true;
private static <T> boolean copyDao(AbstractDao<T, ?> from, AbstractDao<T, ?> to) {
try (CloseableListIterator<T> iterator = from.queryBuilder().listIterator()) {
while (iterator.hasNext()) {
to.insert(iterator.next());
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
public static synchronized boolean exportDB(Context context, File file) {
final String ehExportName = "eh.export.db";
// Delete old export db
context.deleteDatabase(ehExportName);
DBOpenHelper helper = new DBOpenHelper(context.getApplicationContext(), ehExportName, null);
try {
// Copy data to a export db
try (SQLiteDatabase db = helper.getWritableDatabase()) {
DaoMaster daoMaster = new DaoMaster(db);
DaoSession exportSession = daoMaster.newSession();
if (!copyDao(sDaoSession.getDownloadsDao(), exportSession.getDownloadsDao())) return false;
if (!copyDao(sDaoSession.getDownloadLabelDao(), exportSession.getDownloadLabelDao())) return false;
if (!copyDao(sDaoSession.getDownloadDirnameDao(), exportSession.getDownloadDirnameDao())) return false;
if (!copyDao(sDaoSession.getHistoryDao(), exportSession.getHistoryDao())) return false;
if (!copyDao(sDaoSession.getQuickSearchDao(), exportSession.getQuickSearchDao())) return false;
if (!copyDao(sDaoSession.getLocalFavoritesDao(), exportSession.getLocalFavoritesDao())) return false;
if (!copyDao(sDaoSession.getBookmarksBao(), exportSession.getBookmarksBao())) return false;
if (!copyDao(sDaoSession.getFilterDao(), exportSession.getFilterDao())) return false;
}
// Copy export db to data dir
File dbFile = context.getDatabasePath(ehExportName);
if (dbFile == null || !dbFile.isFile()) {
return false;
}
InputStream is = null;
OutputStream os = null;
try {
is = new FileInputStream(dbFile);
os = new FileOutputStream(file);
IOUtils.copy(is, os);
return true;
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(os);
}
// Delete failed file
file.delete();
return false;
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(os);
context.deleteDatabase(ehExportName);
}
// Delete failed file
file.delete();
return false;
}
/**
@@ -262,7 +262,7 @@ public class Settings {
}
public static final String KEY_APPLY_NAV_BAR_THEME_COLOR = "apply_nav_bar_theme_color";
private static final boolean DEFAULT_APPLY_NAV_BAR_THEME_COLOR = false;
private static final boolean DEFAULT_APPLY_NAV_BAR_THEME_COLOR = true;
public static boolean getApplyNavBarThemeColor() {
return getBoolean(KEY_APPLY_NAV_BAR_THEME_COLOR, DEFAULT_APPLY_NAV_BAR_THEME_COLOR);
@@ -138,7 +138,7 @@ public class EhClient {
try {
switch (mMethod) {
case METHOD_SIGN_IN:
return EhEngine.signIn(this, mOkHttpClient, (String) params[0], (String) params[1], (String) params[2], (String) params[3]);
return EhEngine.signIn(this, mOkHttpClient, (String) params[0], (String) params[1]);
case METHOD_GET_GALLERY_LIST:
return EhEngine.getGalleryList(this, mOkHttpClient, (String) params[0]);
case METHOD_GET_GALLERY_DETAIL:
@@ -77,6 +77,8 @@ public class EhEngine {
private static final String SAD_PANDA_TYPE = "image/gif";
private static final String SAD_PANDA_LENGTH = "9615";
private static final String KOKOMADE_URL = "https://exhentai.org/img/kokomade.jpg";
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");
@@ -101,6 +103,11 @@ public class EhEngine {
throw new EhException("Sad Panda");
}
// Check kokomade
if (body != null && body.contains(KOKOMADE_URL)) {
throw new EhException("今回はここまで\n\n" + GetText.getString(R.string.kokomade_tip));
}
if (e instanceof ParseException) {
if (body != null && !body.contains("<")) {
throw new EhException(body);
@@ -134,17 +141,13 @@ public class EhEngine {
}
public static String signIn(@Nullable EhClient.Task task, OkHttpClient okHttpClient,
String username, String password, String recaptchaChallenge, String recaptchaResponse) throws Throwable {
String username, String password) throws Throwable {
FormBody.Builder builder = new FormBody.Builder()
.add("UserName", username)
.add("PassWord", password)
.add("submit", "Log me in")
.add("CookieDate", "1")
.add("temporary_https", "off");
if (!TextUtils.isEmpty(recaptchaChallenge) && !TextUtils.isEmpty(recaptchaResponse)) {
builder.add("recaptcha_challenge_field", recaptchaChallenge);
builder.add("recaptcha_response_field", recaptchaResponse);
}
String url = EhUrl.API_SIGN_IN;
String referer = "https://forums.e-hentai.org/index.php?act=Login&CODE=00";
String origin = "https://forums.e-hentai.org";
@@ -214,7 +217,8 @@ public class EhEngine {
if (filter) {
for (int i = 0, n = list.size(); i < n; i++) {
GalleryInfo info = list.get(i);
if (!sEhFilter.filterTag(info) || !sEhFilter.filterTagNamespace(info)) {
// Thumbnail mode need filter uploader again
if (!sEhFilter.filterUploader(info) || !sEhFilter.filterTag(info) || !sEhFilter.filterTagNamespace(info)) {
list.remove(i);
i--;
n--;
@@ -158,7 +158,7 @@ public final class EhFilter {
List<Filter> filters = mTitleFilterList;
if (null != title && filters.size() > 0) {
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).enable && title.contains(filters.get(i).text)) {
if (filters.get(i).enable && title.toLowerCase().contains(filters.get(i).text)) {
return false;
}
}
@@ -33,6 +33,7 @@ public class GalleryComment implements Parcelable {
public long time;
public String user;
public String comment;
public long lastEdited;
@Override
public int describeContents() {
@@ -52,6 +53,7 @@ public class GalleryComment implements Parcelable {
dest.writeLong(this.time);
dest.writeString(this.user);
dest.writeString(this.comment);
dest.writeLong(this.lastEdited);
}
public GalleryComment() {
@@ -69,6 +71,7 @@ public class GalleryComment implements Parcelable {
this.time = in.readLong();
this.user = in.readString();
this.comment = in.readString();
this.lastEdited = in.readLong();
}
public static final Creator<GalleryComment> CREATOR = new Creator<GalleryComment>() {
@@ -272,7 +272,10 @@ public class GalleryDetailParser {
if (key.startsWith("Posted")) {
gd.posted = value;
} else if (key.startsWith("Parent")) {
gd.parent = value;
Element a = es.get(1).children().first();
if (a != null) {
gd.parent = a.attr("href");
}
} else if (key.startsWith("Visible")) {
gd.visible = value;
} else if (key.startsWith("Language")) {
@@ -444,6 +447,14 @@ public class GalleryDetailParser {
comment.user = c3.child(0).text();
// comment
comment.comment = JsoupUtils.getElementByClass(element, "c6").html();
// last edited
Element c8 = JsoupUtils.getElementByClass(element, "c8");
if (c8 != null) {
Element e = c8.children().first();
if (e != null) {
comment.lastEdited = WEB_COMMENT_DATE_FORMAT.parse(temp).getTime();
}
}
return comment;
} catch (Throwable e) {
ExceptionUtils.throwIfFatal(e);
@@ -0,0 +1,78 @@
/*
* 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.widget.Toast;
import androidx.annotation.NonNull;
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.EhDB;
import com.hippo.ehviewer.GetText;
import com.hippo.ehviewer.R;
import com.hippo.util.ReadableTime;
import java.io.File;
public class ExportDataPreference extends TaskPreference {
public ExportDataPreference(Context context) {
super(context);
}
public ExportDataPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ExportDataPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@NonNull
@Override
protected Task onCreateTask() {
return new ExportDataTask(getContext());
}
private static class ExportDataTask extends Task {
public ExportDataTask(@NonNull Context context) {
super(context);
}
@Override
protected Object doInBackground(Void... voids) {
File dir = AppConfig.getExternalDataDir();
if (dir != null) {
File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db");
if (EhDB.exportDB(getApplication(), file)) {
return file;
}
}
return null;
}
@Override
protected void onPostExecute(Object o) {
Toast.makeText(getApplication(),
(o instanceof File)
? GetText.getString(R.string.settings_advanced_export_data_to, ((File) o).getPath())
: GetText.getString(R.string.settings_advanced_export_data_failed),
Toast.LENGTH_SHORT).show();
super.onPostExecute(o);
}
}
}
@@ -166,6 +166,10 @@ public abstract class TaskPreference extends DialogPreference {
mApplication = (EhApplication) context.getApplicationContext();
}
public EhApplication getApplication() {
return mApplication;
}
@Nullable
public TaskPreference getPreference() {
return mPreference;
@@ -61,6 +61,7 @@ import com.hippo.yorozuya.Utilities;
import com.hippo.yorozuya.collect.SparseJLArray;
import com.hippo.yorozuya.thread.PriorityThread;
import com.hippo.yorozuya.thread.PriorityThreadFactory;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -1172,7 +1173,6 @@ public final class SpiderQueen implements Runnable {
}
// Download image
OutputStreamPipe pipe = null;
InputStream is = null;
try {
if (DEBUG_LOG) {
@@ -1208,49 +1208,93 @@ public final class SpiderQueen implements Runnable {
extension = GalleryProvider2.SUPPORT_IMAGE_EXTENSIONS[0];
}
// Get out put pipe
pipe = mSpiderDen.openOutputStreamPipe(index, extension);
if (null == pipe) {
// Can't get pipe
error = GetText.getString(R.string.error_write_failed);
response.close();
break;
}
long contentLength = responseBody.contentLength();
is = responseBody.byteStream();
pipe.obtain();
OutputStream os = pipe.open();
final byte data[] = new byte[1024 * 4];
long receivedSize = 0;
while (!Thread.currentThread().isInterrupted()) {
int bytesRead = is.read(data);
if (bytesRead == -1) {
OutputStreamPipe osPipe = null;
try {
// Get out put pipe
osPipe = mSpiderDen.openOutputStreamPipe(index, extension);
if (osPipe == null) {
// Can't get pipe
error = GetText.getString(R.string.error_write_failed);
response.close();
break;
}
os.write(data, 0, bytesRead);
receivedSize += bytesRead;
// Update page percent
if (contentLength > 0) {
mPagePercentMap.put(index, (float) receivedSize / contentLength);
}
// Notify listener
notifyPageDownload(index, contentLength, receivedSize, bytesRead);
}
os.flush();
// check download size
if (contentLength >= 0) {
if (receivedSize < contentLength) {
Log.e(TAG, "Can't download all of image data");
error = "Incomplete";
long contentLength = responseBody.contentLength();
is = responseBody.byteStream();
osPipe.obtain();
OutputStream os = osPipe.open();
final byte[] data = new byte[1024 * 4];
long receivedSize = 0;
while (!Thread.currentThread().isInterrupted()) {
int bytesRead = is.read(data);
if (bytesRead == -1) {
response.close();
break;
}
os.write(data, 0, bytesRead);
receivedSize += bytesRead;
// Update page percent
if (contentLength > 0) {
mPagePercentMap.put(index, (float) receivedSize / contentLength);
}
// Notify listener
notifyPageDownload(index, contentLength, receivedSize, bytesRead);
}
os.flush();
// check download size
if (contentLength >= 0) {
if (receivedSize < contentLength) {
Log.e(TAG, "Can't download all of image data");
error = "Incomplete";
forceHtml = true;
continue;
} else if (receivedSize > contentLength) {
Log.w(TAG, "Received data is more than contentLength");
}
}
} finally {
if (osPipe != null) {
osPipe.close();
osPipe.release();
}
}
InputStreamPipe isPipe = null;
try {
// Get InputStreamPipe
isPipe = mSpiderDen.openInputStreamPipe(index);
if (isPipe == null) {
// Can't get pipe
error = GetText.getString(R.string.error_reading_failed);
break;
}
// Check plain txt
isPipe.obtain();
InputStream inputStream = new BufferedInputStream(isPipe.open());
boolean isPlainTxt = true;
for (;;) {
int b = inputStream.read();
if (b == -1) {
break;
}
if (b > 126) {
isPlainTxt = false;
break;
}
}
if (isPlainTxt) {
error = GetText.getString(R.string.error_reading_failed);
forceHtml = true;
continue;
} else if (receivedSize > contentLength) {
Log.w(TAG, "Received data is more than contentLength");
}
} finally {
if (isPipe != null) {
isPipe.close();
isPipe.release();
}
}
@@ -1274,10 +1318,6 @@ public final class SpiderQueen implements Runnable {
forceHtml = true;
} finally {
IOUtils.closeQuietly(is);
if (null != pipe) {
pipe.close();
pipe.release();
}
if (DEBUG_LOG) {
Log.d(TAG, "End download image " + index);
@@ -25,11 +25,14 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.R;
import com.hippo.ripple.Ripple;
import com.hippo.widget.DirExplorer;
import com.hippo.yorozuya.ViewUtils;
import com.hippo.yorozuya.FileUtils;
import java.io.File;
public class DirPickerActivity extends ToolbarActivity
@@ -46,6 +49,7 @@ public class DirPickerActivity extends ToolbarActivity
private TextView mPath;
@Nullable
private DirExplorer mDirExplorer;
private View mDefault;
@Nullable
private View mOk;
@@ -55,9 +59,10 @@ public class DirPickerActivity extends ToolbarActivity
setContentView(R.layout.activity_dir_picker);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
mPath = (TextView) ViewUtils.$$(this, R.id.path);
mDirExplorer = (DirExplorer) ViewUtils.$$(this, R.id.dir_explorer);
mOk = ViewUtils.$$(this, R.id.ok);
mPath = findViewById(R.id.path);
mDirExplorer = findViewById(R.id.dir_explorer);
mDefault = findViewById(R.id.preset);
mOk = findViewById(R.id.ok);
File file;
if (null == savedInstanceState) {
@@ -71,6 +76,7 @@ public class DirPickerActivity extends ToolbarActivity
Ripple.addRipple(mOk, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme));
mDefault.setOnClickListener(this);
mOk.setOnClickListener(this);
mPath.setText(mDirExplorer.getCurrentFile().getPath());
@@ -126,7 +132,31 @@ public class DirPickerActivity extends ToolbarActivity
@Override
public void onClick(@NonNull View v) {
if (mOk == v) {
if (mDefault == v) {
File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(this, null);
File[] dirs = new File[externalFilesDirs.length + 1];
dirs[0] = AppConfig.getDefaultDownloadDir();
for (int i = 0; i < externalFilesDirs.length; i++) {
dirs[i + 1] = new File(externalFilesDirs[i], "download");
}
CharSequence[] items = new CharSequence[dirs.length];
items[0] = getString(R.string.default_directory);
for (int i = 1; i < items.length; i++) {
items[i] = getString(R.string.application_file_directory, i);
}
new AlertDialog.Builder(this).setItems(items, (dialog, which) -> {
File dir = dirs[which];
if (!FileUtils.ensureDirectory(dir)) {
Toast.makeText(DirPickerActivity.this, R.string.directory_not_writable, Toast.LENGTH_SHORT).show();
return;
}
if (mDirExplorer != null) {
mDirExplorer.setCurrentFile(dir);
}
}).show();
} else if (mOk == v) {
if (null == mDirExplorer) {
return;
}
@@ -59,6 +59,7 @@ import com.hippo.ehviewer.gallery.DirGalleryProvider;
import com.hippo.ehviewer.gallery.EhGalleryProvider;
import com.hippo.ehviewer.gallery.GalleryProvider2;
import com.hippo.ehviewer.widget.GalleryGuideView;
import com.hippo.ehviewer.widget.GalleryHeader;
import com.hippo.ehviewer.widget.ReversibleSeekBar;
import com.hippo.glgallery.GalleryPageView;
import com.hippo.glgallery.GalleryProvider;
@@ -369,6 +370,9 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
case 2:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
break;
case 3:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
break;
}
setRequestedOrientation(orientation);
@@ -378,6 +382,12 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
// Cutout
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
GalleryHeader galleryHeader = findViewById(R.id.gallery_header);
galleryHeader.setOnApplyWindowInsetsListener((v, insets) -> {
galleryHeader.setDisplayCutout(insets.getDisplayCutout());
return insets;
});
}
if (Settings.getGuideGallery()) {
@@ -834,6 +844,9 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
case 2:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
break;
case 3:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
break;
}
setRequestedOrientation(orientation);
mGalleryView.setLayoutMode(layoutMode);
@@ -0,0 +1,78 @@
/*
* 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.dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import androidx.appcompat.content.res.AppCompatResources;
import com.hippo.ehviewer.R;
public class SelectItemWithIconAdapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
private CharSequence[] texts;
private int[] icons;
public SelectItemWithIconAdapter(Context context, CharSequence[] texts, int[] icons) {
int count = texts.length;
if (count != icons.length) {
throw new IllegalArgumentException("Length conflict");
}
this.context = context;
this.inflater = LayoutInflater.from(context);
this.texts = texts;
this.icons = icons;
}
@Override
public int getCount() {
return texts.length;
}
@Override
public Object getItem(int position) {
return texts[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.dialog_item_select_with_icon, parent, false);
}
TextView view = (TextView) convertView;
view.setText(texts[position]);
Drawable icon = AppCompatResources.getDrawable(context, icons[position]);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
view.setCompoundDrawables(icon, null, null, null);
return view;
}
}
@@ -40,7 +40,6 @@ public class AdvancedFragment extends PreferenceFragment
private static final String KEY_DUMP_LOGCAT = "dump_logcat";
private static final String KEY_CLEAR_MEMORY_CACHE = "clear_memory_cache";
private static final String KEY_APP_LANGUAGE = "app_language";
private static final String KEY_EXPORT_DATA = "export_data";
private static final String KEY_IMPORT_DATA = "import_data";
@Override
@@ -51,12 +50,10 @@ public class AdvancedFragment extends PreferenceFragment
Preference dumpLogcat = findPreference(KEY_DUMP_LOGCAT);
Preference clearMemoryCache = findPreference(KEY_CLEAR_MEMORY_CACHE);
Preference appLanguage = findPreference(KEY_APP_LANGUAGE);
Preference exportData = findPreference(KEY_EXPORT_DATA);
Preference importData = findPreference(KEY_IMPORT_DATA);
dumpLogcat.setOnPreferenceClickListener(this);
clearMemoryCache.setOnPreferenceClickListener(this);
exportData.setOnPreferenceClickListener(this);
importData.setOnPreferenceClickListener(this);
appLanguage.setOnPreferenceChangeListener(this);
@@ -88,18 +85,6 @@ public class AdvancedFragment extends PreferenceFragment
} else if (KEY_CLEAR_MEMORY_CACHE.equals(key)) {
((EhApplication) getActivity().getApplication()).clearMemoryCache();
Runtime.getRuntime().gc();
} else if (KEY_EXPORT_DATA.equals(key)) {
File dir = AppConfig.getExternalDataDir();
if (dir != null) {
File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db");
if (EhDB.exportDB(getActivity(), file)) {
Toast.makeText(getActivity(),
getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show();
return true;
}
}
Toast.makeText(getActivity(),R.string.settings_advanced_export_data_failed, Toast.LENGTH_SHORT).show();
return true;
} else if (KEY_IMPORT_DATA.equals(key)) {
importData(getActivity());
getActivity().setResult(Activity.RESULT_OK);
@@ -687,6 +687,16 @@ public final class GalleryCommentsScene extends ToolbarScene
ssb.append(" ").append(ss);
}
if (comment.lastEdited != 0) {
String str = context.getString(R.string.last_edited, ReadableTime.getTimeAgo(comment.lastEdited));
SpannableString ss = new SpannableString(str);
ss.setSpan(new RelativeSizeSpan(0.8f), 0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(AttrResources.getAttrColor(context, android.R.attr.textColorSecondary)),
0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ssb.append("\n\n").append(ss);
}
return TextUrl.handleTextUrl(ssb);
}
@@ -116,6 +116,7 @@ import java.io.OutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import okhttp3.HttpUrl;
public class GalleryDetailScene extends BaseScene implements View.OnClickListener,
com.hippo.ehviewer.download.DownloadManager.DownloadInfoListener,
@@ -1096,7 +1097,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
if (null != keyword) {
ListUrlBuilder lub = new ListUrlBuilder();
lub.setMode(ListUrlBuilder.MODE_NORMAL);
lub.setKeyword(keyword);
lub.setKeyword("\"" + keyword + "\"");
GalleryListScene.startScene(this, lub);
return;
}
@@ -1186,7 +1187,15 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
} else if (mDownload == v) {
GalleryInfo galleryInfo = getGalleryInfo();
if (galleryInfo != null) {
CommonOperations.startDownload(activity, galleryInfo, false);
if (EhApplication.getDownloadManager(context).getDownloadState(galleryInfo.gid) == DownloadInfo.STATE_INVALID) {
CommonOperations.startDownload(activity, galleryInfo, false);
} else {
new AlertDialog.Builder(context)
.setTitle(R.string.download_remove_dialog_title)
.setMessage(getString(R.string.download_remove_dialog_message, galleryInfo.title))
.setPositiveButton(android.R.string.ok, (dialog1, which1) -> EhApplication.getDownloadManager(context).deleteDownload(galleryInfo.gid))
.show();
}
}
} else if (mRead == v) {
GalleryInfo galleryInfo = null;
@@ -1867,6 +1876,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
FileUtils.sanitizeFilename(name + ".torrent"));
r.allowScanningByMediaScanner();
r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
r.addRequestHeader("Cookie", EhApplication.getEhCookieStore(context).getCookieHeader(HttpUrl.get(url)));
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
if (dm != null) {
try {
@@ -36,6 +36,7 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.UrlOpener;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryDetail;
@@ -51,6 +52,9 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
public static final String KEY_KEYS = "keys";
public static final String KEY_VALUES = "values";
private static final int INDEX_URL = 3;
private static final int INDEX_PARENT = 10;
/*---------------
Whole life cycle
---------------*/
@@ -199,15 +203,19 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
Context context = getContext2();
if (null != context && 0 != position && null != mValues) {
ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setPrimaryClip(ClipData.newPlainText(null, mValues.get(position)));
if (position == INDEX_PARENT) {
UrlOpener.openUrl(context, mValues.get(position), true);
} else {
ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setPrimaryClip(ClipData.newPlainText(null, mValues.get(position)));
if (position == 3) {
// Save it to avoid detect the gallery
Settings.putClipboardTextHashCode(mValues.get(position).hashCode());
if (position == INDEX_URL) {
// Save it to avoid detect the gallery
Settings.putClipboardTextHashCode(mValues.get(position).hashCode());
}
showTip(R.string.copied_to_clipboard, LENGTH_SHORT);
}
showTip(R.string.copied_to_clipboard, LENGTH_SHORT);
return true;
} else {
return false;
@@ -82,6 +82,7 @@ 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.ui.dialog.SelectItemWithIconAdapter;
import com.hippo.ehviewer.widget.GalleryInfoContentHelper;
import com.hippo.ehviewer.widget.SearchBar;
import com.hippo.ehviewer.widget.SearchLayout;
@@ -1061,58 +1062,47 @@ 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;
boolean downloaded = mDownloadManager.getDownloadState(gi.gid) != DownloadInfo.STATE_INVALID;
boolean favourited = gi.favoriteSlot != -2;
CharSequence[] items = new CharSequence[] {
context.getString(download ? R.string.download : R.string.stop_downloading),
context.getString(R.string.read),
context.getString(favourite ? R.string.add_to_favourites : R.string.remove_from_favourites),
context.getString(downloaded ? R.string.delete_downloads : R.string.download),
context.getString(favourited ? R.string.remove_from_favourites : R.string.add_to_favourites),
};
int[] icons = new int[] {
R.drawable.v_book_open_x24,
downloaded ? R.drawable.v_delete_x24 : R.drawable.v_download_x24,
favourited ? R.drawable.v_heart_broken_x24 : R.drawable.v_heart_x24,
};
new AlertDialog.Builder(context)
.setTitle(EhUtils.getSuitableTitle(gi))
.setItems(items, (dialog, which) -> {
.setAdapter(new SelectItemWithIconAdapter(context, items, icons), (dialog, which) -> {
switch (which) {
case 1: // Read
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 0: // Download
if (download) {
CommonOperations.startDownload(activity, gi, false);
case 1: // Download
if (downloaded) {
new AlertDialog.Builder(context)
.setTitle(R.string.download_remove_dialog_title)
.setMessage(getString(R.string.download_remove_dialog_message, gi.title))
.setPositiveButton(android.R.string.ok, (dialog1, which1) -> mDownloadManager.deleteDownload(gi.gid))
.show();
} else {
mDownloadManager.stopDownload(gi.gid);
CommonOperations.startDownload(activity, gi, false);
}
break;
case 2: // Favorites
if (favourite) {
CommonOperations.addToFavorites(activity, gi, new AddToFavoriteListener(context, activity.getStageId(), getTag()));
} else {
if (favourited) {
CommonOperations.removeFromFavorites(activity, gi, new RemoveFromFavoriteListener(context, activity.getStageId(), getTag()));
} else {
CommonOperations.addToFavorites(activity, gi, new AddToFavoriteListener(context, activity.getStageId(), getTag()));
}
break;
}
@@ -39,7 +39,6 @@ import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.parser.ProfileParser;
import com.hippo.ehviewer.ui.MainActivity;
import com.hippo.ehviewer.widget.RecaptchaView;
import com.hippo.scene.Announcer;
import com.hippo.scene.SceneFragment;
import com.hippo.util.ExceptionUtils;
@@ -68,8 +67,6 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
private EditText mUsername;
@Nullable
private EditText mPassword;
private EditText mRecaptcha;
private RecaptchaView mRecaptchaView;
@Nullable
private View mRegister;
@Nullable
@@ -127,8 +124,6 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
mPasswordLayout = (TextInputLayout) ViewUtils.$$(loginForm, R.id.password_layout);
mPassword = mPasswordLayout.getEditText();
AssertUtils.assertNotNull(mPassword);
mRecaptcha = (EditText) ViewUtils.$$(loginForm, R.id.recaptcha);
mRecaptchaView = (RecaptchaView) ViewUtils.$$(loginForm, R.id.recaptcha_image);
mRegister = ViewUtils.$$(loginForm, R.id.register);
mSignIn = ViewUtils.$$(loginForm, R.id.sign_in);
mSignInViaWebView = (TextView) ViewUtils.$$(loginForm, R.id.sign_in_via_webview);
@@ -284,15 +279,12 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
// Clean up for sign in
EhUtils.signOut(context);
String challenge = mRecaptchaView.getChallenge();
String response = mRecaptcha.getText().toString();
EhCallback callback = new SignInListener(context,
activity.getStageId(), getTag());
mRequestId = ((EhApplication) context.getApplicationContext()).putGlobalStuff(callback);
EhRequest request = new EhRequest()
.setMethod(EhClient.METHOD_SIGN_IN)
.setArgs(username, password, challenge, response)
.setArgs(username, password)
.setCallback(callback);
EhApplication.getEhClient(context).execute(request);
@@ -335,7 +327,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
new AlertDialog.Builder(context)
.setTitle(R.string.sign_in_failed)
.setMessage(ExceptionUtils.getReadableString(e))
.setMessage(ExceptionUtils.getReadableString(e) + "\n\n" + getString(R.string.sign_in_failed_tip))
.setPositiveButton(R.string.get_it, null)
.show();
}
@@ -0,0 +1,205 @@
/*
* 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.graphics.Rect;
import android.os.Build;
import android.util.AttributeSet;
import android.view.DisplayCutout;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.hippo.ehviewer.R;
import com.hippo.yorozuya.ObjectUtils;
public class GalleryHeader extends ViewGroup {
private DisplayCutout displayCutout;
private View battery;
private View progress;
private View clock;
private Rect batteryRect = new Rect();
private Rect progressRect = new Rect();
private Rect clockRect = new Rect();
private int[] location = new int[2];
private int lastX = 0;
private int lastY = 0;
public GalleryHeader(Context context, AttributeSet attrs) {
super(context, attrs);
}
@RequiresApi(api = Build.VERSION_CODES.P)
public void setDisplayCutout(@Nullable DisplayCutout displayCutout) {
if (!ObjectUtils.equal(this.displayCutout, displayCutout)) {
this.displayCutout = displayCutout;
requestLayout();
}
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
battery = findViewById(R.id.battery);
progress = findViewById(R.id.progress);
clock = findViewById(R.id.clock);
}
private void measureChild(Rect rect, View view, int width, int paddingLeft, int paddingRight) {
int left;
MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
if (view == battery) {
left = paddingLeft + lp.leftMargin;
} else if (view == progress) {
left = paddingLeft + (width - paddingLeft - paddingRight) / 2 - view.getMeasuredWidth() / 2;
} else {
left = width - paddingRight - lp.rightMargin - view.getMeasuredWidth();
}
rect.set(left, lp.topMargin, left + view.getMeasuredWidth(), lp.topMargin + view.getMeasuredHeight());
}
@RequiresApi(api = Build.VERSION_CODES.P)
private boolean offsetVertically(Rect rect, View view, int width) {
int offset = 0;
measureChild(rect, view, width, 0, 0);
rect.offset(lastX, lastY);
for (Rect notch : displayCutout.getBoundingRects()) {
if (Rect.intersects(notch, rect)) {
offset = Math.max(offset, notch.bottom - lastY);
}
}
if (offset != 0) {
rect.offset(-lastX, -lastY);
rect.offset(0, offset);
return true;
} else {
return false;
}
}
@RequiresApi(api = Build.VERSION_CODES.P)
private int getOffsetLeft(Rect rect, View view, int width) {
int offset = 0;
measureChild(rect, view, width, 0, 0);
rect.offset(lastX, lastY);
for (Rect notch : displayCutout.getBoundingRects()) {
if (Rect.intersects(notch, rect)) {
offset = Math.max(offset, notch.right - lastX);
}
}
return offset;
}
@RequiresApi(api = Build.VERSION_CODES.P)
private int getOffsetRight(Rect rect, View view, int width) {
int offset = 0;
measureChild(rect, view, width, 0, 0);
rect.offset(lastX, lastY);
for (Rect notch : displayCutout.getBoundingRects()) {
if (Rect.intersects(notch, rect)) {
offset = Math.max(offset, lastX + width - notch.left);
}
}
return offset;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY) {
throw new IllegalStateException();
}
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
measureChild(child, widthMeasureSpec, heightMeasureSpec);
MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
height = Math.max(height, child.getMeasuredHeight() + lp.topMargin);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && displayCutout != null) {
// Check progress covered
if (offsetVertically(progressRect, progress, width)) {
offsetVertically(batteryRect, battery, width);
offsetVertically(clockRect, clock, width);
height = Math.max(progressRect.bottom, Math.max(batteryRect.bottom, clockRect.bottom));
} else {
// Clamp left and right
int paddingLeft = getOffsetLeft(batteryRect, battery, width);
int paddingRight = getOffsetRight(clockRect, clock, width);
measureChild(batteryRect, battery, width, paddingLeft, paddingRight);
measureChild(progressRect, progress, width, paddingLeft, paddingRight);
measureChild(clockRect, clock, width, paddingLeft, paddingRight);
}
} else {
measureChild(batteryRect, battery, width, 0, 0);
measureChild(progressRect, progress, width, 0, 0);
measureChild(clockRect, clock, width, 0, 0);
}
setMeasuredDimension(width, height);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
battery.layout(batteryRect.left, batteryRect.top, batteryRect.right, batteryRect.bottom);
progress.layout(progressRect.left, progressRect.top, progressRect.right, progressRect.bottom);
clock.layout(clockRect.left, clockRect.top, clockRect.right, clockRect.bottom);
getLocationOnScreen(location);
if (lastX != location[0] || lastY != location[1]) {
lastX = location[0];
lastY = location[1];
requestLayout();
}
}
@Override
public MarginLayoutParams generateLayoutParams(AttributeSet attrs) {
return new MarginLayoutParams(getContext(), attrs);
}
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof MarginLayoutParams;
}
@Override
protected MarginLayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
if (lp instanceof MarginLayoutParams) {
return new MarginLayoutParams((MarginLayoutParams) lp);
}
return new MarginLayoutParams(lp);
}
}
@@ -1,183 +0,0 @@
/*
* Copyright 2017 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;
/*
* Created by Hippo on 2017/8/20.
*/
import android.content.Context;
import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.NonNull;
import com.hippo.android.recaptcha.RecaptchaV1;
import com.hippo.drawable.TextDrawable;
import com.hippo.ehviewer.R;
import com.hippo.widget.LoadImageView;
import com.hippo.yorozuya.SimpleHandler;
public class RecaptchaView extends LoadImageView implements RecaptchaV1.RecaptchaCallback, View.OnClickListener {
private static final String CHALLENGE = "6LdtfgYAAAAAALjIPPiCgPJJah8MhAUpnHcKF8u_";
private boolean loading = false;
private String challenge;
private String image;
private TextDrawable waitingDrawable;
private TextDrawable loadingDrawable;
private TextDrawable failureDrawable;
public RecaptchaView(Context context) {
super(context);
init();
}
public RecaptchaView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setOnClickListener(this);
if (waitingDrawable == null) {
waitingDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_none), 0.6f);
waitingDrawable.setBackgroundColor(Color.GRAY);
waitingDrawable.setTextColor(Color.WHITE);
}
load(waitingDrawable);
}
public String getChallenge() {
return challenge;
}
public void load() {
if (loading) {
return;
}
loading = false;
challenge = null;
image = null;
if (loadingDrawable == null) {
loadingDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_loading), 0.6f);
loadingDrawable.setBackgroundColor(Color.GRAY);
loadingDrawable.setTextColor(Color.WHITE);
}
load(loadingDrawable);
RecaptchaV1.recaptcha(getContext(), CHALLENGE, SimpleHandler.getInstance(), this);
}
@Override
public void onClick(@NonNull View v) {
load();
}
@Override
public void onSuccess(@NonNull String challenge, @NonNull String image) {
this.loading = false;
this.challenge = challenge;
this.image = image;
load(image, image);
}
@Override
public void onFailure() {
this.loading = false;
this.challenge = null;
this.image = null;
if (failureDrawable == null) {
failureDrawable = new TextDrawable(getContext().getString(R.string.recaptcha_failure), 0.6f);
failureDrawable.setBackgroundColor(Color.GRAY);
failureDrawable.setTextColor(Color.WHITE);
}
load(failureDrawable);
}
@Override
protected Parcelable onSaveInstanceState() {
SavedState ss = new SavedState(super.onSaveInstanceState());
ss.loading = loading;
ss.challenge = challenge;
ss.image = image;
return ss;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
if (ss.loading) {
load();
} else if (!TextUtils.isEmpty(ss.challenge) && !TextUtils.isEmpty(ss.image)) {
onSuccess(ss.challenge, ss.image);
}
}
private static class SavedState extends BaseSavedState {
private boolean loading;
private String challenge;
private String image;
public SavedState(Parcelable superState) {
super(superState);
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeByte(loading ? (byte) 1 : (byte) 0);
out.writeString(challenge);
out.writeString(image);
}
public static final Parcelable.Creator<SavedState> CREATOR
= new Parcelable.Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
public SavedState(Parcel source) {
super(source);
loading = source.readByte() != 0;
challenge = source.readString();
image = source.readString();
}
}
}
@@ -85,6 +85,19 @@ public class CookieRepository implements CookieJar {
}
}
public String getCookieHeader(HttpUrl url) {
List<Cookie> cookies = getCookies(url);
StringBuilder cookieHeader = new StringBuilder();
for (int i = 0, size = cookies.size(); i < size; i++) {
if (i > 0) {
cookieHeader.append("; ");
}
Cookie cookie = cookies.get(i);
cookieHeader.append(cookie.name()).append('=').append(cookie.value());
}
return cookieHeader.toString();
}
public synchronized List<Cookie> getCookies(HttpUrl url) {
List<Cookie> accepted = new ArrayList<>();
List<Cookie> expired = new ArrayList<>();
@@ -16,17 +16,16 @@
package com.hippo.util;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import com.hippo.ehviewer.R;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
@SuppressLint("SimpleDateFormat")
public final class ReadableTime {
private static Resources sResources;
@@ -56,30 +55,21 @@ public final class ReadableTime {
R.plurals.second
};
private static final Calendar sCalendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"));
private static final Calendar sCalendar = Calendar.getInstance();
private static final Object sCalendarLock = new Object();
private static final SimpleDateFormat DATE_FORMAT_WITHOUT_YEAR =
new SimpleDateFormat("MMM d", Locale.getDefault());
private static final SimpleDateFormat DATE_FORMAT_WITHOUT_YEAR = new SimpleDateFormat("MMM d");
private static final SimpleDateFormat DATE_FORMAT_WITH_YEAR = new SimpleDateFormat("MMM d, yyyy");
private static final SimpleDateFormat DATE_FORMAT_WIT_YEAR =
new SimpleDateFormat("yyy MMM d", Locale.getDefault());
private static final SimpleDateFormat DATE_FORMAT_WITHOUT_YEAR_ZH = new SimpleDateFormat("M月d日");
private static final SimpleDateFormat DATE_FORMAT_WITH_YEAR_ZH = new SimpleDateFormat("yyyy年M月d日");
private static final SimpleDateFormat DATE_FORMAT =
new SimpleDateFormat("yy-MM-dd HH:mm", Locale.getDefault());
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yy-MM-dd HH:mm");
private static final Object sDateFormatLock1 = new Object();
private static final SimpleDateFormat FILENAMABLE_DATE_FORMAT =
new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS", Locale.getDefault());
private static final SimpleDateFormat FILENAMABLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS");
private static final Object sDateFormatLock2 = new Object();
static {
// The website use GMT+08:00, so tell user the same
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));
DATE_FORMAT_WITHOUT_YEAR.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));
}
public static void initialize(Context context) {
sResources = context.getApplicationContext().getResources();
}
@@ -134,11 +124,12 @@ public final class ReadableTime {
int nowYear = sCalendar.get(Calendar.YEAR);
sCalendar.setTime(timeDate);
int timeYear = sCalendar.get(Calendar.YEAR);
boolean isZh = Locale.getDefault().getLanguage().equals("zh");
if (nowYear == timeYear) {
return DATE_FORMAT_WITHOUT_YEAR.format(timeDate);
return (isZh ? DATE_FORMAT_WITHOUT_YEAR_ZH : DATE_FORMAT_WITHOUT_YEAR).format(timeDate);
} else {
return DATE_FORMAT_WIT_YEAR.format(timeDate);
return (isZh ? DATE_FORMAT_WITH_YEAR_ZH : DATE_FORMAT_WITH_YEAR).format(timeDate);
}
}
}
@@ -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="?attr/drawableColorPrimary"
android:pathData="@string/pd_download"/>
</vector>
@@ -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="?attr/drawableColorPrimary"
android:pathData="@string/pd_heart_broken"/>
</vector>
+29
View File
@@ -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="?attr/drawableColorPrimary"
android:pathData="@string/pd_heart"/>
</vector>
@@ -38,13 +38,27 @@
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:id="@+id/ok"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@android:string/ok"
android:textColor="?attr/colorPrimary"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/preset"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/preset"
android:textColor="?attr/colorAccent"/>
<TextView
android:id="@+id/ok"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@android:string/ok"
android:textColor="?attr/colorPrimary"/>
</FrameLayout>
</LinearLayout>
+33 -25
View File
@@ -26,34 +26,42 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.hippo.widget.TextClock
android:id="@+id/clock"
android:layout_width="wrap_content"
<com.hippo.ehviewer.widget.GalleryHeader
android:id="@+id/gallery_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginRight="@dimen/gallery_widget_margin_h"
android:textColor="?android:attr/textColorSecondary"/>
android:layout_gravity="top">
<TextView
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:textColor="?android:attr/textColorSecondary"/>
<com.hippo.widget.TextClock
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginRight="@dimen/gallery_widget_margin_h"
android:textColor="?android:attr/textColorSecondary"/>
<com.hippo.widget.BatteryView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginLeft="@dimen/gallery_widget_margin_h"
android:drawablePadding="4dp"
app:color="?android:attr/textColorSecondary"
app:warningColor="@color/red_500"/>
<TextView
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:textColor="?android:attr/textColorSecondary"/>
<com.hippo.widget.BatteryView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginLeft="@dimen/gallery_widget_margin_h"
android:drawablePadding="4dp"
app:color="?android:attr/textColorSecondary"
app:warningColor="@color/red_500"/>
</com.hippo.ehviewer.widget.GalleryHeader>
<com.hippo.ehviewer.widget.SeekBarPanel
android:id="@+id/seek_bar_panel"
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
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.
-->
<!--
This layout file is used by the AlertDialog when displaying a list of items.
This layout file is inflated and used as the TextView to display individual
items.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:drawablePadding="@dimen/keyline_margin"
android:ellipsize="marquee"/>
@@ -45,7 +45,6 @@
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
+1 -28
View File
@@ -73,40 +73,13 @@
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/recaptcha_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:minWidth="@dimen/single_max_width"
android:hint="@string/recaptcha">
<com.hippo.widget.HackyTextInputEditText
android:id="@+id/recaptcha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<com.hippo.ehviewer.widget.RecaptchaView
android:id="@+id/recaptcha_image"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:minWidth="@dimen/single_max_width"
android:scaleType="fitCenter"/>
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
+5 -5
View File
@@ -33,11 +33,6 @@
android:title="@string/whats_hot"
android:icon="@drawable/v_fire_black_x24"/>
<item
android:id="@+id/nav_downloads"
android:title="@string/downloads"
android:icon="@drawable/v_download_black_x24"/>
<item
android:id="@+id/nav_favourite"
android:title="@string/favourite"
@@ -48,6 +43,11 @@
android:title="@string/history"
android:icon="@drawable/v_history_black_x24"/>
<item
android:id="@+id/nav_downloads"
android:title="@string/downloads"
android:icon="@drawable/v_download_black_x24"/>
<item
android:id="@+id/nav_settings"
android:title="@string/settings"
@@ -92,12 +92,16 @@
<string name="error_invalid_number">非法数字</string>
<string name="error_please_login_first">请先登陆</string>
<string name="error_empty_html">页面内容为空</string>
<string name="error_cant_get_image">无法获取图片</string>
<string name="kokomade_tip">设置->Eh->画廊站点->e-hentai</string>
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的任何后果负责。\n\n未成年人应在监护人指导下使用本应用。</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_tip">若持续出错,请尝试“通过网页登录”或“通过 Cookie 登录”。</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>
@@ -170,6 +174,7 @@
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下载</string>
<string name="delete_downloads">删除下载</string>
<string name="quick_search">快速搜索</string>
<string name="quick_search_tip">点击“+”来添加快速搜索</string>
@@ -293,6 +298,7 @@
<string name="vote_failed">投票失败</string>
<string name="check_vote_status">查看投票情况</string>
<string name="click_more_comments">点击加载更多评论</string>
<string name="last_edited">上次修改时间:%s</string>
<!-- Gallery Previews -->
<string name="gallery_previews">画廊预览</string>
@@ -393,6 +399,11 @@
<string name="invalid_host">无效的 host</string>
<string name="invalid_ip">无效的 IP</string>
<!-- DirPickerActivity -->
<string name="preset">预设</string>
<string name="default_directory">默认目录</string>
<string name="application_file_directory">应用文件目录 %d (应用卸载后会被删除)</string>
<!-- Gallery Activity -->
<string name="page_menu_title">第 %d 页</string>
<string name="page_menu_refresh">@string/refresh</string>
@@ -464,6 +475,7 @@
<string name="settings_read_screen_rotation_default">系统默认</string>
<string name="settings_read_screen_rotation_portrait">竖屏</string>
<string name="settings_read_screen_rotation_landscape">横屏</string>
<string name="settings_read_screen_rotation_sensor">自动旋转</string>
<string name="settings_read_reading_direction">阅读方向</string>
<string name="settings_read_reading_direction_left_to_right">从左至右</string>
<string name="settings_read_reading_direction_right_to_Left">从右至左</string>
@@ -92,12 +92,16 @@
<string name="error_invalid_number">非法數字</string>
<string name="error_please_login_first">請先登陸</string>
<string name="error_empty_html">頁面內容為空</string>
<string name="error_cant_get_image">無法獲取圖片</string>
<string name="kokomade_tip">設置->Eh->畫廊站點->e-hentai</string>
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。\n\n未成年人應在監護人指導下使用本應用。</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_tip">若持續出錯,請嘗試“通過網頁登錄”或“通過 Cookie 登錄”。</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>
@@ -170,6 +174,7 @@
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下載</string>
<string name="delete_downloads">刪除下載</string>
<string name="quick_search">快速搜索</string>
<string name="quick_search_tip">點擊“+”來添加快速搜索</string>
@@ -293,6 +298,7 @@
<string name="vote_failed">投票失敗</string>
<string name="check_vote_status">查看投票情況</string>
<string name="click_more_comments">點擊加載更多評論</string>
<string name="last_edited">上次修改時間:%s</string>
<!-- Gallery Previews -->
<string name="gallery_previews">畫廊預覽</string>
@@ -393,6 +399,11 @@
<string name="invalid_host">無效的 host</string>
<string name="invalid_ip">無效的 IP</string>
<!-- DirPickerActivity -->
<string name="preset">預設</string>
<string name="default_directory">默認目錄</string>
<string name="application_file_directory">應用文件目錄 %d (應用卸載後會被刪除)</string>
<!-- Gallery Activity -->
<string name="page_menu_title">第 %d 頁</string>
<string name="page_menu_refresh">@string/refresh</string>
@@ -92,12 +92,16 @@
<string name="error_invalid_number">無效的數字</string>
<string name="error_please_login_first">請先登陸</string>
<string name="error_empty_html">頁面內容為空</string>
<string name="error_cant_get_image">無法獲取圖片</string>
<string name="kokomade_tip">設定->Eh->圖庫站台->e-hentai</string>
<string name="app_waring">本應用程式中內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用程式的作者不會對由其所造成的任何影響負責。\n\n未成年人應在監護人指導下使用本應用程式。</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_tip">若持續出錯,請嘗試“通過網頁登入”或“通過 Cookie 登入”。</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>
@@ -170,6 +174,7 @@
<string name="remove_from_favourites">移除收藏</string>
<string name="stop_downloading">停止下載</string>
<string name="delete_downloads">刪除下載</string>
<string name="quick_search">快速搜尋</string>
<string name="quick_search_tip">點擊“+”以新增快速搜尋</string>
@@ -292,6 +297,7 @@
<string name="vote_failed">推噓失敗</string>
<string name="check_vote_status">檢視推噓狀態</string>
<string name="click_more_comments">點選載入更多留言</string>
<string name="last_edited">上次修改時間:%s</string>
<!-- Gallery Previews -->
<string name="gallery_previews">圖庫預覽</string>
@@ -392,6 +398,11 @@
<string name="invalid_host">無效的 host</string>
<string name="invalid_ip">無效的 IP</string>
<!-- DirPickerActivity -->
<string name="preset">預設</string>
<string name="default_directory">預設目錄</string>
<string name="application_file_directory">應用檔案目錄 %d (應用解除安裝後會被刪除)</string>
<!-- Gallery Activity -->
<string name="page_menu_title">第 %d 頁</string>
<string name="page_menu_refresh">@string/refresh</string>
+2
View File
@@ -156,12 +156,14 @@
<item>@string/settings_read_screen_rotation_default</item>
<item>@string/settings_read_screen_rotation_portrait</item>
<item>@string/settings_read_screen_rotation_landscape</item>
<item>@string/settings_read_screen_rotation_sensor</item>
</string-array>
<string-array name="screen_rotation_entry_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="reading_direction_entries">
+1
View File
@@ -29,6 +29,7 @@
<string name="pd_homepage" translatable="false">M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z</string>
<string name="pd_fire" translatable="false">M11.71,19C9.93,19 8.5,17.59 8.5,15.86C8.5,14.24 9.53,13.1 11.3,12.74C13.07,12.38 14.9,11.53 15.92,10.16C16.31,11.45 16.5,12.81 16.5,14.2C16.5,16.84 14.36,19 11.71,19M13.5,0.67C13.5,0.67 14.24,3.32 14.24,5.47C14.24,7.53 12.89,9.2 10.83,9.2C8.76,9.2 7.2,7.53 7.2,5.47L7.23,5.1C5.21,7.5 4,10.61 4,14A8,8 0 0,0 12,22A8,8 0 0,0 20,14C20,8.6 17.41,3.8 13.5,0.67Z</string>
<string name="pd_heart" translatable="false">M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z</string>
<string name="pd_heart_broken" translatable="false">M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C8.17,3 8.82,3.12 9.44,3.33L13,9.35L9,14.35L12,21.35V21.35M16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35L11,14.35L15.5,9.35L12.85,4.27C13.87,3.47 15.17,3 16.5,3Z</string>
<string name="pd_history" translatable="false">M11,7V12.11L15.71,14.9L16.5,13.62L12.5,11.25V7M12.5,2C8.97,2 5.91,3.92 4.27,6.77L2,4.5V11H8.5L5.75,8.25C6.96,5.73 9.5,4 12.5,4A7.5,7.5 0 0,1 20,11.5A7.5,7.5 0 0,1 12.5,19C9.23,19 6.47,16.91 5.44,14H3.34C4.44,18.03 8.11,21 12.5,21C17.74,21 22,16.75 22,11.5A9.5,9.5 0 0,0 12.5,2Z</string>
<string name="pd_book_open" translatable="false">M21,4C19.9,3.7,18.7,3.5,17.5,3.5C15.6,3.5,13.4,3.9,12,5C10.6,3.9,8.4,3.5,6.5,3.5S2.5,3.9,1,5V19.6C1,19.9,1.3,20.1,1.5,20.1C1.6,20.1,1.6,20.1,1.8,20.1C3.1,19.5,5.1,19,6.5,19C8.4,19,10.6,19.4,12,20.5C13.4,19.6,15.8,19,17.5,19C19.1,19,20.9,19.3,22.3,20C22.4,20.1,22.4,20.1,22.6,20.1C22.9,20.1,23.1,19.8,23.1,19.6V5C22.4,4.6,21.8,4.3,21,4M21,17.5C19.9,17.1,18.7,17,17.5,17C15.8,17,13.4,17.6,12,18.5V7C13.4,6.2,15.8,5.5,17.5,5.5C18.7,5.5,19.9,5.7,21,6V17.5Z</string>
<string name="pd_delete" translatable="false">M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z</string>
+12
View File
@@ -134,12 +134,16 @@
<string name="error_invalid_number">Invalid number</string>
<string name="error_please_login_first">Please login first</string>
<string name="error_empty_html">Empty page</string>
<string name="error_cant_get_image">Can\'t get image</string>
<string name="kokomade_tip">Settings->Eh->Gallery Site->e-hentai</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>
<string name="error_password_cannot_empty">Password cannot be an empty string</string>
<string name="skip_signing_in">Continue without signing in</string>
<string name="sign_in_failed">Sign in failed</string>
<string name="sign_in_failed_tip">If this issue continues, try \"Sign in via WebView\" or \"Sign in via cookies\"</string>
<string name="sign_in_failed_plain">Perhaps it is a mistake due to website update or something wrong happened. You may try sign in via WebView or enter cookie or skip signing in under sign in button. But you may be a "Sad Panda" after skipping signing in. Try "Sign in via cookies" first if you had signed in on 0.6.x version.</string>
<string name="press_twice_exit">Press twice to exit</string>
<string name="content_layout_restore_tip">Tap to retry</string>
@@ -214,6 +218,7 @@
<string name="remove_from_favourites">Remove from favourites</string>
<string name="stop_downloading">Stop downloading</string>
<string name="delete_downloads">Delete downloads</string>
<string name="quick_search">Quick search</string>
<string name="quick_search_tip">Tap \"+\" to add Quick Search</string>
@@ -339,6 +344,7 @@
<string name="vote_failed">Vote failed</string>
<string name="check_vote_status">View vote details</string>
<string name="click_more_comments">Click to load more comments</string>
<string name="last_edited">Last edited: %s</string>
<!-- Gallery Previews -->
<string name="gallery_previews">Gallery Previews</string>
@@ -439,6 +445,11 @@
<string name="invalid_host">Invalid host</string>
<string name="invalid_ip">Invalid IP</string>
<!-- DirPickerActivity -->
<string name="preset">Preset</string>
<string name="default_directory">Default directory</string>
<string name="application_file_directory">App file directory %d (it will be remove after uninstalling the app)</string>
<!-- Gallery Activity -->
<string name="page_menu_title">Page %d</string>
<string name="page_menu_refresh">@string/refresh</string>
@@ -509,6 +520,7 @@
<string name="settings_read_screen_rotation_default">Default</string>
<string name="settings_read_screen_rotation_portrait">Portrait</string>
<string name="settings_read_screen_rotation_landscape">Landscape</string>
<string name="settings_read_screen_rotation_sensor">Auto rotate</string>
<string name="settings_read_reading_direction">Reading direction</string>
<string name="settings_read_reading_direction_left_to_right">Left to right</string>
<string name="settings_read_reading_direction_right_to_Left">Right to left</string>
+1 -1
View File
@@ -80,7 +80,7 @@
android:summary="@string/settings_advanced_custom_hosts_summary"
app:activity="com.hippo.ehviewer.ui.HostsActivity"/>
<Preference
<com.hippo.ehviewer.preference.ExportDataPreference
android:key="export_data"
android:title="@string/settings_advanced_export_data"
android:summary="@string/settings_advanced_export_data_summary"/>
+2 -2
View File
@@ -8,8 +8,8 @@ buildscript {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.27.1'
// NOTE: Do not place your application dependencies here; they belong
+5 -5
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip