diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java index 89e8268a5..81e001537 100755 --- a/app/src/main/java/com/hippo/ehviewer/Settings.java +++ b/app/src/main/java/com/hippo/ehviewer/Settings.java @@ -69,6 +69,8 @@ public class Settings { public static final int DEFAULT_DEFAULT_CATEGORIES = EhUtils.ALL_CATEGORY; public static final String KEY_EXCLUDED_TAG_NAMESPACES = "excluded_tag_namespaces"; public static final String KEY_EXCLUDED_LANGUAGES = "excluded_languages"; + private static final String KEY_PREVIEW_NUM = "preview_num"; + private static final int DEFAULT_PREVIEW_NUM = 60; /******************** ****** Privacy and Security ********************/ @@ -583,6 +585,10 @@ public class Settings { putBoolean(KEY_SHOW_TAG_TRANSLATIONS, value); } + public static int getPreviewNum() { + return getInt(KEY_PREVIEW_NUM, DEFAULT_PREVIEW_NUM); + } + public static int getDefaultCategories() { return getInt(KEY_DEFAULT_CATEGORIES, DEFAULT_DEFAULT_CATEGORIES); } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java index a2acfa565..93cf3c50f 100755 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java @@ -1013,6 +1013,7 @@ public class GalleryDetailScene extends CollapsingToolbarScene implements View.O private void bindPreviews(GalleryDetail gd) { LayoutInflater inflater = getLayoutInflater(); Resources resources = getResourcesOrNull(); + int previewNum = Settings.getPreviewNum(); if (null == inflater || null == resources || null == mGridLayout || null == mPreviewText) { return; } @@ -1022,7 +1023,7 @@ public class GalleryDetailScene extends CollapsingToolbarScene implements View.O if (gd.previewPages <= 0 || previewSet == null || previewSet.size() == 0) { mPreviewText.setText(R.string.no_previews); return; - } else if (gd.previewPages == 1 && previewSet.size() <= 60) { + } else if (gd.previewPages == 1 && previewSet.size() <= previewNum) { mPreviewText.setText(R.string.no_more_previews); } else { mPreviewText.setText(R.string.more_previews); @@ -1031,7 +1032,7 @@ public class GalleryDetailScene extends CollapsingToolbarScene implements View.O int columnWidth = resources.getDimensionPixelOffset(Settings.getThumbSizeResId()); mGridLayout.setColumnSize(columnWidth); mGridLayout.setStrategy(SimpleGridAutoSpanLayout.STRATEGY_SUITABLE_SIZE); - int size = Math.min(60, previewSet.size()); + int size = Math.min(previewNum, previewSet.size()); for (int i = 0; i < size; i++) { View view = inflater.inflate(R.layout.item_gallery_preview, mGridLayout, false); mGridLayout.addView(view); diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a42ec38a6..936275267 100755 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -392,6 +392,7 @@ 显示翻译后的标签而非原始文字(需花费时间来下载数据文件) 补充翻译(由 EhTagTranslation 提供) https://github.com/EhTagTranslation/Editor/wiki + 画廊详情页预览图最大数量,由于历史因素,此值过大会导致卡顿 屏蔽画廊 根据标题、上传者、标签屏蔽画廊 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f2669bf57..3518b03a7 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -437,6 +437,7 @@ Show tag translations instead of the original text (It takes time to download the data file) Placeholder https://placeholder + The maximum number of previews on the gallery details page, for historical reasons, large value could cause lag Block gallery Block gallery by title, uploader and tags diff --git a/app/src/main/res/xml/eh_settings.xml b/app/src/main/res/xml/eh_settings.xml index d78392283..ea4c49018 100644 --- a/app/src/main/res/xml/eh_settings.xml +++ b/app/src/main/res/xml/eh_settings.xml @@ -146,6 +146,15 @@ app:iconSpaceReserved="false" app:url="@string/settings_eh_tag_translations_source_url" /> + +