pull/1333/head
gedoor 3 years ago
parent 96ed79e85b
commit a795f2256e
  1. 12
      app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt

@ -84,10 +84,6 @@ class CoverImageView @JvmOverloads constructor(
close() close()
} }
} }
namePaint.textSize = width / 6
namePaint.strokeWidth = namePaint.textSize / 10
authorPaint.textSize = width / 8
authorPaint.strokeWidth = authorPaint.textSize / 10
} }
override fun onDraw(canvas: Canvas) { override fun onDraw(canvas: Canvas) {
@ -104,6 +100,8 @@ class CoverImageView @JvmOverloads constructor(
var startX = width * 0.2f var startX = width * 0.2f
var startY = height * 0.2f var startY = height * 0.2f
name?.toStringArray()?.let { name -> name?.toStringArray()?.let { name ->
namePaint.textSize = width / 7
namePaint.strokeWidth = namePaint.textSize / 10
name.forEach { name.forEach {
namePaint.color = Color.WHITE namePaint.color = Color.WHITE
namePaint.style = Paint.Style.STROKE namePaint.style = Paint.Style.STROKE
@ -112,14 +110,16 @@ class CoverImageView @JvmOverloads constructor(
namePaint.style = Paint.Style.FILL namePaint.style = Paint.Style.FILL
canvas.drawText(it, startX, startY, namePaint) canvas.drawText(it, startX, startY, namePaint)
startY += namePaint.textHeight startY += namePaint.textHeight
if (startY > height * 0.9) { if (startY > height * 0.8) {
return@let return@let
} }
} }
} }
author?.toStringArray()?.let { author ->
startX = width * 0.8f startX = width * 0.8f
startY = height * 0.7f startY = height * 0.7f
author?.toStringArray()?.let { author -> authorPaint.textSize = width / 9
authorPaint.strokeWidth = authorPaint.textSize / 10
author.forEach { author.forEach {
authorPaint.color = Color.WHITE authorPaint.color = Color.WHITE
authorPaint.style = Paint.Style.STROKE authorPaint.style = Paint.Style.STROKE

Loading…
Cancel
Save