Skip to content

Commit

Permalink
Fix missing navigation bar padding in page view
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Jan 16, 2025
1 parent dcb2d47 commit 7d515e4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
13 changes: 12 additions & 1 deletion app/src/main/java/io/legado/app/base/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ import io.legado.app.lib.theme.ThemeStore
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.TitleBar
import io.legado.app.utils.*
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.applyBackgroundTint
import io.legado.app.utils.applyOpenTint
import io.legado.app.utils.applyTint
import io.legado.app.utils.disableAutoFill
import io.legado.app.utils.fullScreen
import io.legado.app.utils.hideSoftInput
import io.legado.app.utils.setLightStatusBar
import io.legado.app.utils.setNavigationBarColorAuto
import io.legado.app.utils.setStatusBarColorAuto
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.windowSize


abstract class BaseActivity<VB : ViewBinding>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ import io.legado.app.utils.visible
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.Job
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MoreConfigDialog : BasePrefDialogFragment() {

PreferKey.hideNavigationBar -> {
ReadBookConfig.hideNavigationBar = getPrefBoolean(PreferKey.hideNavigationBar)
postEvent(EventBus.UP_CONFIG, arrayListOf(0))
postEvent(EventBus.UP_CONFIG, arrayListOf(0, 2))
}

PreferKey.keepLight -> postEvent(key, true)
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.legado.app.ui.book.read.page.entities.TextPos
import io.legado.app.ui.book.read.page.provider.ChapterProvider
import io.legado.app.ui.widget.BatteryView
import io.legado.app.utils.activity
import io.legado.app.utils.applyNavigationBarPadding
import io.legado.app.utils.applyStatusBarPadding
import io.legado.app.utils.dpToPx
import io.legado.app.utils.gone
Expand Down Expand Up @@ -61,6 +62,7 @@ class PageView(context: Context) : FrameLayout(context) {
if (!isInEditMode) {
upStyle()
binding.vwStatusBar.applyStatusBarPadding()
binding.vwNavigationBar.applyNavigationBarPadding()
}
}

Expand Down Expand Up @@ -92,6 +94,7 @@ class PageView(context: Context) : FrameLayout(context) {
vwTopDivider.backgroundColor = tipDividerColor
vwBottomDivider.backgroundColor = tipDividerColor
upStatusBar()
upNavigationBar()
llHeader.setPadding(
it.headerPaddingLeft.dpToPx(),
it.headerPaddingTop.dpToPx(),
Expand Down Expand Up @@ -119,6 +122,10 @@ class PageView(context: Context) : FrameLayout(context) {
isGone = ReadBookConfig.hideStatusBar || readBookActivity?.isInMultiWindow == true
}

fun upNavigationBar() {
binding.vwNavigationBar.isGone = ReadBookConfig.hideNavigationBar
}

/**
* 更新阅读信息
*/
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/view_book_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toTopOf="@id/vw_navigation_bar">

<io.legado.app.ui.widget.BatteryView
android:id="@+id/tv_footer_left"
Expand Down Expand Up @@ -139,4 +139,10 @@

</androidx.constraintlayout.widget.ConstraintLayout>

<FrameLayout
android:id="@+id/vw_navigation_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 7d515e4

Please sign in to comment.