diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index f60b7c361..70b4a6b89 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -5,6 +5,7 @@ object PreferKey { const val themeMode = "themeMode" const val userAgent = "userAgent" const val showUnread = "showUnread" + const val useDefaultCover = "useDefaultCover" const val hideStatusBar = "hideStatusBar" const val clickActionTL = "clickActionTopLeft" const val clickActionTC = "clickActionTopCenter" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 102f9507c..b2c620f63 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -78,6 +78,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { appCtx.putPrefBoolean(PreferKey.showUnread, value) } + val useDefaultCover: Boolean + get() = appCtx.getPrefBoolean(PreferKey.useDefaultCover, false) + val isTransparentStatusBar: Boolean get() = appCtx.getPrefBoolean(PreferKey.transparentStatusBar, true) diff --git a/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt index 24bdd08fd..ac4b6159d 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt @@ -12,6 +12,7 @@ import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target import io.legado.app.R import io.legado.app.constant.PreferKey +import io.legado.app.help.AppConfig import io.legado.app.help.ImageLoader import io.legado.app.utils.getPrefString import splitties.init.appCtx @@ -132,34 +133,40 @@ class CoverImageView @JvmOverloads constructor( fun load(path: String?, name: String?, author: String?) { setText(name, author) - ImageLoader.load(context, path)//Glide自动识别http://,content://和file:// - .placeholder(defaultDrawable) - .error(defaultDrawable) - .listener(object : RequestListener { - override fun onLoadFailed( - e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean - ): Boolean { - loadFailed = true - return false - } + if (AppConfig.useDefaultCover) { + ImageLoader.load(context, defaultDrawable) + .centerCrop() + .into(this) + } else { + ImageLoader.load(context, path)//Glide自动识别http://,content://和file:// + .placeholder(defaultDrawable) + .error(defaultDrawable) + .listener(object : RequestListener { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean + ): Boolean { + loadFailed = true + return false + } - override fun onResourceReady( - resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean - ): Boolean { - loadFailed = false - return false - } + override fun onResourceReady( + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean + ): Boolean { + loadFailed = false + return false + } - }) - .centerCrop() - .into(this) + }) + .centerCrop() + .into(this) + } } companion object { diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 302969db3..00e5789b7 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -825,5 +825,7 @@ 导出所有 完成 显示未读标志 + 总是使用默认封面 + 总是显示默认封面,不显示网络封面 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b826956ca..55ac557d9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -829,5 +829,7 @@ 导出所有 完成 显示未读标志 + 总是使用默认封面 + 总是显示默认封面,不显示网络封面 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 1f17b8764..1da9bdf53 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -829,5 +829,7 @@ 导出所有 完成 显示未读标志 + 总是使用默认封面 + 总是显示默认封面,不显示网络封面 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cd76c1764..8e891cbb0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -830,5 +830,7 @@ export_all complete Show unread + always use default cover + always use default cover,not use network diff --git a/app/src/main/res/xml/pref_config_other.xml b/app/src/main/res/xml/pref_config_other.xml index 8dadf0940..32b5aa3c1 100644 --- a/app/src/main/res/xml/pref_config_other.xml +++ b/app/src/main/res/xml/pref_config_other.xml @@ -43,6 +43,15 @@ app:allowDividerBelow="false" app:iconSpaceReserved="false" /> + +