pull/1343/head
gedoor 3 years ago
parent e6ab621e92
commit 19a1e1591c
  1. 2
      app/src/main/java/io/legado/app/constant/AppPattern.kt
  2. 6
      app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt

@ -15,4 +15,6 @@ object AppPattern {
val authorRegex = Regex("^.*?作\\s*者[::\\s]*|\\s+著") val authorRegex = Regex("^.*?作\\s*者[::\\s]*|\\s+著")
val fileNameRegex = Regex("[\\\\/:*?\"<>|.]") val fileNameRegex = Regex("[\\\\/:*?\"<>|.]")
val splitGroupRegex = Regex("[,;,;]") val splitGroupRegex = Regex("[,;,;]")
val bdRegex = Regex("(\\p{P})+")
} }

@ -9,6 +9,7 @@ import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import io.legado.app.constant.AppPattern
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.glide.ImageLoader import io.legado.app.help.glide.ImageLoader
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
@ -167,9 +168,10 @@ 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) {
this.bitmapPath = path this.bitmapPath = path
this.name = name this.name = name?.replace(AppPattern.bdRegex, "")
this.author = author this.author = author?.replace(AppPattern.bdRegex, "")
if (AppConfig.useDefaultCover) { if (AppConfig.useDefaultCover) {
defaultCover = true
ImageLoader.load(context, BookCover.defaultDrawable) ImageLoader.load(context, BookCover.defaultDrawable)
.centerCrop() .centerCrop()
.into(this) .into(this)

Loading…
Cancel
Save