From fc1d36d1c8655c6ad5812420c8cdb00ec45ae635 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 7 Jan 2020 09:20:30 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/book/read/page/ContentView.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index 903cc3abc..f5d329356 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -17,6 +17,7 @@ import io.legado.app.utils.* import kotlinx.android.synthetic.main.view_book_page.view.* import org.jetbrains.anko.matchParent import org.jetbrains.anko.sdk27.listeners.onScrollChange +import java.io.File import java.util.* @@ -83,10 +84,13 @@ class ContentView : FrameLayout { } context.getPrefString(PreferKey.readBookFont)?.let { if (it.isNotEmpty()) { - content_text_view.typeface = Typeface.createFromFile(it) - } else { - content_text_view.typeface = Typeface.DEFAULT + val file = File(it) + if (file.exists()) { + content_text_view.typeface = Typeface.createFromFile(it) + return@let + } } + content_text_view.typeface = Typeface.DEFAULT } }