pull/1352/head
gedoor 3 years ago
parent e444daf536
commit c4e51aaf9a
  1. 34
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  2. 1
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  3. 7
      app/src/main/res/layout/activity_book_read.xml

@ -22,12 +22,13 @@ import io.legado.app.lib.dialogs.selector
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.model.CacheBook
import io.legado.app.model.ReadBook
import io.legado.app.ui.book.read.config.BgTextConfigDialog
import io.legado.app.ui.book.read.config.ClickActionConfigDialog
import io.legado.app.ui.book.read.config.PaddingConfigDialog
import io.legado.app.utils.getPrefString
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
@ -48,6 +49,7 @@ abstract class ReadBookBaseActivity :
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.navigationBar.setBackgroundColor(bottomBackground)
if (!LocalConfig.readHelpVersionIsLast) {
showClickRegionalConfig()
}
@ -86,16 +88,16 @@ abstract class ReadBookBaseActivity :
toolBarHide: Boolean = true
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.let {
if (ReadBookConfig.hideNavigationBar) {
it.hide(WindowInsets.Type.navigationBars())
window.insetsController?.run {
if (toolBarHide && ReadBookConfig.hideNavigationBar) {
hide(WindowInsets.Type.navigationBars())
} else {
it.show(WindowInsets.Type.navigationBars())
show(WindowInsets.Type.navigationBars())
}
if (toolBarHide && ReadBookConfig.hideStatusBar) {
it.hide(WindowInsets.Type.statusBars())
hide(WindowInsets.Type.statusBars())
} else {
it.show(WindowInsets.Type.statusBars())
show(WindowInsets.Type.statusBars())
}
}
}
@ -134,6 +136,7 @@ abstract class ReadBookBaseActivity :
}
override fun upNavigationBarColor() {
upNavigationBar()
when {
binding.readMenu.isVisible -> super.upNavigationBarColor()
bottomDialog > 0 -> super.upNavigationBarColor()
@ -141,6 +144,23 @@ abstract class ReadBookBaseActivity :
}
}
private fun upNavigationBar() {
binding.navigationBar.run {
if (bottomDialog > 0 || binding.readMenu.isVisible) {
layoutParams = layoutParams.apply {
height = if (ReadBookConfig.hideNavigationBar) {
activity?.navigationBarHeight ?: 0
} else {
0
}
}
visible()
} else {
gone()
}
}
}
/**
* 保持亮屏
*/

@ -63,6 +63,7 @@ class ReadMenu @JvmOverloads constructor(
brightnessBackground.setColor(ColorUtils.adjustAlpha(bgColor, 0.5f))
llBrightness.background = brightnessBackground
llBottomBg.setBackgroundColor(bgColor)
vwNavigationBar.setBackgroundColor(bgColor)
fabSearch.backgroundTintList = bottomBackgroundList
fabSearch.setColorFilter(textColor)
fabAutoPage.backgroundTintList = bottomBackgroundList

@ -37,4 +37,11 @@
android:layout_height="match_parent"
android:visibility="gone" />
<View
android:id="@+id/navigation_bar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/background_menu"
android:layout_gravity="bottom" />
</FrameLayout>
Loading…
Cancel
Save