diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index c31fedde6..35f43c811 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -47,17 +47,21 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at invalidate() } - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - ChapterProvider.viewWidth = w - ChapterProvider.viewHeight = h - ChapterProvider.upSize() + fun upVisibleRect() { visibleRect.set( ChapterProvider.paddingLeft.toFloat(), ChapterProvider.paddingTop.toFloat(), ChapterProvider.visibleRight.toFloat(), ChapterProvider.visibleBottom.toFloat() ) + } + + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + ChapterProvider.viewWidth = w + ChapterProvider.viewHeight = h + ChapterProvider.upSize() + upVisibleRect() textPage.format() } 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 98eff7aad..fb60c6361 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 @@ -52,12 +52,7 @@ class ContentView(context: Context) : FrameLayout(context) { ll_header.gone() page_panel.setPadding(0, context.statusBarHeight, 0, 0) } - content_text_view.setPadding( - paddingLeft.dp, - paddingTop.dp, - paddingRight.dp, - paddingBottom.dp - ) + content_text_view.upVisibleRect() ll_footer.setPadding( footerPaddingLeft.dp, footerPaddingTop.dp, diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt index 1e780737e..33df6bde5 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt @@ -141,6 +141,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { } } } + searchBooks = copyDataS searchBookLiveData.postValue(copyDataS) }