From c32e02e56a48511a59726a19169d50490659d908 Mon Sep 17 00:00:00 2001 From: Jason Yao Date: Mon, 14 Sep 2020 21:32:05 -0400 Subject: [PATCH] Update ReadBookActivity.kt --- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 563a6f27c..7120e047a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -781,10 +781,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo val query = data.getStringExtra("query") viewModel.openChapter(index) // block until load correct chapter and pages - while (ReadBook.durChapterIndex != index || ReadBook.curTextChapter?.pages == null ){ + var pages = ReadBook.curTextChapter?.pages + while (ReadBook.durChapterIndex != index || pages == null ){ delay(100L) + pages = ReadBook.curTextChapter?.pages } - val pages = ReadBook.curTextChapter?.pages val positions = ReadBook.searchResultPositions(pages, indexWithinChapter, query!!) //todo: show selected text val job1 = async(Main){