From 6d23031054539a89d89581207cbac737081b2579 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 16 Oct 2021 22:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/widget/TitleBar.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt index 593ee4c4c..b44191fb3 100644 --- a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt @@ -43,6 +43,8 @@ class TitleBar @JvmOverloads constructor( private val displayHomeAsUp: Boolean private val navigationIconTint: ColorStateList? private val navigationIconTintMode: Int + private val fitStatusBar: Boolean + private val fitNavigationBar: Boolean private val attachToActivity: Boolean init { @@ -54,6 +56,8 @@ class TitleBar @JvmOverloads constructor( navigationIconTintMode = a.getInt(R.styleable.TitleBar_navigationIconTintMode, 9) attachToActivity = a.getBoolean(R.styleable.TitleBar_attachToActivity, true) displayHomeAsUp = a.getBoolean(R.styleable.TitleBar_displayHomeAsUp, true) + fitStatusBar = a.getBoolean(R.styleable.TitleBar_fitStatusBar, true) + fitNavigationBar = a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false) val navigationIcon = a.getDrawable(R.styleable.TitleBar_navigationIcon) val navigationContentDescription = @@ -140,11 +144,11 @@ class TitleBar @JvmOverloads constructor( } if (!isInEditMode) { - if (a.getBoolean(R.styleable.TitleBar_fitStatusBar, true)) { + if (fitStatusBar) { setPadding(paddingLeft, context.statusBarHeight, paddingRight, paddingBottom) } - if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) { + if (fitNavigationBar) { setPadding(paddingLeft, paddingTop, paddingRight, context.navigationBarHeight) }