mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
c3df746216
commit
80c56322f6
@ -126,13 +126,17 @@ fun View.visible(visible: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
fun View.screenshot(): Bitmap {
|
||||
val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
val c = Canvas(screenshot)
|
||||
c.translate(-scrollX.toFloat(), -scrollY.toFloat())
|
||||
this.draw(c)
|
||||
c.setBitmap(null)
|
||||
return screenshot
|
||||
fun View.screenshot(): Bitmap? {
|
||||
return if (width > 0 && height > 0) {
|
||||
val screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
val c = Canvas(screenshot)
|
||||
c.translate(-scrollX.toFloat(), -scrollY.toFloat())
|
||||
this.draw(c)
|
||||
c.setBitmap(null)
|
||||
screenshot
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun SeekBar.progressAdd(int: Int) {
|
||||
|
Loading…
Reference in New Issue
Block a user