diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index 24bfe161d..58d6094da 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -86,8 +86,4 @@ 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 8f4105882..deb4a5f62 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -12,7 +12,6 @@ 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.PreferKey @@ -100,13 +99,6 @@ abstract class BaseActivity( observeLiveBus() } - override fun onWindowFocusChanged(hasFocus: Boolean) { - super.onWindowFocusChanged(hasFocus) - if (hasFocus) { - App.navigationBarHeight = navigationBarHeight - } - } - override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration?) { super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig) findViewById(R.id.title_bar) diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index 392349057..c79096391 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.* import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.Toolbar +import androidx.core.os.bundleOf import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import androidx.recyclerview.widget.LinearLayoutManager @@ -262,10 +263,11 @@ class ChangeSourceDialog : BaseDialogFragment(), override fun observeLiveBus() { observeEvent(EventBus.SOURCE_CHANGED) { - val payload = Bundle().apply { - putString("upCurSource", bookUrl) - } - adapter.notifyItemRangeChanged(0, adapter.itemCount, payload) + adapter.notifyItemRangeChanged( + 0, + adapter.itemCount, + bundleOf(Pair("upCurSource", bookUrl)) + ) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 0e0152540..d5e0705db 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -150,6 +150,7 @@ class ReadBookActivity : ReadBookBaseActivity(), override fun onWindowFocusChanged(hasFocus: Boolean) { super.onWindowFocusChanged(hasFocus) + binding.readView.upStyle() upSystemUiVisibility() } 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 cc4399d85..0d9c0c146 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,7 +7,6 @@ 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.timeFormat @@ -85,7 +84,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 App.navigationBarHeight + height = if (it.hideNavigationBar) 0 else activity?.navigationBarHeight ?: 0 } } contentTextView.upVisibleRect()