From a3b648770f6aebbf86029a4402609458c354233a Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 28 Sep 2022 09:10:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/page/delegate/NoAnimPageDelegate.kt | 5 ----- .../main/java/io/legado/app/ui/widget/image/PhotoView.kt | 8 +++----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt index 706a509d6..9809a4f71 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt @@ -2,14 +2,9 @@ package io.legado.app.ui.book.read.page.delegate import android.graphics.Canvas import io.legado.app.ui.book.read.page.ReadView -import io.legado.app.ui.book.read.page.entities.PageDirection class NoAnimPageDelegate(readView: ReadView) : HorizontalPageDelegate(readView) { - override fun setDirection(direction: PageDirection) { - mDirection = direction - } - override fun onAnimStart(animationSpeed: Int) { if (!isCancel) { readView.fillPage(mDirection) diff --git a/app/src/main/java/io/legado/app/ui/widget/image/PhotoView.kt b/app/src/main/java/io/legado/app/ui/widget/image/PhotoView.kt index 7a67fef77..2ce1704b9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/PhotoView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/PhotoView.kt @@ -189,11 +189,9 @@ class PhotoView @JvmOverloads constructor( @SuppressLint("UseCompatLoadingForDrawables") override fun setImageResource(resId: Int) { - var drawable: Drawable? = null - try { - drawable = resources.getDrawable(resId, null) - } catch (e: Exception) { - } + val drawable: Drawable? = kotlin.runCatching { + resources.getDrawable(resId, null) + }.getOrNull() setImageDrawable(drawable) }