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 bcc375a69..95b7ae318 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 @@ -51,6 +51,11 @@ class ContentView(context: Context) : FrameLayout(context) { } } + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + upStyle() + } + fun upStyle() { ReadBookConfig.apply { bv_header_left.typeface = ChapterProvider.typeface diff --git a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt b/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt index c8a0531ec..df4bae769 100644 --- a/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ActivityExtensions.kt @@ -22,6 +22,10 @@ fun Activity.getSize(): DisplayMetrics { return displayMetrics } +/** + * 该方法需要在View完全被绘制出来之后调用,否则判断不了 + * 在比如 onWindowFocusChanged()方法中可以得到正确的结果 + */ val Activity.navigationBarHeight: Int get() { if (SystemUtils.isNavigationBarExist(this)) {