pull/1903/head
kunfei 3 years ago
parent c3df746216
commit 80c56322f6
  1. 8
      app/src/main/java/io/legado/app/utils/ViewExtensions.kt

@ -126,13 +126,17 @@ fun View.visible(visible: Boolean) {
} }
} }
fun View.screenshot(): Bitmap { fun View.screenshot(): Bitmap? {
return if (width > 0 && height > 0) {
val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val c = Canvas(screenshot) val c = Canvas(screenshot)
c.translate(-scrollX.toFloat(), -scrollY.toFloat()) c.translate(-scrollX.toFloat(), -scrollY.toFloat())
this.draw(c) this.draw(c)
c.setBitmap(null) c.setBitmap(null)
return screenshot screenshot
} else {
null
}
} }
fun SeekBar.progressAdd(int: Int) { fun SeekBar.progressAdd(int: Int) {

Loading…
Cancel
Save