diff --git a/app/src/main/java/io/legado/app/help/config/AppConfig.kt b/app/src/main/java/io/legado/app/help/config/AppConfig.kt index 6ab47486a..ed658e4a7 100644 --- a/app/src/main/java/io/legado/app/help/config/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/AppConfig.kt @@ -288,6 +288,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { val recordLog get() = appCtx.getPrefBoolean(PreferKey.recordLog) + val loadOnlyWifi = appCtx.getPrefBoolean(PreferKey.loadCoverOnlyWifi, false) + val doublePageHorizontal: Boolean get() = appCtx.getPrefBoolean(PreferKey.doublePageHorizontal, true) diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt index 99d6b9285..f8702072f 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowAdapter.kt @@ -8,6 +8,7 @@ import io.legado.app.base.adapter.RecyclerAdapter import io.legado.app.data.entities.Book import io.legado.app.data.entities.SearchBook import io.legado.app.databinding.ItemSearchBinding +import io.legado.app.help.config.AppConfig import io.legado.app.utils.gone import io.legado.app.utils.visible @@ -42,7 +43,7 @@ class ExploreShowAdapter(context: Context, val callBack: CallBack) : llKind.visible() llKind.setLabels(kinds) } - ivCover.load(item.coverUrl, item.name, item.author) + ivCover.load(item.coverUrl, item.name, item.author, AppConfig.loadOnlyWifi) } } diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt index 469b71ada..7e4146a4c 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt @@ -9,6 +9,7 @@ import io.legado.app.base.adapter.DiffRecyclerAdapter import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.data.entities.SearchBook import io.legado.app.databinding.ItemSearchBinding +import io.legado.app.help.config.AppConfig import io.legado.app.utils.gone import io.legado.app.utils.visible @@ -81,8 +82,12 @@ class SearchAdapter(context: Context, val callBack: CallBack) : upLasted(binding, searchBook.latestChapterTitle) tvIntroduce.text = searchBook.trimIntro(context) upKind(binding, searchBook.getKindList()) - ivCover.load(searchBook.coverUrl, searchBook.name, searchBook.author) - + ivCover.load( + searchBook.coverUrl, + searchBook.name, + searchBook.author, + AppConfig.loadOnlyWifi + ) } } 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 ea5e0ddda..61b0baebe 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 @@ -11,13 +11,11 @@ import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import io.legado.app.constant.AppPattern -import io.legado.app.constant.PreferKey import io.legado.app.help.config.AppConfig import io.legado.app.help.glide.ImageLoader import io.legado.app.help.glide.OkHttpModelLoader import io.legado.app.lib.theme.accentColor import io.legado.app.model.BookCover -import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.textHeight import io.legado.app.utils.toStringArray @@ -173,7 +171,12 @@ class CoverImageView @JvmOverloads constructor( } } - fun load(path: String? = null, name: String? = null, author: String? = null) { + fun load( + path: String? = null, + name: String? = null, + author: String? = null, + loadOnlyWifi: Boolean = false + ) { this.bitmapPath = path this.name = name?.replace(AppPattern.bdRegex, "")?.trim() this.author = author?.replace(AppPattern.bdRegex, "")?.trim() @@ -183,7 +186,6 @@ class CoverImageView @JvmOverloads constructor( .centerCrop() .into(this) } else { - val loadOnlyWifi = context.getPrefBoolean(PreferKey.loadCoverOnlyWifi, false) ImageLoader.load(context, path)//Glide自动识别http://,content://和file:// .apply(RequestOptions().set(OkHttpModelLoader.loadOnlyWifiOption, loadOnlyWifi)) .placeholder(BookCover.defaultDrawable)