diff --git a/app/build.gradle b/app/build.gradle
index adcb66925..ec2a6697e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -27,7 +27,7 @@ android {
applicationId "com.hippo.ehviewer"
minSdkVersion 21
targetSdkVersion 30
- versionCode 107
+ versionCode 108
versionName "1.7.6"
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
"es", "ja", "ko", "fr", "de", "th"
diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java
index 7f4559a93..9eb94cc1b 100755
--- a/app/src/main/java/com/hippo/ehviewer/Settings.java
+++ b/app/src/main/java/com/hippo/ehviewer/Settings.java
@@ -257,6 +257,8 @@ public class Settings {
private static final boolean DEFAULT_GUIDE_GALLERY = true;
private static final String KEY_CLIPBOARD_TEXT_HASH_CODE = "clipboard_text_hash_code";
private static final int DEFAULT_CLIPBOARD_TEXT_HASH_CODE = 0;
+ private static final String KEY_DOWNLOAD_DELAY = "download_delay";
+ private static final int DEFAULT_DOWNLOAD_DELAY = 0;
private static Context sContext;
private static SharedPreferences sSettingsPre;
private static EhConfig sEhConfig;
@@ -740,6 +742,14 @@ public class Settings {
putIntToStr(KEY_MULTI_THREAD_DOWNLOAD, value);
}
+ public static int getDownloadDelay() {
+ return getIntFromStr(KEY_DOWNLOAD_DELAY, DEFAULT_DOWNLOAD_DELAY);
+ }
+
+ public static void putDownloadDelay(int value) {
+ putIntToStr(KEY_DOWNLOAD_DELAY, value);
+ }
+
public static int getPreloadImage() {
return getIntFromStr(KEY_PRELOAD_IMAGE, DEFAULT_PRELOAD_IMAGE);
}
diff --git a/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java b/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java
index 0879d5565..48f49f1d7 100644
--- a/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java
+++ b/app/src/main/java/com/hippo/ehviewer/spider/SpiderQueen.java
@@ -143,6 +143,7 @@ public final class SpiderQueen implements Runnable {
private final int mPreloadNumber;
private int mReadReference = 0;
private int mDownloadReference = 0;
+ private final int mDownloadDelay;
// It mQueenThread is null, failed or stopped
@Nullable
private volatile Thread mQueenThread;
@@ -169,6 +170,7 @@ public final class SpiderQueen implements Runnable {
mWorkerPoolExecutor = new ThreadPoolExecutor(mWorkerMaxCount, mWorkerMaxCount,
0, TimeUnit.SECONDS, new LinkedBlockingDeque<>(),
new PriorityThreadFactory(SpiderWorker.class.getSimpleName(), Process.THREAD_PRIORITY_BACKGROUND));
+ mDownloadDelay = Settings.getDownloadDelay();
}
@UiThread
@@ -1349,6 +1351,11 @@ public final class SpiderQueen implements Runnable {
// Download finished
updatePageState(index, STATE_FINISHED);
+ try {
+ Thread.sleep(mDownloadDelay);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
return true;
} catch (IOException e) {
e.printStackTrace();
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 1aef5cfa0..7bd409270 100755
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -716,4 +716,6 @@
过滤
全部
全部开始(倒序)
+ 下载延时
+ 每次下载延时 %s 毫秒
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 207c5a831..c81860398 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -115,6 +115,28 @@
- 7
+
+ - 0
+ - 500
+ - 1000
+ - 1500
+ - 2000
+ - 3000
+ - 10000
+ - 20000
+
+
+
+ - 0
+ - 500
+ - 1000
+ - 1500
+ - 2000
+ - 3000
+ - 10000
+ - 20000
+
+
- 3
- 5
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 19ca760a6..677b3c117 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -554,6 +554,8 @@
Most gallery apps will ignore pictures in the download path
Multi-threaded download
Up to %s images
+ Download delay
+ Delay %s ms per download
Preload image
Preload next %s image
Image resolution
diff --git a/app/src/main/res/xml/download_settings.xml b/app/src/main/res/xml/download_settings.xml
index 84149cd33..a88d0dbee 100644
--- a/app/src/main/res/xml/download_settings.xml
+++ b/app/src/main/res/xml/download_settings.xml
@@ -39,6 +39,15 @@
app:entryValues="@array/multi_thread_download_entry_values"
app:iconSpaceReserved="false" />
+
+