|
@@ -3,7 +3,6 @@ package io.legado.app.ui.book.info
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
|
import androidx.activity.compose.BackHandler
|
|
import androidx.activity.compose.BackHandler
|
|
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
|
|
-import androidx.compose.animation.animateColorAsState
|
|
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.clickable
|
|
import androidx.compose.foundation.clickable
|
|
@@ -43,6 +42,7 @@ import androidx.compose.material.icons.filled.Refresh
|
|
|
import androidx.compose.material.icons.filled.Share
|
|
import androidx.compose.material.icons.filled.Share
|
|
|
import androidx.compose.material.icons.filled.Star
|
|
import androidx.compose.material.icons.filled.Star
|
|
|
import androidx.compose.material.icons.outlined.Book
|
|
import androidx.compose.material.icons.outlined.Book
|
|
|
|
|
+import androidx.compose.material.icons.outlined.Bookmark
|
|
|
import androidx.compose.material.icons.outlined.CollectionsBookmark
|
|
import androidx.compose.material.icons.outlined.CollectionsBookmark
|
|
|
import androidx.compose.material.icons.outlined.FolderZip
|
|
import androidx.compose.material.icons.outlined.FolderZip
|
|
|
import androidx.compose.material.icons.outlined.Image
|
|
import androidx.compose.material.icons.outlined.Image
|
|
@@ -53,13 +53,14 @@ import androidx.compose.material3.CardDefaults
|
|
|
import androidx.compose.material3.CircularProgressIndicator
|
|
import androidx.compose.material3.CircularProgressIndicator
|
|
|
import androidx.compose.material3.ElevatedCard
|
|
import androidx.compose.material3.ElevatedCard
|
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
|
|
+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
|
import androidx.compose.material3.ExtendedFloatingActionButton
|
|
import androidx.compose.material3.ExtendedFloatingActionButton
|
|
|
import androidx.compose.material3.Icon
|
|
import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.IconButton
|
|
import androidx.compose.material3.IconButton
|
|
|
import androidx.compose.material3.LinearProgressIndicator
|
|
import androidx.compose.material3.LinearProgressIndicator
|
|
|
|
|
+import androidx.compose.material3.MediumFlexibleTopAppBar
|
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.material3.Text
|
|
|
import androidx.compose.material3.TopAppBarDefaults
|
|
import androidx.compose.material3.TopAppBarDefaults
|
|
|
-import androidx.compose.material3.TopAppBar
|
|
|
|
|
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
|
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
|
|
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
|
|
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
|
|
|
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
|
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
|
|
@@ -78,6 +79,7 @@ import androidx.compose.ui.draw.blur
|
|
|
import androidx.compose.ui.graphics.Brush
|
|
import androidx.compose.ui.graphics.Brush
|
|
|
import androidx.compose.ui.graphics.Color
|
|
import androidx.compose.ui.graphics.Color
|
|
|
import androidx.compose.ui.graphics.lerp
|
|
import androidx.compose.ui.graphics.lerp
|
|
|
|
|
+import androidx.compose.ui.graphics.vector.ImageVector
|
|
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|
|
import androidx.compose.ui.layout.ContentScale
|
|
import androidx.compose.ui.layout.ContentScale
|
|
|
import androidx.compose.ui.platform.LocalDensity
|
|
import androidx.compose.ui.platform.LocalDensity
|
|
@@ -89,6 +91,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
import coil.ImageLoader
|
|
import coil.ImageLoader
|
|
|
import coil.compose.AsyncImage
|
|
import coil.compose.AsyncImage
|
|
|
import io.legado.app.R
|
|
import io.legado.app.R
|
|
|
|
|
+import io.legado.app.constant.BookType
|
|
|
import io.legado.app.data.appDb
|
|
import io.legado.app.data.appDb
|
|
|
import io.legado.app.data.entities.Book
|
|
import io.legado.app.data.entities.Book
|
|
|
import io.legado.app.data.entities.BookChapter
|
|
import io.legado.app.data.entities.BookChapter
|
|
@@ -105,11 +108,14 @@ import io.legado.app.ui.book.source.edit.BookSourceEditActivity
|
|
|
import io.legado.app.ui.book.source.manage.BookSourceActivity
|
|
import io.legado.app.ui.book.source.manage.BookSourceActivity
|
|
|
import io.legado.app.ui.config.coverConfig.CoverConfig
|
|
import io.legado.app.ui.config.coverConfig.CoverConfig
|
|
|
import io.legado.app.ui.theme.LegadoTheme
|
|
import io.legado.app.ui.theme.LegadoTheme
|
|
|
|
|
+import io.legado.app.ui.theme.LocalHazeState
|
|
|
import io.legado.app.ui.theme.ProvideThemeOverride
|
|
import io.legado.app.ui.theme.ProvideThemeOverride
|
|
|
import io.legado.app.ui.theme.ThemeResolver
|
|
import io.legado.app.ui.theme.ThemeResolver
|
|
|
import io.legado.app.ui.theme.ThemeOverrideState
|
|
import io.legado.app.ui.theme.ThemeOverrideState
|
|
|
import io.legado.app.ui.theme.rememberImageSeedColor
|
|
import io.legado.app.ui.theme.rememberImageSeedColor
|
|
|
import io.legado.app.ui.theme.rememberThemeOverride
|
|
import io.legado.app.ui.theme.rememberThemeOverride
|
|
|
|
|
+import io.legado.app.ui.theme.responsiveHazeEffect
|
|
|
|
|
+import io.legado.app.ui.theme.responsiveHazeEffectFixedStyle
|
|
|
import io.legado.app.ui.widget.components.AppScaffold
|
|
import io.legado.app.ui.widget.components.AppScaffold
|
|
|
import io.legado.app.ui.widget.components.AppTextField
|
|
import io.legado.app.ui.widget.components.AppTextField
|
|
|
import io.legado.app.ui.widget.components.alert.AppAlertDialog
|
|
import io.legado.app.ui.widget.components.alert.AppAlertDialog
|
|
@@ -123,10 +129,12 @@ import io.legado.app.ui.widget.components.icon.AppIcon
|
|
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
|
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
|
|
|
|
+import io.legado.app.ui.widget.components.cover.buildCoverImageRequest
|
|
|
import io.legado.app.ui.widget.components.text.AnimatedTextLine
|
|
import io.legado.app.ui.widget.components.text.AnimatedTextLine
|
|
|
import io.legado.app.ui.widget.components.text.AppText
|
|
import io.legado.app.ui.widget.components.text.AppText
|
|
|
-import io.legado.app.ui.widget.components.topbar.GlassMediumFlexibleTopAppBar
|
|
|
|
|
|
|
+import io.legado.app.ui.widget.components.topbar.GlassTopAppBarScrollBehavior
|
|
|
import io.legado.app.ui.widget.components.topbar.GlassTopAppBarDefaults
|
|
import io.legado.app.ui.widget.components.topbar.GlassTopAppBarDefaults
|
|
|
|
|
+import io.legado.app.ui.widget.components.topbar.M3GlassScrollBehavior
|
|
|
import io.legado.app.ui.widget.components.topbar.MiuixGlassScrollBehavior
|
|
import io.legado.app.ui.widget.components.topbar.MiuixGlassScrollBehavior
|
|
|
import io.legado.app.utils.StartActivityContract
|
|
import io.legado.app.utils.StartActivityContract
|
|
|
import io.legado.app.utils.startActivity
|
|
import io.legado.app.utils.startActivity
|
|
@@ -134,6 +142,7 @@ import io.legado.app.utils.toastOnUi
|
|
|
import kotlinx.coroutines.delay
|
|
import kotlinx.coroutines.delay
|
|
|
import org.koin.compose.koinInject
|
|
import org.koin.compose.koinInject
|
|
|
import org.koin.androidx.compose.koinViewModel
|
|
import org.koin.androidx.compose.koinViewModel
|
|
|
|
|
+import top.yukonga.miuix.kmp.basic.MiuixScrollBehavior
|
|
|
import top.yukonga.miuix.kmp.basic.TopAppBar as MiuixTopAppBar
|
|
import top.yukonga.miuix.kmp.basic.TopAppBar as MiuixTopAppBar
|
|
|
|
|
|
|
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
@@ -162,32 +171,12 @@ private fun BookInfoScreenContent(
|
|
|
onBack: () -> Unit,
|
|
onBack: () -> Unit,
|
|
|
) {
|
|
) {
|
|
|
val isMiuix = ThemeResolver.isMiuixEngine(LegadoTheme.composeEngine)
|
|
val isMiuix = ThemeResolver.isMiuixEngine(LegadoTheme.composeEngine)
|
|
|
- val miuixScrollBehavior = if (isMiuix) {
|
|
|
|
|
- GlassTopAppBarDefaults.defaultScrollBehavior() as? MiuixGlassScrollBehavior
|
|
|
|
|
|
|
+ val scrollBehavior = if (isMiuix) {
|
|
|
|
|
+ MiuixGlassScrollBehavior(MiuixScrollBehavior())
|
|
|
} else {
|
|
} else {
|
|
|
- null
|
|
|
|
|
|
|
+ M3GlassScrollBehavior(TopAppBarDefaults.exitUntilCollapsedScrollBehavior())
|
|
|
}
|
|
}
|
|
|
- val miuixCollapsedFraction = miuixScrollBehavior?.collapsedFraction ?: 0f
|
|
|
|
|
val listState = rememberLazyListState()
|
|
val listState = rememberLazyListState()
|
|
|
- val colorThresholdPx = with(LocalDensity.current) { 6.dp.roundToPx() }
|
|
|
|
|
- val showAppBarColor by remember(listState, isMiuix, colorThresholdPx, miuixCollapsedFraction) {
|
|
|
|
|
- derivedStateOf {
|
|
|
|
|
- if (isMiuix) {
|
|
|
|
|
- miuixCollapsedFraction > 0.01f
|
|
|
|
|
- } else {
|
|
|
|
|
- listState.firstVisibleItemIndex > 0 ||
|
|
|
|
|
- listState.firstVisibleItemScrollOffset > colorThresholdPx
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- val appBarColor by animateColorAsState(
|
|
|
|
|
- targetValue = if (showAppBarColor) {
|
|
|
|
|
- LegadoTheme.colorScheme.surfaceContainer
|
|
|
|
|
- } else {
|
|
|
|
|
- LegadoTheme.colorScheme.surfaceContainer.copy(alpha = 0f)
|
|
|
|
|
- },
|
|
|
|
|
- label = "book-info-top-bar-color",
|
|
|
|
|
- )
|
|
|
|
|
val pullState = rememberPullToRefreshState()
|
|
val pullState = rememberPullToRefreshState()
|
|
|
var showMenu by rememberSaveable { mutableStateOf(false) }
|
|
var showMenu by rememberSaveable { mutableStateOf(false) }
|
|
|
|
|
|
|
@@ -196,63 +185,16 @@ private fun BookInfoScreenContent(
|
|
|
AppScaffold(
|
|
AppScaffold(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxSize()
|
|
.fillMaxSize()
|
|
|
- .then(
|
|
|
|
|
- if (miuixScrollBehavior != null) {
|
|
|
|
|
- Modifier.nestedScroll(miuixScrollBehavior.nestedScrollConnection)
|
|
|
|
|
- } else {
|
|
|
|
|
- Modifier
|
|
|
|
|
- }
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ .nestedScroll(scrollBehavior.nestedScrollConnection),
|
|
|
topBar = {
|
|
topBar = {
|
|
|
- if (isMiuix) {
|
|
|
|
|
- MiuixTopAppBar(
|
|
|
|
|
- title = "",
|
|
|
|
|
- color = appBarColor,
|
|
|
|
|
- navigationIcon = {
|
|
|
|
|
- TopBarNavigationButton(
|
|
|
|
|
- onClick = { onIntent(BookInfoIntent.BackPressed) }
|
|
|
|
|
- )
|
|
|
|
|
- },
|
|
|
|
|
- actions = {
|
|
|
|
|
- BookInfoTopBarActions(
|
|
|
|
|
- state = state,
|
|
|
|
|
- showMenu = showMenu,
|
|
|
|
|
- onShowMenuChange = { showMenu = it },
|
|
|
|
|
- onMenuAction = { onIntent(BookInfoIntent.MenuAction(it)) },
|
|
|
|
|
- )
|
|
|
|
|
- },
|
|
|
|
|
- scrollBehavior = miuixScrollBehavior?.miuixBehavior
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- TopAppBar(
|
|
|
|
|
- title = {
|
|
|
|
|
- Text(
|
|
|
|
|
- text = "",
|
|
|
|
|
- maxLines = 1,
|
|
|
|
|
- )
|
|
|
|
|
- },
|
|
|
|
|
- navigationIcon = {
|
|
|
|
|
- TopBarNavigationButton(
|
|
|
|
|
- onClick = { onIntent(BookInfoIntent.BackPressed) }
|
|
|
|
|
- )
|
|
|
|
|
- },
|
|
|
|
|
- actions = {
|
|
|
|
|
- BookInfoTopBarActions(
|
|
|
|
|
- state = state,
|
|
|
|
|
- showMenu = showMenu,
|
|
|
|
|
- onShowMenuChange = { showMenu = it },
|
|
|
|
|
- onMenuAction = { onIntent(BookInfoIntent.MenuAction(it)) },
|
|
|
|
|
- )
|
|
|
|
|
- },
|
|
|
|
|
- colors = TopAppBarDefaults.topAppBarColors(
|
|
|
|
|
- containerColor = appBarColor,
|
|
|
|
|
- scrolledContainerColor = appBarColor,
|
|
|
|
|
- navigationIconContentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
- titleContentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
- actionIconContentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
- ),
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BookInfoTransparentTopAppBar(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ showMenu = showMenu,
|
|
|
|
|
+ onShowMenuChange = { showMenu = it },
|
|
|
|
|
+ onMenuAction = { onIntent(BookInfoIntent.MenuAction(it)) },
|
|
|
|
|
+ onBackPressed = { onIntent(BookInfoIntent.BackPressed) },
|
|
|
|
|
+ scrollBehavior = scrollBehavior,
|
|
|
|
|
+ )
|
|
|
},
|
|
},
|
|
|
floatingActionButton = {
|
|
floatingActionButton = {
|
|
|
ExtendedFloatingActionButton(
|
|
ExtendedFloatingActionButton(
|
|
@@ -322,6 +264,7 @@ private fun BookInfoScreenContent(
|
|
|
.padding(bottom = 24.dp)
|
|
.padding(bottom = 24.dp)
|
|
|
) {
|
|
) {
|
|
|
BookInfoActions(
|
|
BookInfoActions(
|
|
|
|
|
+ book = book,
|
|
|
inBookshelf = state.inBookshelf,
|
|
inBookshelf = state.inBookshelf,
|
|
|
onShelfClick = { onIntent(BookInfoIntent.ShelfClick) },
|
|
onShelfClick = { onIntent(BookInfoIntent.ShelfClick) },
|
|
|
onTocClick = { onIntent(BookInfoIntent.TocClick) },
|
|
onTocClick = { onIntent(BookInfoIntent.TocClick) },
|
|
@@ -416,6 +359,70 @@ private fun BookInfoColorTheme(
|
|
|
ProvideThemeOverride(theme = theme, content = content)
|
|
ProvideThemeOverride(theme = theme, content = content)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
|
|
|
|
+@Composable
|
|
|
|
|
+private fun BookInfoTransparentTopAppBar(
|
|
|
|
|
+ state: BookInfoUiState,
|
|
|
|
|
+ showMenu: Boolean,
|
|
|
|
|
+ onShowMenuChange: (Boolean) -> Unit,
|
|
|
|
|
+ onMenuAction: (BookInfoMenuAction) -> Unit,
|
|
|
|
|
+ onBackPressed: () -> Unit,
|
|
|
|
|
+ scrollBehavior: GlassTopAppBarScrollBehavior,
|
|
|
|
|
+) {
|
|
|
|
|
+ val hazeState = LocalHazeState.current
|
|
|
|
|
+ val isMiuix = ThemeResolver.isMiuixEngine(LegadoTheme.composeEngine)
|
|
|
|
|
+ val collapsedColor = if (isMiuix) {
|
|
|
|
|
+ GlassTopAppBarDefaults.getMiuixAppBarColor()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ GlassTopAppBarDefaults.scrolledContainerColor()
|
|
|
|
|
+ }
|
|
|
|
|
+ val isAtTop = scrollBehavior.collapsedFraction <= 0.001f
|
|
|
|
|
+ val resolvedColor = if (isAtTop) Color.Transparent else collapsedColor
|
|
|
|
|
+ val topBarColors = TopAppBarDefaults.topAppBarColors(
|
|
|
|
|
+ containerColor = resolvedColor,
|
|
|
|
|
+ scrolledContainerColor = resolvedColor,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ if (isMiuix) {
|
|
|
|
|
+ MiuixTopAppBar(
|
|
|
|
|
+ modifier = hazeState?.let { Modifier.responsiveHazeEffectFixedStyle(it) } ?: Modifier,
|
|
|
|
|
+ title = "",
|
|
|
|
|
+ subtitle = "",
|
|
|
|
|
+ navigationIcon = {
|
|
|
|
|
+ TopBarNavigationButton(onClick = onBackPressed)
|
|
|
|
|
+ },
|
|
|
|
|
+ actions = {
|
|
|
|
|
+ BookInfoTopBarActions(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ showMenu = showMenu,
|
|
|
|
|
+ onShowMenuChange = onShowMenuChange,
|
|
|
|
|
+ onMenuAction = onMenuAction,
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ color = resolvedColor,
|
|
|
|
|
+ scrollBehavior = (scrollBehavior as? MiuixGlassScrollBehavior)?.miuixBehavior,
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ MediumFlexibleTopAppBar(
|
|
|
|
|
+ modifier = hazeState?.let { Modifier.responsiveHazeEffectFixedStyle(it) } ?: Modifier,
|
|
|
|
|
+ title = { Text(text = "", maxLines = 1) },
|
|
|
|
|
+ navigationIcon = {
|
|
|
|
|
+ TopBarNavigationButton(onClick = onBackPressed)
|
|
|
|
|
+ },
|
|
|
|
|
+ actions = {
|
|
|
|
|
+ BookInfoTopBarActions(
|
|
|
|
|
+ state = state,
|
|
|
|
|
+ showMenu = showMenu,
|
|
|
|
|
+ onShowMenuChange = onShowMenuChange,
|
|
|
|
|
+ onMenuAction = onMenuAction,
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ scrollBehavior = (scrollBehavior as? M3GlassScrollBehavior)?.m3Behavior,
|
|
|
|
|
+ colors = topBarColors,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
@Composable
|
|
@Composable
|
|
|
private fun rememberBookInfoColorTheme(book: Book?): ThemeOverrideState? {
|
|
private fun rememberBookInfoColorTheme(book: Book?): ThemeOverrideState? {
|
|
|
val imageLoader = koinInject<ImageLoader>()
|
|
val imageLoader = koinInject<ImageLoader>()
|
|
@@ -470,6 +477,19 @@ private fun BookInfoTopBarActions(
|
|
|
@Composable
|
|
@Composable
|
|
|
private fun BookInfoBackdrop(book: Book) {
|
|
private fun BookInfoBackdrop(book: Book) {
|
|
|
val cover = book.getDisplayCover()
|
|
val cover = book.getDisplayCover()
|
|
|
|
|
+ val sourceOrigin = book.origin
|
|
|
|
|
+ val loadOnlyWifi = CoverConfig.loadCoverOnlyWifi
|
|
|
|
|
+ val context = LocalContext.current
|
|
|
|
|
+ val imageLoader = koinInject<ImageLoader>()
|
|
|
|
|
+ val backdropRequest = remember(cover, sourceOrigin, loadOnlyWifi, context) {
|
|
|
|
|
+ buildCoverImageRequest(
|
|
|
|
|
+ context = context,
|
|
|
|
|
+ data = cover,
|
|
|
|
|
+ sourceOrigin = sourceOrigin,
|
|
|
|
|
+ loadOnlyWifi = loadOnlyWifi,
|
|
|
|
|
+ crossfade = false,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
val seedOverlay = lerp(
|
|
val seedOverlay = lerp(
|
|
|
LegadoTheme.colorScheme.secondaryContainer,
|
|
LegadoTheme.colorScheme.secondaryContainer,
|
|
|
LegadoTheme.seedColor,
|
|
LegadoTheme.seedColor,
|
|
@@ -478,7 +498,8 @@ private fun BookInfoBackdrop(book: Book) {
|
|
|
Box(modifier = Modifier.fillMaxSize()) {
|
|
Box(modifier = Modifier.fillMaxSize()) {
|
|
|
if (!cover.isNullOrBlank()) {
|
|
if (!cover.isNullOrBlank()) {
|
|
|
AsyncImage(
|
|
AsyncImage(
|
|
|
- model = cover,
|
|
|
|
|
|
|
+ model = backdropRequest,
|
|
|
|
|
+ imageLoader = imageLoader,
|
|
|
contentDescription = null,
|
|
contentDescription = null,
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxSize()
|
|
.fillMaxSize()
|
|
@@ -567,22 +588,24 @@ private fun BookInfoOverflowMenu(
|
|
|
text = stringResource(R.string.to_top),
|
|
text = stringResource(R.string.to_top),
|
|
|
onClick = { onMenuAction(BookInfoMenuAction.Top) }
|
|
onClick = { onMenuAction(BookInfoMenuAction.Top) }
|
|
|
)
|
|
)
|
|
|
- RoundDropdownMenuItem(
|
|
|
|
|
- text = stringResource(R.string.allow_update),
|
|
|
|
|
- onClick = { onMenuAction(BookInfoMenuAction.ToggleCanUpdate) },
|
|
|
|
|
- trailingIcon = { if (book?.canUpdate == true) Icon(Icons.Default.Star, null) }
|
|
|
|
|
- )
|
|
|
|
|
- if (book?.isLocal == true && book.type and io.legado.app.constant.BookType.text > 0) {
|
|
|
|
|
|
|
+ if (book?.isLocal == false ){
|
|
|
|
|
+ RoundDropdownMenuItem(
|
|
|
|
|
+ text = stringResource(R.string.allow_update),
|
|
|
|
|
+ onClick = { onMenuAction(BookInfoMenuAction.ToggleCanUpdate) },
|
|
|
|
|
+ isSelected = book.canUpdate
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ if (book?.isLocal == true && book.type and BookType.text > 0) {
|
|
|
RoundDropdownMenuItem(
|
|
RoundDropdownMenuItem(
|
|
|
text = stringResource(R.string.split_long_chapter),
|
|
text = stringResource(R.string.split_long_chapter),
|
|
|
onClick = { onMenuAction(BookInfoMenuAction.ToggleSplitLongChapter) },
|
|
onClick = { onMenuAction(BookInfoMenuAction.ToggleSplitLongChapter) },
|
|
|
- trailingIcon = { if (book.getSplitLongChapter()) Icon(Icons.Default.Star, null) }
|
|
|
|
|
|
|
+ isSelected = book.getSplitLongChapter()
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
RoundDropdownMenuItem(
|
|
RoundDropdownMenuItem(
|
|
|
text = stringResource(R.string.delete_alert),
|
|
text = stringResource(R.string.delete_alert),
|
|
|
onClick = { onMenuAction(BookInfoMenuAction.ToggleDeleteAlert) },
|
|
onClick = { onMenuAction(BookInfoMenuAction.ToggleDeleteAlert) },
|
|
|
- trailingIcon = { if (io.legado.app.help.config.LocalConfig.bookInfoDeleteAlert) Icon(Icons.Default.Star, null) }
|
|
|
|
|
|
|
+ isSelected = io.legado.app.help.config.LocalConfig.bookInfoDeleteAlert
|
|
|
)
|
|
)
|
|
|
RoundDropdownMenuItem(
|
|
RoundDropdownMenuItem(
|
|
|
text = stringResource(R.string.clear_cache),
|
|
text = stringResource(R.string.clear_cache),
|
|
@@ -606,11 +629,6 @@ private fun BookInfoHeader(
|
|
|
onBookNameClick: (Boolean) -> Unit,
|
|
onBookNameClick: (Boolean) -> Unit,
|
|
|
onOriginClick: () -> Unit,
|
|
onOriginClick: () -> Unit,
|
|
|
) {
|
|
) {
|
|
|
- val labelBackground = lerp(
|
|
|
|
|
- LegadoTheme.colorScheme.surface,
|
|
|
|
|
- LegadoTheme.seedColor,
|
|
|
|
|
- 0.1f
|
|
|
|
|
- ).copy(alpha = 0.82f)
|
|
|
|
|
Column(
|
|
Column(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
@@ -688,6 +706,16 @@ private fun BookInfoHeader(
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
|
) {
|
|
) {
|
|
|
|
|
+ groupNames?.takeIf { it.isNotBlank() }?.let {
|
|
|
|
|
+ item(key = "group-$it") {
|
|
|
|
|
+ TextCard(
|
|
|
|
|
+ text = stringResource(R.string.group_s, it),
|
|
|
|
|
+ textStyle = LegadoTheme.typography.labelLargeEmphasized,
|
|
|
|
|
+ backgroundColor = LegadoTheme.colorScheme.surfaceContainer,
|
|
|
|
|
+ contentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
itemsIndexed(
|
|
itemsIndexed(
|
|
|
items = kindLabels,
|
|
items = kindLabels,
|
|
|
key = { index, label -> "kind-$index-$label" }
|
|
key = { index, label -> "kind-$index-$label" }
|
|
@@ -695,20 +723,10 @@ private fun BookInfoHeader(
|
|
|
TextCard(
|
|
TextCard(
|
|
|
text = label,
|
|
text = label,
|
|
|
textStyle = LegadoTheme.typography.labelLargeEmphasized,
|
|
textStyle = LegadoTheme.typography.labelLargeEmphasized,
|
|
|
- backgroundColor = labelBackground,
|
|
|
|
|
|
|
+ backgroundColor = LegadoTheme.colorScheme.surfaceContainer,
|
|
|
contentColor = LegadoTheme.colorScheme.onSurface,
|
|
contentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- groupNames?.takeIf { it.isNotBlank() }?.let {
|
|
|
|
|
- item(key = "group-$it") {
|
|
|
|
|
- TextCard(
|
|
|
|
|
- text = stringResource(R.string.group_s, it),
|
|
|
|
|
- textStyle = LegadoTheme.typography.labelLargeEmphasized,
|
|
|
|
|
- backgroundColor = labelBackground,
|
|
|
|
|
- contentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -717,6 +735,7 @@ private fun BookInfoHeader(
|
|
|
|
|
|
|
|
@Composable
|
|
@Composable
|
|
|
private fun BookInfoActions(
|
|
private fun BookInfoActions(
|
|
|
|
|
+ book: Book,
|
|
|
inBookshelf: Boolean,
|
|
inBookshelf: Boolean,
|
|
|
onShelfClick: () -> Unit,
|
|
onShelfClick: () -> Unit,
|
|
|
onTocClick: () -> Unit,
|
|
onTocClick: () -> Unit,
|
|
@@ -747,7 +766,7 @@ private fun BookInfoActions(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
|
.background(LegadoTheme.colorScheme.surface)
|
|
.background(LegadoTheme.colorScheme.surface)
|
|
|
- .padding(horizontal = 16.dp, vertical = 4.dp),
|
|
|
|
|
|
|
+ .padding(horizontal = 16.dp, vertical = 8.dp),
|
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
|
) {
|
|
) {
|
|
|
BookInfoActionCard(
|
|
BookInfoActionCard(
|
|
@@ -772,7 +791,7 @@ private fun BookInfoActions(
|
|
|
)
|
|
)
|
|
|
BookInfoActionCard(
|
|
BookInfoActionCard(
|
|
|
modifier = Modifier.weight(1f),
|
|
modifier = Modifier.weight(1f),
|
|
|
- icon = Icons.Default.Bookmark,
|
|
|
|
|
|
|
+ icon = if (book.group > 0) Icons.Default.Bookmark else Icons.Outlined.Bookmark,
|
|
|
label = stringResource(R.string.change_group),
|
|
label = stringResource(R.string.change_group),
|
|
|
onClick = onGroupClick
|
|
onClick = onGroupClick
|
|
|
)
|
|
)
|
|
@@ -788,14 +807,14 @@ private fun BookInfoActions(
|
|
|
@Composable
|
|
@Composable
|
|
|
private fun BookInfoActionCard(
|
|
private fun BookInfoActionCard(
|
|
|
modifier: Modifier = Modifier,
|
|
modifier: Modifier = Modifier,
|
|
|
- icon: androidx.compose.ui.graphics.vector.ImageVector,
|
|
|
|
|
|
|
+ icon: ImageVector,
|
|
|
label: String,
|
|
label: String,
|
|
|
onClick: () -> Unit
|
|
onClick: () -> Unit
|
|
|
) {
|
|
) {
|
|
|
GlassCard(
|
|
GlassCard(
|
|
|
modifier = modifier,
|
|
modifier = modifier,
|
|
|
onClick = onClick,
|
|
onClick = onClick,
|
|
|
- containerColor = LegadoTheme.colorScheme.surfaceContainer.copy(alpha = 0.5f),
|
|
|
|
|
|
|
+ containerColor = LegadoTheme.colorScheme.surfaceContainerLow.copy(alpha = 0.2f),
|
|
|
contentColor = LegadoTheme.colorScheme.onSurface,
|
|
contentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
) {
|
|
) {
|
|
|
Column(
|
|
Column(
|