pull/737/head
Robot 4 years ago
commit eb26ab75a9
  1. 2
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 10
      app/src/main/java/io/legado/app/help/AppConfig.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  5. 1
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  6. 16
      app/src/main/java/io/legado/app/utils/SystemUtils.kt
  7. 4
      app/src/main/res/values-zh-rHK/strings.xml
  8. 4
      app/src/main/res/values-zh-rTW/strings.xml
  9. 4
      app/src/main/res/values-zh/strings.xml
  10. 4
      app/src/main/res/values/strings.xml
  11. 8
      app/src/main/res/xml/pref_config_theme.xml

@ -167,7 +167,7 @@ abstract class BaseActivity<VB : ViewBinding>(
} }
open fun upNavigationBarColor() { open fun upNavigationBarColor() {
if (AppConfig.isTransparentStatusBar) { if (AppConfig.immNavigationBar) {
ATH.setNavigationBarColorAuto(this, ThemeStore.navigationBarColor(this)) ATH.setNavigationBarColorAuto(this, ThemeStore.navigationBarColor(this))
} else { } else {
val nbColor = ColorUtils.darkenColor(ThemeStore.navigationBarColor(this)) val nbColor = ColorUtils.darkenColor(ThemeStore.navigationBarColor(this))

@ -55,6 +55,7 @@ object PreferKey {
const val autoReadSpeed = "autoReadSpeed" const val autoReadSpeed = "autoReadSpeed"
const val barElevation = "barElevation" const val barElevation = "barElevation"
const val transparentStatusBar = "transparentStatusBar" const val transparentStatusBar = "transparentStatusBar"
const val immNavigationBar = "immNavigationBar"
const val defaultCover = "defaultCover" const val defaultCover = "defaultCover"
const val replaceEnableDefault = "replaceEnableDefault" const val replaceEnableDefault = "replaceEnableDefault"
const val showBrightnessView = "showBrightnessView" const val showBrightnessView = "showBrightnessView"

@ -73,11 +73,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
} }
} }
var isTransparentStatusBar: Boolean val isTransparentStatusBar: Boolean
get() = context.getPrefBoolean(PreferKey.transparentStatusBar) get() = context.getPrefBoolean(PreferKey.transparentStatusBar, true)
set(value) {
context.putPrefBoolean(PreferKey.transparentStatusBar, value) val immNavigationBar: Boolean
} get() = context.getPrefBoolean(PreferKey.immNavigationBar, true)
val screenDirection: String? val screenDirection: String?
get() = context.getPrefString(PreferKey.screenDirection) get() = context.getPrefString(PreferKey.screenDirection)

@ -145,7 +145,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.isTransparentStatusBar) { else -> if (AppConfig.immNavigationBar) {
ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT) ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT)
} else { } else {
ATH.setNavigationBarColorAuto(this, Color.parseColor("#20000000")) ATH.setNavigationBarColorAuto(this, Color.parseColor("#20000000"))

@ -133,6 +133,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
when (key) { when (key) {
PreferKey.launcherIcon -> LauncherIconHelp.changeIcon(getPrefString(key)) PreferKey.launcherIcon -> LauncherIconHelp.changeIcon(getPrefString(key))
PreferKey.transparentStatusBar -> recreateActivities() PreferKey.transparentStatusBar -> recreateActivities()
PreferKey.immNavigationBar -> recreateActivities()
PreferKey.cPrimary, PreferKey.cPrimary,
PreferKey.cAccent, PreferKey.cAccent,
PreferKey.cBackground, PreferKey.cBackground,

@ -56,12 +56,16 @@ object SystemUtils {
*/ */
fun isNavigationBarExist(activity: Activity?): Boolean { fun isNavigationBarExist(activity: Activity?): Boolean {
activity?.let { activity?.let {
val vp = it.window.decorView as? ViewGroup val viewGroup = it.window.decorView as? ViewGroup
if (vp != null) { if (viewGroup != null) {
for (i in 0 until vp.childCount) { for (i in 0 until viewGroup.childCount) {
vp.getChildAt(i).context.packageName viewGroup.getChildAt(i).context.packageName
if (vp.getChildAt(i).id != View.NO_ID if (viewGroup.getChildAt(i).id != View.NO_ID
&& NAVIGATION == activity.resources.getResourceEntryName(vp.getChildAt(i).id) && NAVIGATION == activity.resources.getResourceEntryName(
viewGroup.getChildAt(
i
).id
)
) { ) {
return true return true
} }

@ -361,8 +361,8 @@
<string name="finish_book">完結書籍</string> <string name="finish_book">完結書籍</string>
<string name="local_book">本地書籍</string> <string name="local_book">本地書籍</string>
<string name="status_bar_immersion">狀態欄顏色透明</string> <string name="status_bar_immersion">狀態欄顏色透明</string>
<string name="navigation_bar_color_change">導航欄變色</string> <string name="imm_navigation_bar">沉浸式导航栏</string>
<string name="navigation_bar_color_change_s">導航欄根據夜間模式變化</string> <string name="imm_navigation_bar_s">导航栏颜色透明</string>
<string name="add_to_shelf">放入書架</string> <string name="add_to_shelf">放入書架</string>
<string name="continue_read">繼續閲讀</string> <string name="continue_read">繼續閲讀</string>
<string name="cover_path">封面地址</string> <string name="cover_path">封面地址</string>

@ -362,8 +362,8 @@
<string name="finish_book">完結書籍</string> <string name="finish_book">完結書籍</string>
<string name="local_book">本機書籍</string> <string name="local_book">本機書籍</string>
<string name="status_bar_immersion">狀態欄顏色透明</string> <string name="status_bar_immersion">狀態欄顏色透明</string>
<string name="navigation_bar_color_change">導航欄變色</string> <string name="imm_navigation_bar">沉浸式导航栏</string>
<string name="navigation_bar_color_change_s">導航欄根據夜間模式變化</string> <string name="imm_navigation_bar_s">导航栏颜色透明</string>
<string name="add_to_shelf">放入書架</string> <string name="add_to_shelf">放入書架</string>
<string name="continue_read">繼續閱讀</string> <string name="continue_read">繼續閱讀</string>
<string name="cover_path">封面地址</string> <string name="cover_path">封面地址</string>

@ -364,8 +364,8 @@
<string name="finish_book">完结书籍</string> <string name="finish_book">完结书籍</string>
<string name="local_book">本地书籍</string> <string name="local_book">本地书籍</string>
<string name="status_bar_immersion">状态栏颜色透明</string> <string name="status_bar_immersion">状态栏颜色透明</string>
<string name="navigation_bar_color_change">导航栏变色</string> <string name="imm_navigation_bar">沉浸式导航栏</string>
<string name="navigation_bar_color_change_s">导航栏根据夜间模式变化</string> <string name="imm_navigation_bar_s">导航栏颜色透明</string>
<string name="add_to_shelf">放入书架</string> <string name="add_to_shelf">放入书架</string>
<string name="continue_read">继续阅读</string> <string name="continue_read">继续阅读</string>
<string name="cover_path">封面地址</string> <string name="cover_path">封面地址</string>

@ -365,8 +365,8 @@
<string name="finish_book">Finished books</string> <string name="finish_book">Finished books</string>
<string name="local_book">Local books</string> <string name="local_book">Local books</string>
<string name="status_bar_immersion">The status bar color becomes transparent</string> <string name="status_bar_immersion">The status bar color becomes transparent</string>
<string name="navigation_bar_color_change">Discolored navigation bar</string> <string name="imm_navigation_bar">immersion navigation bar</string>
<string name="navigation_bar_color_change_s">The navigation bar changes color following the dark mode</string> <string name="imm_navigation_bar_s">The navigation bar becomes transparent</string>
<string name="add_to_shelf">Add to Bookshelf</string> <string name="add_to_shelf">Add to Bookshelf</string>
<string name="continue_read">Continue reading</string> <string name="continue_read">Continue reading</string>
<string name="cover_path">Cover path</string> <string name="cover_path">Cover path</string>

@ -20,10 +20,10 @@
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.SwitchPreference <io.legado.app.ui.widget.prefs.SwitchPreference
android:defaultValue="false" android:defaultValue="true"
android:key="navigationBarColorChange" android:key="immNavigationBar"
android:summary="@string/navigation_bar_color_change_s" android:summary="@string/imm_navigation_bar_s"
android:title="@string/navigation_bar_color_change" android:title="@string/imm_navigation_bar"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference

Loading…
Cancel
Save