diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java
index f2bfc5b3d..311ac4aeb 100644
--- a/app/src/main/java/com/hippo/ehviewer/Settings.java
+++ b/app/src/main/java/com/hippo/ehviewer/Settings.java
@@ -822,6 +822,13 @@ public class Settings {
putString(KEY_SECURITY, value);
}
+ public static final String KEY_READ_CACHE_SIZE = "read_cache_size";
+ public static final int DEFAULT_READ_CACHE_SIZE = 160;
+
+ public static int getReadCacheSize() {
+ return getIntFromStr(KEY_READ_CACHE_SIZE, DEFAULT_READ_CACHE_SIZE);
+ }
+
/********************
****** Guide
********************/
diff --git a/app/src/main/java/com/hippo/ehviewer/spider/SpiderDen.java b/app/src/main/java/com/hippo/ehviewer/spider/SpiderDen.java
index e0f8a57ac..d5b81c61c 100644
--- a/app/src/main/java/com/hippo/ehviewer/spider/SpiderDen.java
+++ b/app/src/main/java/com/hippo/ehviewer/spider/SpiderDen.java
@@ -34,6 +34,7 @@ import com.hippo.unifile.FilenameFilter;
import com.hippo.unifile.UniFile;
import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.IOUtils;
+import com.hippo.yorozuya.MathUtils;
import com.hippo.yorozuya.Utilities;
import com.hippo.yorozuya.io.InputStreamPipe;
import com.hippo.yorozuya.io.OutputStreamPipe;
@@ -54,7 +55,8 @@ public final class SpiderDen {
private static SimpleDiskCache sCache;
public static void initialize(Context context) {
- sCache = new SimpleDiskCache(new File(context.getCacheDir(), "image"), 160 * 1024 * 1024);
+ sCache = new SimpleDiskCache(new File(context.getCacheDir(), "image"),
+ MathUtils.clamp(Settings.getReadCacheSize(), 40, 640) * 1024 * 1024);
}
private static class StartWithFilenameFilter implements FilenameFilter {
diff --git a/app/src/main/java/com/hippo/preference/ListPreference.java b/app/src/main/java/com/hippo/preference/ListPreference.java
index 25e4ceb6b..b15505cd5 100644
--- a/app/src/main/java/com/hippo/preference/ListPreference.java
+++ b/app/src/main/java/com/hippo/preference/ListPreference.java
@@ -25,6 +25,7 @@ import android.support.annotation.ArrayRes;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.util.Log;
import com.hippo.ehviewer.R;
@@ -139,6 +140,9 @@ public class ListPreference extends DialogPreference {
* @param value The value to set for the key.
*/
public void setValue(String value) {
+
+ Log.d("TAG", "value = " + value);
+
// Always persist/notify the first time.
final boolean changed = !TextUtils.equals(mValue, value);
if (changed || !mValueSet) {
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 5580f6882..aec40bd9e 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -446,6 +446,7 @@
清除画廊下载路径缓存?
清理内存缓存
清理缩略图、画廊信息的内存缓存
+ 阅读缓存大小
图案保护
未设置图案保护
已设置图案保护
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 1a78b36ba..7e4f281d5 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -446,6 +446,7 @@
清除畫廊下載路徑緩存?
清理內存緩存
清理縮略圖、畫廊信息的內存緩存
+ 閲讀緩存大小
圖案保護
未設置圖案保護
已設置圖案保護
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 7b7a888da..befb179b0 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -446,6 +446,7 @@
清除畫廊下載路徑快取?
清理記憶體快取
清理縮圖、畫廊資訊的記憶體快取
+ 閱讀快取大小
圖案保護
未設定圖案保護
已設定圖案保護
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index c518d75ee..dc7334eff 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -144,6 +144,22 @@
- 4
+
+ - 40 MB
+ - 80 MB
+ - 160 MB
+ - 320 MB
+ - 640 MB
+
+
+
+ - 40
+ - 80
+ - 160
+ - 320
+ - 640
+
+
- @string/page_menu_refresh
- @string/page_menu_share
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2ae4de545..b95644217 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -488,6 +488,7 @@
Clear download path cache?
Clear memory cache
Clear thumb, gallery info memory cache
+ Read cache size
Pattern protection
Pattern protection has not been set
Pattern protection has been set
diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml
index 7530cafae..e351ccf68 100644
--- a/app/src/main/res/xml/advanced_settings.xml
+++ b/app/src/main/res/xml/advanced_settings.xml
@@ -39,6 +39,15 @@
android:title="@string/settings_advanced_clear_memory_cache"
android:summary="@string/settings_advanced_clear_memory_cache_summary"/>
+
+