阅读界面导航栏不再透明

pull/1352/head
gedoor 3 years ago
parent e912bd4bc5
commit 7e5ca9c493
  1. 2
      app/src/main/assets/defaultData/bookSources.json
  2. 4
      app/src/main/java/io/legado/app/App.kt
  3. 8
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  4. 29
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  5. 6
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  6. 6
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  7. 5
      app/src/main/res/layout/view_book_page.xml
  8. 6
      app/src/main/res/layout/view_read_menu.xml

@ -54,7 +54,7 @@
"ruleToc": { "ruleToc": {
"chapterList": "$.content.content", "chapterList": "$.content.content",
"chapterName": "$.chapterTitle", "chapterName": "$.chapterTitle",
"chapterUrl": "$.id@js:java.put('chapterId'; result);'https://www.shuidi.online:9021/fileMgt/getAudioByChapterId?bookId=' + java.get('bookId') + '&chapterId=' + result + '&pageNum=1&pageSize=50'" "chapterUrl": "$.id@js:java.put('chapterId'; result);'https://www.shuidi.online:9021/fileMgt/getAudioByChapterId?bookId=' + java.get('bookId') + '&chapterId=' + result + \"&pageNum=1&pageSize=50&keyId={{var header = JSON.parse(source.getLoginHeader());var keyId = '1632746188011002';var ks = java.md5Encode(keyId + java.get('chapterId') + header.Authorization);keyId + '&keySecret=' + ks}\" + '}'"
}, },
"weight": 0 "weight": 0
} }

@ -84,8 +84,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.Theme import io.legado.app.constant.Theme
@ -78,13 +77,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)

@ -2,7 +2,6 @@ package io.legado.app.ui.book.read
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.graphics.Color
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.* import android.view.*
@ -88,17 +87,16 @@ abstract class ReadBookBaseActivity :
) { ) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window.insetsController?.let { window.insetsController?.let {
if (toolBarHide) { if (ReadBookConfig.hideNavigationBar) {
if (ReadBookConfig.hideStatusBar) { it.hide(WindowInsets.Type.navigationBars())
it.hide(WindowInsets.Type.statusBars())
}
if (ReadBookConfig.hideNavigationBar) {
it.hide(WindowInsets.Type.navigationBars())
}
} else { } else {
it.show(WindowInsets.Type.statusBars())
it.show(WindowInsets.Type.navigationBars()) it.show(WindowInsets.Type.navigationBars())
} }
if (toolBarHide && ReadBookConfig.hideStatusBar) {
it.hide(WindowInsets.Type.statusBars())
} else {
it.show(WindowInsets.Type.statusBars())
}
} }
} }
upSystemUiVisibilityO(isInMultiWindow, toolBarHide) upSystemUiVisibilityO(isInMultiWindow, toolBarHide)
@ -123,14 +121,13 @@ abstract class ReadBookBaseActivity :
if (!isInMultiWindow) { if (!isInMultiWindow) {
flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
} }
flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION if (ReadBookConfig.hideNavigationBar) {
flag = flag or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
}
if (toolBarHide) { if (toolBarHide) {
if (ReadBookConfig.hideStatusBar) { if (ReadBookConfig.hideStatusBar) {
flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN
} }
if (ReadBookConfig.hideNavigationBar) {
flag = flag or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
}
} }
window.decorView.systemUiVisibility = flag window.decorView.systemUiVisibility = flag
} }
@ -139,11 +136,7 @@ abstract class ReadBookBaseActivity :
when { when {
binding.readMenu.isVisible -> super.upNavigationBarColor() binding.readMenu.isVisible -> super.upNavigationBarColor()
bottomDialog > 0 -> super.upNavigationBarColor() bottomDialog > 0 -> super.upNavigationBarColor()
else -> if (AppConfig.immNavigationBar) { else -> ATH.setNavigationBarColorAuto(this, ReadBookConfig.bgMeanColor)
ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT)
} else {
ATH.setNavigationBarColorAuto(this, Color.parseColor("#20000000"))
}
} }
} }

@ -83,7 +83,6 @@ class ReadMenu @JvmOverloads constructor(
ivSetting.setColorFilter(textColor) ivSetting.setColorFilter(textColor)
tvSetting.setTextColor(textColor) tvSetting.setTextColor(textColor)
vwBg.setOnClickListener(null) vwBg.setOnClickListener(null)
vwNavigationBar.setOnClickListener(null)
llBrightness.setOnClickListener(null) llBrightness.setOnClickListener(null)
seekBrightness.post { seekBrightness.post {
seekBrightness.progress = AppConfig.readBrightness seekBrightness.progress = AppConfig.readBrightness
@ -255,11 +254,6 @@ class ReadMenu @JvmOverloads constructor(
override fun onAnimationEnd(animation: Animation) { override fun onAnimationEnd(animation: Animation) {
binding.vwMenuBg.setOnClickListener { runMenuOut() } binding.vwMenuBg.setOnClickListener { runMenuOut() }
binding.vwNavigationBar.run {
layoutParams = layoutParams.apply {
height = activity?.navigationBarHeight ?: 0
}
}
if (!LocalConfig.readMenuHelpVersionIsLast) { if (!LocalConfig.readMenuHelpVersionIsLast) {
callBack.showReadMenuHelp() callBack.showReadMenuHelp()
} }

@ -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
@ -84,11 +83,6 @@ 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 {
height =
if (it.hideNavigationBar) 0
else App.navigationBarHeight
}
} }
contentTextView.upVisibleRect() contentTextView.upVisibleRect()
upTime() upTime()

@ -148,9 +148,4 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/page_nv_bar"
android:layout_width="match_parent"
android:layout_height="0dp" />
</LinearLayout> </LinearLayout>

@ -470,12 +470,6 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<View
android:id="@+id/vwNavigationBar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/background_menu" />
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save