|
|
@ -92,7 +92,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView { |
|
|
|
canvas.clipPath(path) |
|
|
|
canvas.clipPath(path) |
|
|
|
} |
|
|
|
} |
|
|
|
super.onDraw(canvas) |
|
|
|
super.onDraw(canvas) |
|
|
|
if (!loadFailed) return |
|
|
|
if (!loadFailed || !showBookName) return |
|
|
|
name?.let { |
|
|
|
name?.let { |
|
|
|
namePaint.color = Color.WHITE |
|
|
|
namePaint.color = Color.WHITE |
|
|
|
namePaint.style = Paint.Style.STROKE |
|
|
|
namePaint.style = Paint.Style.STROKE |
|
|
@ -164,7 +164,8 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
lateinit var defaultDrawable: Drawable |
|
|
|
private var showBookName = false |
|
|
|
|
|
|
|
private lateinit var defaultDrawable: Drawable |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
upDefaultCover() |
|
|
|
upDefaultCover() |
|
|
@ -172,8 +173,14 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView { |
|
|
|
|
|
|
|
|
|
|
|
fun upDefaultCover() { |
|
|
|
fun upDefaultCover() { |
|
|
|
val path = App.INSTANCE.getPrefString(PreferKey.defaultCover) |
|
|
|
val path = App.INSTANCE.getPrefString(PreferKey.defaultCover) |
|
|
|
defaultDrawable = Drawable.createFromPath(path) |
|
|
|
var dw = Drawable.createFromPath(path) |
|
|
|
?: App.INSTANCE.resources.getDrawable(R.drawable.image_cover_default, null) |
|
|
|
if (dw == null) { |
|
|
|
|
|
|
|
showBookName = true |
|
|
|
|
|
|
|
dw = App.INSTANCE.resources.getDrawable(R.drawable.image_cover_default, null) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
showBookName = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
defaultDrawable = dw!! |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|