From 7e5ca9c493d518b80e7d92a23eb1ba47899b18bd Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 29 Sep 2021 10:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BB=E7=95=8C=E9=9D=A2=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E4=B8=8D=E5=86=8D=E9=80=8F=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/assets/defaultData/bookSources.json | 2 +- app/src/main/java/io/legado/app/App.kt | 4 --- .../java/io/legado/app/base/BaseActivity.kt | 8 ----- .../app/ui/book/read/ReadBookBaseActivity.kt | 29 +++++++------------ .../io/legado/app/ui/book/read/ReadMenu.kt | 6 ---- .../legado/app/ui/book/read/page/PageView.kt | 6 ---- app/src/main/res/layout/view_book_page.xml | 5 ---- app/src/main/res/layout/view_read_menu.xml | 6 ---- 8 files changed, 12 insertions(+), 54 deletions(-) diff --git a/app/src/main/assets/defaultData/bookSources.json b/app/src/main/assets/defaultData/bookSources.json index 47d5be12b..9c429cbd7 100644 --- a/app/src/main/assets/defaultData/bookSources.json +++ b/app/src/main/assets/defaultData/bookSources.json @@ -54,7 +54,7 @@ "ruleToc": { "chapterList": "$.content.content", "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 } diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt index 991097d3c..5ecda4c4a 100644 --- a/app/src/main/java/io/legado/app/App.kt +++ b/app/src/main/java/io/legado/app/App.kt @@ -84,8 +84,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 8ecdb1cba..61aa04b48 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.Theme @@ -78,13 +77,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/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index b727551ba..a2ca85009 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -2,7 +2,6 @@ package io.legado.app.ui.book.read import android.annotation.SuppressLint import android.content.pm.ActivityInfo -import android.graphics.Color import android.os.Build import android.os.Bundle import android.view.* @@ -88,17 +87,16 @@ abstract class ReadBookBaseActivity : ) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { window.insetsController?.let { - if (toolBarHide) { - if (ReadBookConfig.hideStatusBar) { - it.hide(WindowInsets.Type.statusBars()) - } - if (ReadBookConfig.hideNavigationBar) { - it.hide(WindowInsets.Type.navigationBars()) - } + if (ReadBookConfig.hideNavigationBar) { + it.hide(WindowInsets.Type.navigationBars()) } else { - it.show(WindowInsets.Type.statusBars()) it.show(WindowInsets.Type.navigationBars()) } + if (toolBarHide && ReadBookConfig.hideStatusBar) { + it.hide(WindowInsets.Type.statusBars()) + } else { + it.show(WindowInsets.Type.statusBars()) + } } } upSystemUiVisibilityO(isInMultiWindow, toolBarHide) @@ -123,14 +121,13 @@ abstract class ReadBookBaseActivity : if (!isInMultiWindow) { 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 (ReadBookConfig.hideStatusBar) { flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN } - if (ReadBookConfig.hideNavigationBar) { - flag = flag or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - } } window.decorView.systemUiVisibility = flag } @@ -139,11 +136,7 @@ abstract class ReadBookBaseActivity : when { binding.readMenu.isVisible -> super.upNavigationBarColor() bottomDialog > 0 -> super.upNavigationBarColor() - else -> if (AppConfig.immNavigationBar) { - ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT) - } else { - ATH.setNavigationBarColorAuto(this, Color.parseColor("#20000000")) - } + else -> ATH.setNavigationBarColorAuto(this, ReadBookConfig.bgMeanColor) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index 45e854c6d..91d5f643e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -83,7 +83,6 @@ class ReadMenu @JvmOverloads constructor( ivSetting.setColorFilter(textColor) tvSetting.setTextColor(textColor) vwBg.setOnClickListener(null) - vwNavigationBar.setOnClickListener(null) llBrightness.setOnClickListener(null) seekBrightness.post { seekBrightness.progress = AppConfig.readBrightness @@ -255,11 +254,6 @@ class ReadMenu @JvmOverloads constructor( override fun onAnimationEnd(animation: Animation) { binding.vwMenuBg.setOnClickListener { runMenuOut() } - binding.vwNavigationBar.run { - layoutParams = layoutParams.apply { - height = activity?.navigationBarHeight ?: 0 - } - } if (!LocalConfig.readMenuHelpVersionIsLast) { callBack.showReadMenuHelp() } 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 ea34c2a74..96d79c6e6 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 @@ -84,11 +83,6 @@ 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 - } } contentTextView.upVisibleRect() upTime() diff --git a/app/src/main/res/layout/view_book_page.xml b/app/src/main/res/layout/view_book_page.xml index 69d35e794..95fd4f1f3 100644 --- a/app/src/main/res/layout/view_book_page.xml +++ b/app/src/main/res/layout/view_book_page.xml @@ -148,9 +148,4 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layout/view_read_menu.xml b/app/src/main/res/layout/view_read_menu.xml index e41cd22fd..1e3d59440 100644 --- a/app/src/main/res/layout/view_read_menu.xml +++ b/app/src/main/res/layout/view_read_menu.xml @@ -470,12 +470,6 @@ - - \ No newline at end of file