From 926f7dfedb04008e60fe6d7004beef3e393ce9e1 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 17 Nov 2020 20:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/read/page/ContentView.kt | 5 +++++ app/src/main/java/io/legado/app/utils/ActivityExtensions.kt | 4 ++++ 2 files changed, 9 insertions(+) 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)) {