pull/1214/head
gedoor 3 years ago
parent 1b3e1983ee
commit 101432d24a
  1. 4
      app/src/main/java/io/legado/app/App.kt
  2. 8
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  3. 10
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  4. 1
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  5. 3
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

@ -86,8 +86,4 @@ class App : MultiDexApplication() {
} }
} }
companion object {
var navigationBarHeight = 0
}
} }

@ -12,7 +12,6 @@ import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding import androidx.viewbinding.ViewBinding
import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
@ -100,13 +99,6 @@ abstract class BaseActivity<VB : ViewBinding>(
observeLiveBus() observeLiveBus()
} }
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
App.navigationBarHeight = navigationBarHeight
}
}
override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration?) { override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration?) {
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig) super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig)
findViewById<TitleBar>(R.id.title_bar) findViewById<TitleBar>(R.id.title_bar)

@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.* import android.view.*
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -262,10 +263,11 @@ class ChangeSourceDialog : BaseDialogFragment(),
override fun observeLiveBus() { override fun observeLiveBus() {
observeEvent<String>(EventBus.SOURCE_CHANGED) { observeEvent<String>(EventBus.SOURCE_CHANGED) {
val payload = Bundle().apply { adapter.notifyItemRangeChanged(
putString("upCurSource", bookUrl) 0,
} adapter.itemCount,
adapter.notifyItemRangeChanged(0, adapter.itemCount, payload) bundleOf(Pair("upCurSource", bookUrl))
)
} }
} }

@ -150,6 +150,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
override fun onWindowFocusChanged(hasFocus: Boolean) { override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus) super.onWindowFocusChanged(hasFocus)
binding.readView.upStyle()
upSystemUiVisibility() upSystemUiVisibility()
} }

@ -7,7 +7,6 @@ import android.view.LayoutInflater
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.constant.AppConst.timeFormat import io.legado.app.constant.AppConst.timeFormat
@ -85,7 +84,7 @@ class PageView(context: Context) : FrameLayout(context) {
vwTopDivider.visible(it.showHeaderLine) vwTopDivider.visible(it.showHeaderLine)
vwBottomDivider.visible(it.showFooterLine) vwBottomDivider.visible(it.showFooterLine)
pageNvBar.layoutParams = pageNvBar.layoutParams.apply { pageNvBar.layoutParams = pageNvBar.layoutParams.apply {
height = if (it.hideNavigationBar) 0 else App.navigationBarHeight height = if (it.hideNavigationBar) 0 else activity?.navigationBarHeight ?: 0
} }
} }
contentTextView.upVisibleRect() contentTextView.upVisibleRect()

Loading…
Cancel
Save