fix: 书签编辑移至独立 AppModalBottomSheet,修复液态玻璃亮度滑块拖动结束未保存
This commit is contained in:
@@ -43,7 +43,6 @@ sealed interface ReadBookMenuRoute {
|
||||
data object AutoRead : ReadBookMenuRoute
|
||||
data object PaddingConfig : ReadBookMenuRoute
|
||||
data object HeaderFooterConfig : ReadBookMenuRoute
|
||||
data class Bookmark(val bookmark: io.legado.app.data.entities.Bookmark) : ReadBookMenuRoute
|
||||
}
|
||||
|
||||
@Stable
|
||||
|
||||
@@ -167,7 +167,6 @@ import io.legado.app.ui.theme.LegadoTheme
|
||||
import io.legado.app.ui.theme.hazeStyle.HazeLegado
|
||||
import io.legado.app.ui.widget.components.AppSlider
|
||||
import io.legado.app.ui.widget.components.AppVerticalSlider
|
||||
import io.legado.app.ui.widget.components.bookmark.BookmarkEditContent
|
||||
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
||||
import io.legado.app.ui.widget.components.divider.PillDivider
|
||||
import io.legado.app.ui.widget.components.menuItem.MenuItemIcon
|
||||
@@ -764,23 +763,6 @@ private fun ReadBookMenuSurface(
|
||||
}
|
||||
}
|
||||
|
||||
is ReadBookMenuRoute.Bookmark -> {
|
||||
ReadBookMenuRoutePage(
|
||||
title = targetRoute.bookmark.chapterName,
|
||||
maxHeight = maxHeight,
|
||||
scrollContent = true,
|
||||
bottomPadding = if (extendSurfaceToNavigationBar) navBarHeight else 0.dp,
|
||||
onBack = { onIntent(ReadBookIntent.ReadMenuBack) },
|
||||
) {
|
||||
Box(Modifier.padding(horizontal = 16.dp)) {
|
||||
BookmarkEditContent(
|
||||
bookmark = targetRoute.bookmark,
|
||||
onSave = { onIntent(ReadBookIntent.SaveBookmark(it)) },
|
||||
onDelete = { onIntent(ReadBookIntent.DeleteBookmark(it)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2420,7 +2402,6 @@ private fun ReadMenuLiquidSlider(
|
||||
val rangeEnd = valueRange.endInclusive
|
||||
val range = rangeEnd - rangeStart
|
||||
val animationScope = rememberCoroutineScope()
|
||||
var didDrag by remember { mutableStateOf(false) }
|
||||
val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr
|
||||
val dampedDragAnimation = remember(animationScope, trackWidth, rangeStart, rangeEnd, isLtr) {
|
||||
DampedDragAnimation(
|
||||
@@ -2432,17 +2413,10 @@ private fun ReadMenuLiquidSlider(
|
||||
pressedScale = 1.5f,
|
||||
onDragStarted = {},
|
||||
onDragStopped = {
|
||||
if (didDrag) {
|
||||
onValueChange(targetValue)
|
||||
onValueCommit?.invoke(targetValue)
|
||||
} else {
|
||||
onValueChangeFinished?.invoke()
|
||||
}
|
||||
onValueChange(targetValue)
|
||||
onValueCommit?.invoke(targetValue) ?: onValueChangeFinished?.invoke()
|
||||
},
|
||||
onDrag = { _, dragAmount ->
|
||||
if (!didDrag) {
|
||||
didDrag = dragAmount.x != 0f
|
||||
}
|
||||
val delta = range * (dragAmount.x / trackWidth)
|
||||
val nextValue = if (isLtr) {
|
||||
(targetValue + delta).coerceIn(valueRange)
|
||||
|
||||
@@ -39,6 +39,7 @@ import io.legado.app.ui.book.read.sheet.UnderlineConfigSheet
|
||||
import io.legado.app.ui.widget.components.FontFolderState
|
||||
import io.legado.app.ui.widget.components.FontSelectSheet
|
||||
import io.legado.app.ui.widget.components.alert.AppAlertDialog
|
||||
import io.legado.app.ui.widget.components.bookmark.BookmarkEditSheet
|
||||
import io.legado.app.ui.widget.components.changeSource.ChangeSourceSheet
|
||||
import io.legado.app.ui.widget.components.log.AppLogSheet
|
||||
import io.legado.app.ui.config.readConfig.TextSelectMenuFilterSheet
|
||||
@@ -327,6 +328,16 @@ fun ReadBookScreen(
|
||||
sourceOrigin = photoSheet?.sourceOrigin,
|
||||
onDismissRequest = dismissSheet,
|
||||
)
|
||||
val bookmarkSheet = state.activeSheet as? ReadBookSheet.Bookmark
|
||||
bookmarkSheet?.let { sheet ->
|
||||
BookmarkEditSheet(
|
||||
show = true,
|
||||
bookmark = sheet.bookmark,
|
||||
onDismiss = dismissSheet,
|
||||
onSave = { onIntent(ReadBookIntent.SaveBookmark(it)) },
|
||||
onDelete = { onIntent(ReadBookIntent.DeleteBookmark(it)) },
|
||||
)
|
||||
}
|
||||
|
||||
// AlertDialog-based sheets and special cases — conditionally composed
|
||||
when (state.activeSheet) {
|
||||
@@ -382,9 +393,7 @@ fun ReadBookScreen(
|
||||
)
|
||||
}
|
||||
|
||||
is ReadBookSheet.Bookmark -> {
|
||||
// Handled by ViewModel — redirects to menu route
|
||||
}
|
||||
is ReadBookSheet.Bookmark -> Unit
|
||||
|
||||
is ReadBookSheet.InfoConfig -> {
|
||||
// Integrated into ReadStyleSheet's HeaderFooterPage
|
||||
|
||||
@@ -380,10 +380,7 @@ class ReadBookViewModel(
|
||||
}
|
||||
|
||||
is ReadBookIntent.ShowSheet -> {
|
||||
if (intent.sheet is ReadBookSheet.Bookmark) {
|
||||
// Bookmark is shown as a menu route, not a sheet
|
||||
openReadMenuRoute(ReadBookMenuRoute.Bookmark(intent.sheet.bookmark))
|
||||
} else if (intent.sheet is ReadBookSheet.HighlightRuleConfig) {
|
||||
if (intent.sheet is ReadBookSheet.HighlightRuleConfig) {
|
||||
loadHighlightRules()
|
||||
_uiState.update { it.copy(activeSheet = intent.sheet) }
|
||||
} else {
|
||||
@@ -1076,13 +1073,8 @@ class ReadBookViewModel(
|
||||
is ReadBookIntent.TextActionBookmark -> {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
menuState = ReadBookMenuState(
|
||||
visible = true,
|
||||
routeStack = kotlinx.collections.immutable.persistentListOf(
|
||||
ReadBookMenuRoute.Main,
|
||||
ReadBookMenuRoute.Bookmark(intent.bookmark),
|
||||
),
|
||||
),
|
||||
menuState = ReadBookMenuState(),
|
||||
activeSheet = ReadBookSheet.Bookmark(intent.bookmark),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1483,7 +1475,12 @@ class ReadBookViewModel(
|
||||
content = "",
|
||||
)
|
||||
withContext(Main) {
|
||||
openReadMenuRoute(ReadBookMenuRoute.Bookmark(bookmark))
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
menuState = ReadBookMenuState(),
|
||||
activeSheet = ReadBookSheet.Bookmark(bookmark),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user