|
@@ -61,11 +61,11 @@ import androidx.compose.material.icons.filled.Block
|
|
|
import androidx.compose.material.icons.filled.Bookmark
|
|
import androidx.compose.material.icons.filled.Bookmark
|
|
|
import androidx.compose.material.icons.filled.BrightnessAuto
|
|
import androidx.compose.material.icons.filled.BrightnessAuto
|
|
|
import androidx.compose.material.icons.filled.BugReport
|
|
import androidx.compose.material.icons.filled.BugReport
|
|
|
-import androidx.compose.material.icons.filled.Build
|
|
|
|
|
import androidx.compose.material.icons.filled.CleanHands
|
|
import androidx.compose.material.icons.filled.CleanHands
|
|
|
import androidx.compose.material.icons.filled.Close
|
|
import androidx.compose.material.icons.filled.Close
|
|
|
import androidx.compose.material.icons.filled.CloudDownload
|
|
import androidx.compose.material.icons.filled.CloudDownload
|
|
|
import androidx.compose.material.icons.filled.Edit
|
|
import androidx.compose.material.icons.filled.Edit
|
|
|
|
|
+import androidx.compose.material.icons.filled.Extension
|
|
|
import androidx.compose.material.icons.filled.FindReplace
|
|
import androidx.compose.material.icons.filled.FindReplace
|
|
|
import androidx.compose.material.icons.filled.Image
|
|
import androidx.compose.material.icons.filled.Image
|
|
|
import androidx.compose.material.icons.filled.Menu
|
|
import androidx.compose.material.icons.filled.Menu
|
|
@@ -1000,7 +1000,6 @@ private fun MenuTitleBar(
|
|
|
)
|
|
)
|
|
|
) {
|
|
) {
|
|
|
val useTitleCapsule = readMenuTopBarTitleCapsuleEnabled(backdrop, state.menuConfig)
|
|
val useTitleCapsule = readMenuTopBarTitleCapsuleEnabled(backdrop, state.menuConfig)
|
|
|
- && topBarVisualState.isProgressiveBlur
|
|
|
|
|
val capsuleIconColor = LegadoTheme.colorScheme.onSurfaceVariant
|
|
val capsuleIconColor = LegadoTheme.colorScheme.onSurfaceVariant
|
|
|
|
|
|
|
|
// Title row: left group (back + capsule/title) + right group (actions)
|
|
// Title row: left group (back + capsule/title) + right group (actions)
|
|
@@ -1025,7 +1024,7 @@ private fun MenuTitleBar(
|
|
|
backdrop = backdrop,
|
|
backdrop = backdrop,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- if (useTitleCapsule) {
|
|
|
|
|
|
|
+ if (useTitleCapsule && titleBarMode != "1" && titleBarMode != "3") {
|
|
|
TitleCapsuleGlassLayout(
|
|
TitleCapsuleGlassLayout(
|
|
|
state = state,
|
|
state = state,
|
|
|
colors = colors,
|
|
colors = colors,
|
|
@@ -1063,12 +1062,13 @@ private fun MenuTitleBar(
|
|
|
backdrop = backdrop,
|
|
backdrop = backdrop,
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ val compact = state.menuConfig.titleBarCompact
|
|
|
Row(
|
|
Row(
|
|
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
) {
|
|
) {
|
|
|
if (!state.isLocalBook) {
|
|
if (!state.isLocalBook) {
|
|
|
- if (state.bookSource?.customButton == true) {
|
|
|
|
|
|
|
+ if (!compact && state.bookSource?.customButton == true) {
|
|
|
SourceCustomActionButton(
|
|
SourceCustomActionButton(
|
|
|
state = state,
|
|
state = state,
|
|
|
colors = colors,
|
|
colors = colors,
|
|
@@ -1076,25 +1076,27 @@ private fun MenuTitleBar(
|
|
|
backdrop = backdrop,
|
|
backdrop = backdrop,
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- SourceActionButton(
|
|
|
|
|
- state = state,
|
|
|
|
|
- colors = colors,
|
|
|
|
|
- onIntent = onIntent,
|
|
|
|
|
- backdrop = backdrop,
|
|
|
|
|
- )
|
|
|
|
|
- RefreshActionButton(
|
|
|
|
|
- state = state,
|
|
|
|
|
- colors = colors,
|
|
|
|
|
- onIntent = onIntent,
|
|
|
|
|
- backdrop = backdrop,
|
|
|
|
|
- )
|
|
|
|
|
- DownloadActionButton(
|
|
|
|
|
- state = state,
|
|
|
|
|
- colors = colors,
|
|
|
|
|
- onIntent = onIntent,
|
|
|
|
|
- backdrop = backdrop,
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ if (!compact) {
|
|
|
|
|
+ SourceActionButton(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ colors = colors,
|
|
|
|
|
+ onIntent = onIntent,
|
|
|
|
|
+ backdrop = backdrop,
|
|
|
|
|
+ )
|
|
|
|
|
+ RefreshActionButton(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ colors = colors,
|
|
|
|
|
+ onIntent = onIntent,
|
|
|
|
|
+ backdrop = backdrop,
|
|
|
|
|
+ )
|
|
|
|
|
+ DownloadActionButton(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ colors = colors,
|
|
|
|
|
+ onIntent = onIntent,
|
|
|
|
|
+ backdrop = backdrop,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (state.isLocalBook && !compact) {
|
|
|
if (state.isLocalTxt) {
|
|
if (state.isLocalTxt) {
|
|
|
TxtTocRuleActionButton(
|
|
TxtTocRuleActionButton(
|
|
|
state = state,
|
|
state = state,
|
|
@@ -1400,20 +1402,44 @@ private fun RowScope.TitleCapsuleGlassLayout(
|
|
|
titleTextColor: Color,
|
|
titleTextColor: Color,
|
|
|
) {
|
|
) {
|
|
|
val pillShape = RoundedCornerShape(50)
|
|
val pillShape = RoundedCornerShape(50)
|
|
|
|
|
+ val glassEnabled = readerMenuLiquidGlassAvailable(backdrop)
|
|
|
|
|
+ && state.menuConfig.readMenuTopBarLiquidGlassButtons
|
|
|
|
|
+ val iconStyle = state.menuConfig.titleBarIconStyle
|
|
|
|
|
|
|
|
Row(
|
|
Row(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.weight(1f)
|
|
.weight(1f)
|
|
|
.padding(start = 12.dp)
|
|
.padding(start = 12.dp)
|
|
|
.height(40.dp)
|
|
.height(40.dp)
|
|
|
- .readMenuLiquidGlass(
|
|
|
|
|
- backdrop = backdrop,
|
|
|
|
|
- colors = colors,
|
|
|
|
|
- shape = pillShape,
|
|
|
|
|
- useTopBarStyle = true,
|
|
|
|
|
- useLens = false,
|
|
|
|
|
- blurRadius = 32.dp,
|
|
|
|
|
- menuConfig = state.menuConfig,
|
|
|
|
|
|
|
+ .then(
|
|
|
|
|
+ if (glassEnabled) {
|
|
|
|
|
+ Modifier.readMenuLiquidGlass(
|
|
|
|
|
+ backdrop = backdrop,
|
|
|
|
|
+ colors = colors,
|
|
|
|
|
+ shape = pillShape,
|
|
|
|
|
+ useTopBarStyle = true,
|
|
|
|
|
+ useLens = false,
|
|
|
|
|
+ blurRadius = 32.dp,
|
|
|
|
|
+ menuConfig = state.menuConfig,
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ val containerColor = when (iconStyle) {
|
|
|
|
|
+ 1 -> LegadoTheme.colorScheme.surfaceContainerLow
|
|
|
|
|
+ else -> Color.Transparent
|
|
|
|
|
+ }
|
|
|
|
|
+ val border = when (iconStyle) {
|
|
|
|
|
+ 2 -> BorderStroke(
|
|
|
|
|
+ 1.dp,
|
|
|
|
|
+ LegadoTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.45f)
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ else -> null
|
|
|
|
|
+ }
|
|
|
|
|
+ Modifier
|
|
|
|
|
+ .clip(pillShape)
|
|
|
|
|
+ .background(containerColor, pillShape)
|
|
|
|
|
+ .then(if (border != null) Modifier.border(border, pillShape) else Modifier)
|
|
|
|
|
+ }
|
|
|
)
|
|
)
|
|
|
.then(
|
|
.then(
|
|
|
if (!state.isLocalBook) {
|
|
if (!state.isLocalBook) {
|
|
@@ -1470,6 +1496,7 @@ private fun MenuTitleBarMergedGlassButton(
|
|
|
|
|
|
|
|
val pillShape = RoundedCornerShape(50)
|
|
val pillShape = RoundedCornerShape(50)
|
|
|
val tint = LegadoTheme.colorScheme.onSurfaceVariant
|
|
val tint = LegadoTheme.colorScheme.onSurfaceVariant
|
|
|
|
|
+ val compact = state.menuConfig.titleBarCompact
|
|
|
|
|
|
|
|
Box {
|
|
Box {
|
|
|
Row(
|
|
Row(
|
|
@@ -1484,12 +1511,11 @@ private fun MenuTitleBarMergedGlassButton(
|
|
|
blurRadius = 32.dp,
|
|
blurRadius = 32.dp,
|
|
|
interactive = true,
|
|
interactive = true,
|
|
|
menuConfig = state.menuConfig,
|
|
menuConfig = state.menuConfig,
|
|
|
- )
|
|
|
|
|
- .padding(horizontal = 4.dp),
|
|
|
|
|
|
|
+ ),
|
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
|
) {
|
|
) {
|
|
|
// SwapHoriz - change source
|
|
// SwapHoriz - change source
|
|
|
- if (!state.isLocalBook) {
|
|
|
|
|
|
|
+ if (!state.isLocalBook && !compact) {
|
|
|
if (state.bookSource?.customButton == true) {
|
|
if (state.bookSource?.customButton == true) {
|
|
|
val customButtonDescription = stringResource(R.string.custom_button)
|
|
val customButtonDescription = stringResource(R.string.custom_button)
|
|
|
Box(
|
|
Box(
|
|
@@ -1509,7 +1535,7 @@ private fun MenuTitleBarMergedGlassButton(
|
|
|
},
|
|
},
|
|
|
) {
|
|
) {
|
|
|
Icon(
|
|
Icon(
|
|
|
- imageVector = Icons.Default.Build,
|
|
|
|
|
|
|
+ imageVector = Icons.Default.Extension,
|
|
|
contentDescription = null,
|
|
contentDescription = null,
|
|
|
tint = tint,
|
|
tint = tint,
|
|
|
modifier = Modifier.size(20.dp),
|
|
modifier = Modifier.size(20.dp),
|
|
@@ -1624,7 +1650,7 @@ private fun MenuTitleBarMergedGlassButton(
|
|
|
.background(tint.copy(alpha = 0.15f))
|
|
.background(tint.copy(alpha = 0.15f))
|
|
|
.clearAndSetSemantics { }
|
|
.clearAndSetSemantics { }
|
|
|
)
|
|
)
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (state.isLocalBook && !compact) {
|
|
|
// TXT directory rule
|
|
// TXT directory rule
|
|
|
if (state.isLocalTxt) {
|
|
if (state.isLocalTxt) {
|
|
|
val tocRuleDescription = stringResource(R.string.txt_toc_rule)
|
|
val tocRuleDescription = stringResource(R.string.txt_toc_rule)
|
|
@@ -1770,7 +1796,7 @@ private fun SourceCustomActionButton(
|
|
|
MenuTitleGlassButton(
|
|
MenuTitleGlassButton(
|
|
|
onClick = { onIntent(ReadBookIntent.SourceCustomButton(false)) },
|
|
onClick = { onIntent(ReadBookIntent.SourceCustomButton(false)) },
|
|
|
onLongClick = { onIntent(ReadBookIntent.SourceCustomButton(true)) },
|
|
onLongClick = { onIntent(ReadBookIntent.SourceCustomButton(true)) },
|
|
|
- icon = Icons.Default.Build,
|
|
|
|
|
|
|
+ icon = Icons.Default.Extension,
|
|
|
contentDescription = stringResource(R.string.custom_button),
|
|
contentDescription = stringResource(R.string.custom_button),
|
|
|
state = state,
|
|
state = state,
|
|
|
colors = colors,
|
|
colors = colors,
|
|
@@ -1998,6 +2024,41 @@ private fun OverflowDropdownMenu(
|
|
|
) { dismiss ->
|
|
) { dismiss ->
|
|
|
var imageStyleExpanded by remember { mutableStateOf(false) }
|
|
var imageStyleExpanded by remember { mutableStateOf(false) }
|
|
|
|
|
|
|
|
|
|
+ // Compact mode: moved from top bar buttons
|
|
|
|
|
+ if (state.menuConfig.titleBarCompact) {
|
|
|
|
|
+ if (!state.isLocalBook) {
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.change_origin),
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.SwapHoriz),
|
|
|
|
|
+ onClick = { dismiss(); onIntent(ReadBookIntent.MenuChangeSource) },
|
|
|
|
|
+ )
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.menu_refresh_after),
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.Refresh),
|
|
|
|
|
+ onClick = { dismiss(); onIntent(ReadBookIntent.MenuRefreshAfter) },
|
|
|
|
|
+ )
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.offline_cache),
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.CloudDownload),
|
|
|
|
|
+ onClick = { dismiss(); onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Download)) },
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (state.isLocalTxt) {
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.txt_toc_rule),
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.Toc),
|
|
|
|
|
+ onClick = { dismiss(); onIntent(ReadBookIntent.MenuTocRegex) },
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.set_charset),
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.Translate),
|
|
|
|
|
+ onClick = { dismiss(); onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Charset)) },
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ PillDivider()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Source actions
|
|
// Source actions
|
|
|
if (!state.isLocalBook) {
|
|
if (!state.isLocalBook) {
|
|
|
RoundDropdownMenuItem(
|
|
RoundDropdownMenuItem(
|
|
@@ -2154,7 +2215,7 @@ private fun OverflowDropdownMenu(
|
|
|
)
|
|
)
|
|
|
RoundDropdownMenuItem(
|
|
RoundDropdownMenuItem(
|
|
|
text = stringResource(R.string.config_btn),
|
|
text = stringResource(R.string.config_btn),
|
|
|
- leadingIcon = menuIcon(Icons.Default.Build),
|
|
|
|
|
|
|
+ leadingIcon = menuIcon(Icons.Default.Extension),
|
|
|
onClick = {
|
|
onClick = {
|
|
|
dismiss()
|
|
dismiss()
|
|
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.ToolButtonConfig))
|
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.ToolButtonConfig))
|
|
@@ -3094,9 +3155,7 @@ private fun readMenuTopBarTitleCapsuleEnabled(
|
|
|
backdrop: Backdrop?,
|
|
backdrop: Backdrop?,
|
|
|
menuConfig: ReadMenuConfig,
|
|
menuConfig: ReadMenuConfig,
|
|
|
): Boolean {
|
|
): Boolean {
|
|
|
- return menuConfig.readMenuTopBarBlurMode != ReadMenuBlurMode.None &&
|
|
|
|
|
- menuConfig.readMenuTopBarTitleCapsule &&
|
|
|
|
|
- readerMenuLiquidGlassAvailable(backdrop)
|
|
|
|
|
|
|
+ return menuConfig.readMenuTopBarTitleCapsule
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun readMenuBottomBarButtonLiquidGlassEnabled(
|
|
private fun readMenuBottomBarButtonLiquidGlassEnabled(
|