优化翻页动画

pull/1903/head
kunfei 3 years ago
parent 589fe363e6
commit 9c3f8a466c
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  2. 8
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt

@ -66,7 +66,7 @@ class PageView(context: Context) : FrameLayout(context) {
fun getBitmap(): Bitmap? { fun getBitmap(): Bitmap? {
synchronized(this) { synchronized(this) {
return bitmap return bitmap?.copy(Bitmap.Config.ARGB_8888, false)
} }
} }

@ -20,15 +20,15 @@ abstract class HorizontalPageDelegate(readView: ReadView) : PageDelegate(readVie
when (mDirection) { when (mDirection) {
PageDirection.PREV -> { PageDirection.PREV -> {
prevBitmap?.recycle() prevBitmap?.recycle()
prevBitmap = prevPage.getBitmap()?.copy(Bitmap.Config.ARGB_8888, false) prevBitmap = prevPage.getBitmap()
curBitmap?.recycle() curBitmap?.recycle()
curBitmap = curPage.getBitmap()?.copy(Bitmap.Config.ARGB_8888, false) curBitmap = curPage.getBitmap()
} }
PageDirection.NEXT -> { PageDirection.NEXT -> {
nextBitmap?.recycle() nextBitmap?.recycle()
nextBitmap = nextPage.getBitmap()?.copy(Bitmap.Config.ARGB_8888, false) nextBitmap = nextPage.getBitmap()
curBitmap?.recycle() curBitmap?.recycle()
curBitmap = curPage.getBitmap()?.copy(Bitmap.Config.ARGB_8888, false) curBitmap = curPage.getBitmap()
} }
else -> Unit else -> Unit
} }

Loading…
Cancel
Save