pull/1903/head
kunfei 3 years ago
parent c3df746216
commit 80c56322f6
  1. 18
      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? {
val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) return if (width > 0 && height > 0) {
val c = Canvas(screenshot) val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
c.translate(-scrollX.toFloat(), -scrollY.toFloat()) val c = Canvas(screenshot)
this.draw(c) c.translate(-scrollX.toFloat(), -scrollY.toFloat())
c.setBitmap(null) this.draw(c)
return screenshot c.setBitmap(null)
screenshot
} else {
null
}
} }
fun SeekBar.progressAdd(int: Int) { fun SeekBar.progressAdd(int: Int) {

Loading…
Cancel
Save