添加总是显示默认封面配置

pull/985/head
gedoor 4 years ago
parent 106c30e1ae
commit a0d282453f
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 3
      app/src/main/java/io/legado/app/help/AppConfig.kt
  3. 7
      app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt
  4. 2
      app/src/main/res/values-zh-rHK/strings.xml
  5. 2
      app/src/main/res/values-zh-rTW/strings.xml
  6. 2
      app/src/main/res/values-zh/strings.xml
  7. 2
      app/src/main/res/values/strings.xml
  8. 9
      app/src/main/res/xml/pref_config_other.xml

@ -5,6 +5,7 @@ object PreferKey {
const val themeMode = "themeMode" const val themeMode = "themeMode"
const val userAgent = "userAgent" const val userAgent = "userAgent"
const val showUnread = "showUnread" const val showUnread = "showUnread"
const val useDefaultCover = "useDefaultCover"
const val hideStatusBar = "hideStatusBar" const val hideStatusBar = "hideStatusBar"
const val clickActionTL = "clickActionTopLeft" const val clickActionTL = "clickActionTopLeft"
const val clickActionTC = "clickActionTopCenter" const val clickActionTC = "clickActionTopCenter"

@ -78,6 +78,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
appCtx.putPrefBoolean(PreferKey.showUnread, value) appCtx.putPrefBoolean(PreferKey.showUnread, value)
} }
val useDefaultCover: Boolean
get() = appCtx.getPrefBoolean(PreferKey.useDefaultCover, false)
val isTransparentStatusBar: Boolean val isTransparentStatusBar: Boolean
get() = appCtx.getPrefBoolean(PreferKey.transparentStatusBar, true) get() = appCtx.getPrefBoolean(PreferKey.transparentStatusBar, true)

@ -12,6 +12,7 @@ import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.help.AppConfig
import io.legado.app.help.ImageLoader import io.legado.app.help.ImageLoader
import io.legado.app.utils.getPrefString import io.legado.app.utils.getPrefString
import splitties.init.appCtx import splitties.init.appCtx
@ -132,6 +133,11 @@ class CoverImageView @JvmOverloads constructor(
fun load(path: String?, name: String?, author: String?) { fun load(path: String?, name: String?, author: String?) {
setText(name, author) setText(name, author)
if (AppConfig.useDefaultCover) {
ImageLoader.load(context, defaultDrawable)
.centerCrop()
.into(this)
} else {
ImageLoader.load(context, path)//Glide自动识别http://,content://和file:// ImageLoader.load(context, path)//Glide自动识别http://,content://和file://
.placeholder(defaultDrawable) .placeholder(defaultDrawable)
.error(defaultDrawable) .error(defaultDrawable)
@ -161,6 +167,7 @@ class CoverImageView @JvmOverloads constructor(
.centerCrop() .centerCrop()
.into(this) .into(this)
} }
}
companion object { companion object {
private var showBookName = false private var showBookName = false

@ -825,5 +825,7 @@
<string name="export_all">导出所有</string> <string name="export_all">导出所有</string>
<string name="complete">完成</string> <string name="complete">完成</string>
<string name="show_unread">显示未读标志</string> <string name="show_unread">显示未读标志</string>
<string name="use_default_cover">总是使用默认封面</string>
<string name="use_default_cover_s">总是显示默认封面,不显示网络封面</string>
</resources> </resources>

@ -829,5 +829,7 @@
<string name="export_all">导出所有</string> <string name="export_all">导出所有</string>
<string name="complete">完成</string> <string name="complete">完成</string>
<string name="show_unread">显示未读标志</string> <string name="show_unread">显示未读标志</string>
<string name="use_default_cover">总是使用默认封面</string>
<string name="use_default_cover_s">总是显示默认封面,不显示网络封面</string>
</resources> </resources>

@ -829,5 +829,7 @@
<string name="export_all">导出所有</string> <string name="export_all">导出所有</string>
<string name="complete">完成</string> <string name="complete">完成</string>
<string name="show_unread">显示未读标志</string> <string name="show_unread">显示未读标志</string>
<string name="use_default_cover">总是使用默认封面</string>
<string name="use_default_cover_s">总是显示默认封面,不显示网络封面</string>
</resources> </resources>

@ -830,5 +830,7 @@
<string name="export_all">export_all</string> <string name="export_all">export_all</string>
<string name="complete">complete</string> <string name="complete">complete</string>
<string name="show_unread">Show unread</string> <string name="show_unread">Show unread</string>
<string name="use_default_cover">always use default cover</string>
<string name="use_default_cover_s">always use default cover,not use network</string>
</resources> </resources>

@ -43,6 +43,15 @@
app:allowDividerBelow="false" app:allowDividerBelow="false"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="false"
android:key="useDefaultCover"
android:title="@string/use_default_cover"
android:summary="@string/use_default_cover_s"
app:allowDividerAbove="false"
app:allowDividerBelow="false"
app:iconSpaceReserved="false" />
</io.legado.app.ui.widget.prefs.PreferenceCategory> </io.legado.app.ui.widget.prefs.PreferenceCategory>
<io.legado.app.ui.widget.prefs.PreferenceCategory <io.legado.app.ui.widget.prefs.PreferenceCategory

Loading…
Cancel
Save