pull/32/head
kunfei 5 years ago
parent 6d5662d139
commit 452a3b6768
  1. 3
      app/src/main/java/io/legado/app/ui/widget/TitleBar.kt
  2. 5
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -18,6 +18,7 @@ import io.legado.app.R
import io.legado.app.lib.theme.DrawableUtils import io.legado.app.lib.theme.DrawableUtils
import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.ThemeStore
import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.utils.getNavigationBarHeight
import io.legado.app.utils.getStatusBarHeight import io.legado.app.utils.getStatusBarHeight
import org.jetbrains.anko.bottomPadding import org.jetbrains.anko.bottomPadding
import org.jetbrains.anko.topPadding import org.jetbrains.anko.topPadding
@ -99,7 +100,7 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a
} }
if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) { if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) {
bottomPadding = context.getStatusBarHeight() bottomPadding = context.getNavigationBarHeight()
} }
a.recycle() a.recycle()

@ -57,3 +57,8 @@ fun Context.getStatusBarHeight(): Int {
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android") val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId) return resources.getDimensionPixelSize(resourceId)
} }
fun Context.getNavigationBarHeight(): Int {
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId)
}

Loading…
Cancel
Save