|
@@ -25,6 +25,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.lazy.items
|
|
import androidx.compose.foundation.lazy.items
|
|
|
import androidx.compose.foundation.lazy.itemsIndexed
|
|
import androidx.compose.foundation.lazy.itemsIndexed
|
|
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
|
|
|
+import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.material.icons.Icons
|
|
import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.filled.Add
|
|
import androidx.compose.material.icons.filled.Add
|
|
|
import androidx.compose.material.icons.filled.Bookmarks
|
|
import androidx.compose.material.icons.filled.Bookmarks
|
|
@@ -41,6 +42,7 @@ import androidx.compose.material.icons.filled.Stop
|
|
|
import androidx.compose.material.icons.filled.Upload
|
|
import androidx.compose.material.icons.filled.Upload
|
|
|
import androidx.compose.material3.Checkbox
|
|
import androidx.compose.material3.Checkbox
|
|
|
import androidx.compose.material3.RadioButton
|
|
import androidx.compose.material3.RadioButton
|
|
|
|
|
+import androidx.compose.material3.VerticalDivider
|
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.getValue
|
|
@@ -52,6 +54,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|
|
import androidx.compose.runtime.setValue
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.Modifier
|
|
|
|
|
+import androidx.compose.ui.draw.clip
|
|
|
import androidx.compose.ui.focus.FocusRequester
|
|
import androidx.compose.ui.focus.FocusRequester
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.res.stringResource
|
|
import androidx.compose.ui.res.stringResource
|
|
@@ -78,13 +81,12 @@ import io.legado.app.ui.theme.LegadoTheme
|
|
|
import io.legado.app.ui.theme.LegadoTheme.composeEngine
|
|
import io.legado.app.ui.theme.LegadoTheme.composeEngine
|
|
|
import io.legado.app.ui.theme.ThemeResolver
|
|
import io.legado.app.ui.theme.ThemeResolver
|
|
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
|
|
-import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
|
|
|
|
import io.legado.app.ui.widget.components.AppFloatingActionButtonMenu
|
|
import io.legado.app.ui.widget.components.AppFloatingActionButtonMenu
|
|
|
import io.legado.app.ui.widget.components.AppTextField
|
|
import io.legado.app.ui.widget.components.AppTextField
|
|
|
import io.legado.app.ui.widget.components.FabMenuItem
|
|
import io.legado.app.ui.widget.components.FabMenuItem
|
|
|
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.button.series.SmallTonalButton
|
|
|
|
|
import io.legado.app.ui.widget.components.button.series.MediumTonalButton
|
|
import io.legado.app.ui.widget.components.button.series.MediumTonalButton
|
|
|
|
|
+import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
|
|
import io.legado.app.ui.widget.components.card.GlassCard
|
|
import io.legado.app.ui.widget.components.card.GlassCard
|
|
|
import io.legado.app.ui.widget.components.card.ReorderableSelectionItem
|
|
import io.legado.app.ui.widget.components.card.ReorderableSelectionItem
|
|
|
import io.legado.app.ui.widget.components.card.SelectionItemCard
|
|
import io.legado.app.ui.widget.components.card.SelectionItemCard
|
|
@@ -99,10 +101,10 @@ import io.legado.app.ui.widget.components.log.AppLogSheet
|
|
|
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.reorderAccessibility
|
|
|
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.OptionCard
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.OptionCard
|
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.OptionSheet
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.OptionSheet
|
|
|
import io.legado.app.ui.widget.components.progressIndicator.AppCircularProgressIndicator
|
|
import io.legado.app.ui.widget.components.progressIndicator.AppCircularProgressIndicator
|
|
|
|
|
+import io.legado.app.ui.widget.components.reorderAccessibility
|
|
|
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.TopBarActionButton
|
|
import io.legado.app.ui.widget.components.topbar.TopBarActionButton
|
|
|
import io.legado.app.utils.ACache
|
|
import io.legado.app.utils.ACache
|
|
@@ -712,11 +714,13 @@ private fun BookshelfManageScreen(
|
|
|
Column(
|
|
Column(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
|
- .adaptiveHorizontalPadding(vertical = 12.dp),
|
|
|
|
|
|
|
+ .padding(vertical = 12.dp, horizontal = 4.dp),
|
|
|
verticalArrangement = Arrangement.SpaceBetween
|
|
verticalArrangement = Arrangement.SpaceBetween
|
|
|
) {
|
|
) {
|
|
|
Row(
|
|
Row(
|
|
|
- modifier = Modifier.fillMaxWidth(),
|
|
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
|
+ .padding(horizontal = 4.dp),
|
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
|
|
) {
|
|
) {
|
|
|
Column(
|
|
Column(
|
|
@@ -725,14 +729,27 @@ private fun BookshelfManageScreen(
|
|
|
) {
|
|
) {
|
|
|
AppText(
|
|
AppText(
|
|
|
text = book.name,
|
|
text = book.name,
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .clip(RoundedCornerShape(4.dp))
|
|
|
|
|
+ .clickable {
|
|
|
|
|
+ viewModel.dispatch(
|
|
|
|
|
+ BookshelfManageScreenIntent.OpenBookInfoPreview(
|
|
|
|
|
+ book,
|
|
|
|
|
+ true
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ .padding(horizontal = 4.dp),
|
|
|
style = LegadoTheme.typography.titleSmallEmphasized,
|
|
style = LegadoTheme.typography.titleSmallEmphasized,
|
|
|
maxLines = 1
|
|
maxLines = 1
|
|
|
)
|
|
)
|
|
|
AppText(
|
|
AppText(
|
|
|
|
|
+ modifier = Modifier.padding(horizontal = 4.dp),
|
|
|
text = book.getRealAuthor(),
|
|
text = book.getRealAuthor(),
|
|
|
style = LegadoTheme.typography.bodySmall
|
|
style = LegadoTheme.typography.bodySmall
|
|
|
)
|
|
)
|
|
|
AppText(
|
|
AppText(
|
|
|
|
|
+ modifier = Modifier.padding(horizontal = 4.dp),
|
|
|
text = "${groupNameResolver(book)} | ${book.originName.ifBlank { book.origin }}",
|
|
text = "${groupNameResolver(book)} | ${book.originName.ifBlank { book.origin }}",
|
|
|
style = LegadoTheme.typography.labelSmallEmphasized.copy(color = LegadoTheme.colorScheme.primary)
|
|
style = LegadoTheme.typography.labelSmallEmphasized.copy(color = LegadoTheme.colorScheme.primary)
|
|
|
)
|
|
)
|
|
@@ -752,27 +769,69 @@ private fun BookshelfManageScreen(
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- Row(
|
|
|
|
|
|
|
+ Column(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
|
- .padding(top = 4.dp),
|
|
|
|
|
- horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
|
|
|
- verticalAlignment = Alignment.CenterVertically
|
|
|
|
|
|
|
+ .padding(top = 12.dp),
|
|
|
|
|
+ verticalArrangement = Arrangement.spacedBy(4.dp)
|
|
|
) {
|
|
) {
|
|
|
- if (downloadFailureText != null) {
|
|
|
|
|
- AppText(
|
|
|
|
|
- text = downloadFailureText,
|
|
|
|
|
- modifier = Modifier.weight(1f),
|
|
|
|
|
- style = LegadoTheme.typography.labelSmall,
|
|
|
|
|
- color = LegadoTheme.colorScheme.error,
|
|
|
|
|
- maxLines = 1
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- Spacer(modifier = Modifier.weight(1f))
|
|
|
|
|
- }
|
|
|
|
|
Row(
|
|
Row(
|
|
|
- horizontalArrangement = Arrangement.spacedBy(6.dp)
|
|
|
|
|
|
|
+ modifier = Modifier.fillMaxWidth(),
|
|
|
|
|
+ verticalAlignment = Alignment.CenterVertically
|
|
|
) {
|
|
) {
|
|
|
|
|
+ SmallTonalButton(
|
|
|
|
|
+ onClick = {
|
|
|
|
|
+ if (!book.isLocal) {
|
|
|
|
|
+ viewModel.dispatch(BookshelfManageScreenIntent.ToggleBookDownload(book))
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ modifier = Modifier.weight(1f),
|
|
|
|
|
+ icon = if (isDownloading) Icons.Default.Stop else Icons.Default.Download,
|
|
|
|
|
+ text = if (isDownloading) "停止" else "下载",
|
|
|
|
|
+ contentColor = LegadoTheme.colorScheme.onSurfaceVariant.copy(
|
|
|
|
|
+ alpha = 0.8f
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ VerticalDivider(
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .height(16.dp)
|
|
|
|
|
+ .padding(horizontal = 4.dp),
|
|
|
|
|
+ color = LegadoTheme.colorScheme.outlineVariant
|
|
|
|
|
+ )
|
|
|
|
|
+ SmallTonalButton(
|
|
|
|
|
+ onClick = { exportBook(book) },
|
|
|
|
|
+ modifier = Modifier.weight(1f),
|
|
|
|
|
+ icon = Icons.Default.Upload,
|
|
|
|
|
+ text = "导出",
|
|
|
|
|
+ contentColor = LegadoTheme.colorScheme.onSurfaceVariant.copy(
|
|
|
|
|
+ alpha = 0.8f
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ VerticalDivider(
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .height(16.dp)
|
|
|
|
|
+ .padding(horizontal = 4.dp),
|
|
|
|
|
+ color = LegadoTheme.colorScheme.outlineVariant
|
|
|
|
|
+ )
|
|
|
|
|
+ SmallTonalButton(
|
|
|
|
|
+ onClick = {
|
|
|
|
|
+ pendingMoveGroupBookUrl = book.bookUrl
|
|
|
|
|
+ groupPickerCurrentGroupId = book.group.coerceAtLeast(0L)
|
|
|
|
|
+ showGroupSelectSheet = true
|
|
|
|
|
+ },
|
|
|
|
|
+ modifier = Modifier.weight(1f),
|
|
|
|
|
+ icon = Icons.Default.Bookmarks,
|
|
|
|
|
+ text = "分组",
|
|
|
|
|
+ contentColor = LegadoTheme.colorScheme.onSurfaceVariant.copy(
|
|
|
|
|
+ alpha = 0.8f
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ VerticalDivider(
|
|
|
|
|
+ modifier = Modifier
|
|
|
|
|
+ .height(16.dp)
|
|
|
|
|
+ .padding(horizontal = 4.dp),
|
|
|
|
|
+ color = LegadoTheme.colorScheme.outlineVariant
|
|
|
|
|
+ )
|
|
|
RoundDropdownMenu(
|
|
RoundDropdownMenu(
|
|
|
expanded = moreMenuBookUrl == book.bookUrl,
|
|
expanded = moreMenuBookUrl == book.bookUrl,
|
|
|
onDismissRequest = { moreMenuBookUrl = null }
|
|
onDismissRequest = { moreMenuBookUrl = null }
|
|
@@ -805,33 +864,22 @@ private fun BookshelfManageScreen(
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- SmallTonalButton(
|
|
|
|
|
- onClick = {
|
|
|
|
|
- if (!book.isLocal) {
|
|
|
|
|
- viewModel.dispatch(BookshelfManageScreenIntent.ToggleBookDownload(book))
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- icon = if (isDownloading) Icons.Default.Stop else Icons.Default.Download,
|
|
|
|
|
- contentDescription = stringResource(R.string.action_download)
|
|
|
|
|
- )
|
|
|
|
|
- SmallTonalButton(
|
|
|
|
|
- onClick = { exportBook(book) },
|
|
|
|
|
- icon = Icons.Default.Upload,
|
|
|
|
|
- contentDescription = stringResource(R.string.upload_to_remote)
|
|
|
|
|
- )
|
|
|
|
|
- SmallTonalButton(
|
|
|
|
|
- onClick = {
|
|
|
|
|
- pendingMoveGroupBookUrl = book.bookUrl
|
|
|
|
|
- groupPickerCurrentGroupId = book.group.coerceAtLeast(0L)
|
|
|
|
|
- showGroupSelectSheet = true
|
|
|
|
|
- },
|
|
|
|
|
- icon = Icons.Default.Bookmarks,
|
|
|
|
|
- contentDescription = stringResource(R.string.group)
|
|
|
|
|
- )
|
|
|
|
|
SmallTonalButton(
|
|
SmallTonalButton(
|
|
|
onClick = { moreMenuBookUrl = book.bookUrl },
|
|
onClick = { moreMenuBookUrl = book.bookUrl },
|
|
|
|
|
+ modifier = Modifier.weight(1f),
|
|
|
icon = Icons.Default.MoreVert,
|
|
icon = Icons.Default.MoreVert,
|
|
|
- contentDescription = stringResource(R.string.more_menu)
|
|
|
|
|
|
|
+ text = "更多",
|
|
|
|
|
+ contentColor = LegadoTheme.colorScheme.onSurfaceVariant.copy(
|
|
|
|
|
+ alpha = 0.8f
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ if (downloadFailureText != null) {
|
|
|
|
|
+ AppText(
|
|
|
|
|
+ text = downloadFailureText,
|
|
|
|
|
+ style = LegadoTheme.typography.labelSmall,
|
|
|
|
|
+ color = LegadoTheme.colorScheme.error,
|
|
|
|
|
+ maxLines = 1
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|