|
@@ -194,6 +194,7 @@ import kotlin.math.roundToInt
|
|
|
fun ReadBookMenuBar(
|
|
fun ReadBookMenuBar(
|
|
|
state: ReadBookUiState,
|
|
state: ReadBookUiState,
|
|
|
preferences: ReadPreferences,
|
|
preferences: ReadPreferences,
|
|
|
|
|
+ eyeProtectionActive: Boolean,
|
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
|
onBrightnessPreview: (Int) -> Unit,
|
|
onBrightnessPreview: (Int) -> Unit,
|
|
|
backdrop: Backdrop? = null,
|
|
backdrop: Backdrop? = null,
|
|
@@ -262,6 +263,7 @@ fun ReadBookMenuBar(
|
|
|
FloatingIconRow(
|
|
FloatingIconRow(
|
|
|
state = state,
|
|
state = state,
|
|
|
preferences = preferences,
|
|
preferences = preferences,
|
|
|
|
|
+ eyeProtectionActive = eyeProtectionActive,
|
|
|
colors = menuColors,
|
|
colors = menuColors,
|
|
|
alignment = if (state.menuConfig.titleBarIconPosition == 0) {
|
|
alignment = if (state.menuConfig.titleBarIconPosition == 0) {
|
|
|
Alignment.Start
|
|
Alignment.Start
|
|
@@ -377,6 +379,7 @@ fun ReadBookMenuBar(
|
|
|
FloatingIconRow(
|
|
FloatingIconRow(
|
|
|
state = state,
|
|
state = state,
|
|
|
preferences = preferences,
|
|
preferences = preferences,
|
|
|
|
|
+ eyeProtectionActive = eyeProtectionActive,
|
|
|
colors = menuColors,
|
|
colors = menuColors,
|
|
|
alignment = if (state.menuConfig.titleBarIconPosition == 2) {
|
|
alignment = if (state.menuConfig.titleBarIconPosition == 2) {
|
|
|
Alignment.Start
|
|
Alignment.Start
|
|
@@ -391,6 +394,7 @@ fun ReadBookMenuBar(
|
|
|
contentTarget = contentTarget,
|
|
contentTarget = contentTarget,
|
|
|
state = state,
|
|
state = state,
|
|
|
preferences = preferences,
|
|
preferences = preferences,
|
|
|
|
|
+ eyeProtectionActive = eyeProtectionActive,
|
|
|
colors = menuColors,
|
|
colors = menuColors,
|
|
|
onIntent = onIntent,
|
|
onIntent = onIntent,
|
|
|
context = context,
|
|
context = context,
|
|
@@ -416,6 +420,7 @@ private fun ReadBookMenuSurface(
|
|
|
contentTarget: ReadBookMenuContent,
|
|
contentTarget: ReadBookMenuContent,
|
|
|
state: ReadBookUiState,
|
|
state: ReadBookUiState,
|
|
|
preferences: ReadPreferences,
|
|
preferences: ReadPreferences,
|
|
|
|
|
+ eyeProtectionActive: Boolean,
|
|
|
colors: ReadMenuColors,
|
|
colors: ReadMenuColors,
|
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
|
context: Context,
|
|
context: Context,
|
|
@@ -672,7 +677,7 @@ private fun ReadBookMenuSurface(
|
|
|
ReadBookMenuRoute.Main -> {
|
|
ReadBookMenuRoute.Main -> {
|
|
|
MenuBottomBar(
|
|
MenuBottomBar(
|
|
|
state = state,
|
|
state = state,
|
|
|
- eyeProtectionEnabled = state.eyeProtection.enabled,
|
|
|
|
|
|
|
+ eyeProtectionEnabled = eyeProtectionActive,
|
|
|
colors = colors,
|
|
colors = colors,
|
|
|
onIntent = onIntent,
|
|
onIntent = onIntent,
|
|
|
context = context,
|
|
context = context,
|
|
@@ -720,7 +725,7 @@ private fun ReadBookMenuSurface(
|
|
|
readMenuCustomIcons = state.menuConfig.readMenuCustomIcons,
|
|
readMenuCustomIcons = state.menuConfig.readMenuCustomIcons,
|
|
|
bottomBarButtons = state.menuConfig.bottomBarButtons,
|
|
bottomBarButtons = state.menuConfig.bottomBarButtons,
|
|
|
preferences = preferences,
|
|
preferences = preferences,
|
|
|
- eyeProtectionEnabled = state.eyeProtection.enabled,
|
|
|
|
|
|
|
+ eyeProtectionEnabled = eyeProtectionActive,
|
|
|
onIntent = onIntent,
|
|
onIntent = onIntent,
|
|
|
styleConfig = state.styleConfig,
|
|
styleConfig = state.styleConfig,
|
|
|
)
|
|
)
|
|
@@ -1935,6 +1940,7 @@ private fun CharsetActionButton(
|
|
|
private fun FloatingIconRow(
|
|
private fun FloatingIconRow(
|
|
|
state: ReadBookUiState,
|
|
state: ReadBookUiState,
|
|
|
preferences: ReadPreferences,
|
|
preferences: ReadPreferences,
|
|
|
|
|
+ eyeProtectionActive: Boolean,
|
|
|
colors: ReadMenuColors,
|
|
colors: ReadMenuColors,
|
|
|
alignment: Alignment.Horizontal = Alignment.CenterHorizontally,
|
|
alignment: Alignment.Horizontal = Alignment.CenterHorizontally,
|
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
@@ -1947,12 +1953,13 @@ private fun FloatingIconRow(
|
|
|
state.isAutoPage,
|
|
state.isAutoPage,
|
|
|
state.translationMode,
|
|
state.translationMode,
|
|
|
state.useReplaceRule,
|
|
state.useReplaceRule,
|
|
|
- state.eyeProtection.enabled,
|
|
|
|
|
|
|
+ eyeProtectionActive,
|
|
|
) {
|
|
) {
|
|
|
loadFloatingIcons(
|
|
loadFloatingIcons(
|
|
|
context = context,
|
|
context = context,
|
|
|
state = state,
|
|
state = state,
|
|
|
preferences = preferences,
|
|
preferences = preferences,
|
|
|
|
|
+ eyeProtectionActive = eyeProtectionActive,
|
|
|
onIntent = onIntent,
|
|
onIntent = onIntent,
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -3345,6 +3352,7 @@ private fun loadFloatingIcons(
|
|
|
context: Context,
|
|
context: Context,
|
|
|
state: ReadBookUiState,
|
|
state: ReadBookUiState,
|
|
|
preferences: ReadPreferences,
|
|
preferences: ReadPreferences,
|
|
|
|
|
+ eyeProtectionActive: Boolean,
|
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
onIntent: (ReadBookIntent) -> Unit,
|
|
|
): List<FloatingIconDef> {
|
|
): List<FloatingIconDef> {
|
|
|
val infoMap = readMenuButtonInfos(context).associateBy { it.id }
|
|
val infoMap = readMenuButtonInfos(context).associateBy { it.id }
|
|
@@ -3386,7 +3394,7 @@ private fun loadFloatingIcons(
|
|
|
if (state.isAutoPage) add("auto_page")
|
|
if (state.isAutoPage) add("auto_page")
|
|
|
if (state.translationMode) add("translate")
|
|
if (state.translationMode) add("translate")
|
|
|
if (state.useReplaceRule) add("replace")
|
|
if (state.useReplaceRule) add("replace")
|
|
|
- if (state.eyeProtection.enabled) add("eye_protection")
|
|
|
|
|
|
|
+ if (eyeProtectionActive) add("eye_protection")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return state.menuConfig.titleBarButtons
|
|
return state.menuConfig.titleBarButtons
|