diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 4b949fe4e..059bb0382 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -51,6 +51,7 @@ object PreferKey { const val transparentStatusBar = "transparentStatusBar" const val defaultCover = "defaultCover" const val replaceEnableDefault = "replaceEnableDefault" + const val showBrightnessView = "showBrightnessView" const val cPrimary = "colorPrimary" const val cAccent = "colorAccent" diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 461f7598b..512d22a6f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -819,6 +819,9 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo observeEvent(PreferKey.textSelectAble) { page_view.curPage.upSelectAble(it) } + observeEvent(PreferKey.showBrightnessView) { + read_menu.upBrightnessState() + } } private fun upScreenTimeOut() { 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 89a30b8d1..0af320475 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 @@ -12,6 +12,7 @@ import androidx.core.view.isVisible import io.legado.app.App import io.legado.app.R import io.legado.app.constant.EventBus +import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.Selector @@ -33,6 +34,7 @@ class ReadMenu : FrameLayout { private lateinit var menuBottomOut: Animation private var bottomBackgroundList: ColorStateList private var onMenuOutEnd: (() -> Unit)? = null + val showBrightnessView get() = context.getPrefBoolean(PreferKey.showBrightnessView, true) constructor(context: Context) : super(context) @@ -69,7 +71,7 @@ class ReadMenu : FrameLayout { bindEvent() } - private fun upBrightnessState() { + fun upBrightnessState() { if (brightnessAuto()) { iv_brightness_auto.setColorFilter(context.accentColor) seek_brightness.isEnabled = false @@ -112,7 +114,7 @@ class ReadMenu : FrameLayout { } private fun brightnessAuto(): Boolean { - return context.getPrefBoolean("brightnessAuto", true) + return context.getPrefBoolean("brightnessAuto", true) || !showBrightnessView } private fun bindEvent() { @@ -210,11 +212,13 @@ class ReadMenu : FrameLayout { } private fun initAnimation() { + //显示菜单 menuTopIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_top_in) menuBottomIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) menuTopIn.setAnimationListener(object : Animation.AnimationListener { override fun onAnimationStart(animation: Animation) { callBack?.upSystemUiVisibility() + ll_brightness.visible(showBrightnessView) } override fun onAnimationEnd(animation: Animation) { @@ -234,7 +238,8 @@ class ReadMenu : FrameLayout { //隐藏菜单 menuTopOut = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_top_out) - menuBottomOut = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_out) + menuBottomOut = + AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_out) menuTopOut.setAnimationListener(object : Animation.AnimationListener { override fun onAnimationStart(animation: Animation) { vw_menu_bg.setOnClickListener(null) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 99e7e8421..f446681a8 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -115,6 +115,9 @@ class MoreConfigDialog : DialogFragment() { PreferKey.textBottomJustify -> { postEvent(EventBus.UP_CONFIG, true) } + PreferKey.showBrightnessView -> { + postEvent(PreferKey.showBrightnessView, "") + } } } diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 68413189b..2e47d7132 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -741,4 +741,5 @@ 强调色不能和文字颜色相似 格式不对 错误 + 显示亮度调节控件 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8e48622e5..684041caf 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -741,5 +741,6 @@ 强调色不能和文字颜色相似 格式不对 错误 + 显示亮度调节控件 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index ceed039ae..9b40b42c4 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -741,4 +741,5 @@ 强调色不能和文字颜色相似 格式不对 错误 + 显示亮度调节控件 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6475b1f22..b501e6f54 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -742,5 +742,6 @@ 强调色不能和文字颜色相似 格式不对 错误 + 显示亮度调节控件 \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index 6125aba08..35a290bdd 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -84,6 +84,12 @@ android:key="selectText" app:iconSpaceReserved="false" /> + +