优化导航栏

pull/487/head^2
gedoor 4 years ago
parent f3481cbd04
commit c558d64f3a
  1. 3
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt
  3. 9
      app/src/main/java/io/legado/app/utils/ActivityExtensions.kt

@ -237,8 +237,7 @@ class ReadMenu @JvmOverloads constructor(
override fun onAnimationEnd(animation: Animation) {
vw_menu_bg.onClick { runMenuOut() }
vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply {
height =
if (SystemUtils.isNavigationBarExist(activity)) context.navigationBarHeight else 0
height = activity!!.navigationBarHeight
}
if (LocalConfig.isFirstReadMenuShow) {
callBack.showReadMenuHelp()

@ -85,7 +85,7 @@ class ContentView(context: Context) : FrameLayout(context) {
vw_top_divider.visible(showHeaderLine)
vw_bottom_divider.visible(showFooterLine)
page_nv_bar.layoutParams = page_nv_bar.layoutParams.apply {
height = if (hideStatusBar) 0 else context.navigationBarHeight
height = if (hideNavigationBar) 0 else activity!!.navigationBarHeight
}
content_text_view.upVisibleRect()
}

@ -21,3 +21,12 @@ fun Activity.getSize(): DisplayMetrics {
}
return displayMetrics
}
val Activity.navigationBarHeight: Int
get() {
if (SystemUtils.isNavigationBarExist(this)) {
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId)
}
return 0
}
Loading…
Cancel
Save