pull/1222/head
gedoor 3 years ago
parent ad5bfc4b57
commit bb7df5b804
  1. 4
      app/src/main/java/io/legado/app/App.kt
  2. 8
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  4. 3
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

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

@ -12,6 +12,7 @@ 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
@ -99,6 +100,13 @@ 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)

@ -7,7 +7,6 @@ import android.content.res.Configuration
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.util.Log
import android.view.* import android.view.*
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
@ -151,7 +150,6 @@ class ReadBookActivity : ReadBookBaseActivity(),
override fun onWindowFocusChanged(hasFocus: Boolean) { override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus) super.onWindowFocusChanged(hasFocus)
Log.d("navigationBarHeight", navigationBarHeight.toString())
upSystemUiVisibility() upSystemUiVisibility()
} }

@ -7,6 +7,7 @@ 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
@ -86,7 +87,7 @@ class PageView(context: Context) : FrameLayout(context) {
pageNvBar.layoutParams = pageNvBar.layoutParams.apply { pageNvBar.layoutParams = pageNvBar.layoutParams.apply {
height = height =
if (it.hideNavigationBar) 0 if (it.hideNavigationBar) 0
else activity?.navigationBarHeight ?: 0 else App.navigationBarHeight
} }
} }
contentTextView.upVisibleRect() contentTextView.upVisibleRect()

Loading…
Cancel
Save