mirror of
https://github.com/gedoor/legado.git
synced 2024-07-17 00:58:29 +08:00
优化
This commit is contained in:
parent
e213de75a1
commit
c873b72513
@ -219,6 +219,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
private val prevPageDebounce by lazy { Debounce { keyPage(PageDirection.PREV) } }
|
private val prevPageDebounce by lazy { Debounce { keyPage(PageDirection.PREV) } }
|
||||||
private var bookChanged = false
|
private var bookChanged = false
|
||||||
private var pageChanged = false
|
private var pageChanged = false
|
||||||
|
private var reloadContent = false
|
||||||
private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } }
|
private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } }
|
||||||
private var autoPageScrollOffset = 0.0
|
private var autoPageScrollOffset = 0.0
|
||||||
private val handler by lazy { buildMainHandler() }
|
private val handler by lazy { buildMainHandler() }
|
||||||
@ -267,14 +268,22 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||||
super.onPostCreate(savedInstanceState)
|
super.onPostCreate(savedInstanceState)
|
||||||
viewModel.initData(intent) {
|
viewModel.initData(intent) {
|
||||||
upMenu()
|
initDataSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
viewModel.initData(intent ?: return) {
|
viewModel.initData(intent ?: return) {
|
||||||
upMenu()
|
initDataSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDataSuccess() {
|
||||||
|
upMenu()
|
||||||
|
if (reloadContent) {
|
||||||
|
reloadContent = false
|
||||||
|
ReadBook.loadContent(resetPageOffset = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1526,6 +1535,8 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
if (it) { // 更新内容排版布局
|
if (it) { // 更新内容排版布局
|
||||||
if (isInitFinish) {
|
if (isInitFinish) {
|
||||||
ReadBook.loadContent(resetPageOffset = false)
|
ReadBook.loadContent(resetPageOffset = false)
|
||||||
|
} else {
|
||||||
|
reloadContent = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
readView.upContent(resetPageOffset = false)
|
readView.upContent(resetPageOffset = false)
|
||||||
|
Loading…
Reference in New Issue
Block a user