diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index 7a2eb46b0..da67799cc 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -89,4 +89,8 @@ class App : MultiDexApplication() { } } + companion object { + var navigationBarHeight = 0 + } + } diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index 36965e86b..31deca8e4 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -11,6 +11,7 @@ import android.view.View import android.widget.FrameLayout import androidx.appcompat.app.AppCompatActivity import androidx.viewbinding.ViewBinding +import io.legado.app.App import io.legado.app.R import io.legado.app.constant.AppConst import io.legado.app.constant.Theme @@ -81,7 +82,7 @@ abstract class BaseActivity( override fun onWindowFocusChanged(hasFocus: Boolean) { super.onWindowFocusChanged(hasFocus) if (hasFocus) { - AppConst.navigationBarHeight = navigationBarHeight + App.navigationBarHeight = navigationBarHeight } } diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index d01e18807..0e1634219 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -18,8 +18,6 @@ object AppConst { const val UA_NAME = "User-Agent" - var navigationBarHeight = 0 - val SCRIPT_ENGINE: ScriptEngine by lazy { ScriptEngineManager().getEngineByName("rhino") } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 753bb01a9..7b621735f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -7,9 +7,9 @@ import android.view.LayoutInflater import android.widget.FrameLayout import androidx.core.view.isGone import androidx.core.view.isInvisible +import io.legado.app.App import io.legado.app.R import io.legado.app.base.BaseActivity -import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst.timeFormat import io.legado.app.data.entities.Bookmark import io.legado.app.databinding.ViewBookPageBinding @@ -85,7 +85,7 @@ class PageView(context: Context) : FrameLayout(context) { vwTopDivider.visible(it.showHeaderLine) vwBottomDivider.visible(it.showFooterLine) pageNvBar.layoutParams = pageNvBar.layoutParams.apply { - height = if (it.hideNavigationBar) 0 else AppConst.navigationBarHeight + height = if (it.hideNavigationBar) 0 else App.navigationBarHeight } } contentTextView.upVisibleRect()