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