修复封面换源界面问题
This commit is contained in:
@@ -2,20 +2,24 @@ package io.legado.app.ui.book.info
|
||||
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
import androidx.compose.foundation.lazy.grid.items
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
@@ -45,6 +49,8 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -218,9 +224,10 @@ fun ChangeCoverSheet(
|
||||
onDismissRequest = onDismissRequest,
|
||||
title = stringResource(R.string.change_cover_source),
|
||||
endAction = {
|
||||
IconButton(onClick = { viewModel.startOrStopSearch() }) {
|
||||
Icon(if (isSearching) Icons.Default.MoreVert else Icons.Default.Refresh, null)
|
||||
}
|
||||
MediumIconButton(
|
||||
onClick = { viewModel.startOrStopSearch() },
|
||||
imageVector = if (isSearching) Icons.Default.MoreVert else Icons.Default.Refresh
|
||||
)
|
||||
}
|
||||
) {
|
||||
if (isSearching) {
|
||||
@@ -229,11 +236,30 @@ fun ChangeCoverSheet(
|
||||
}
|
||||
LazyVerticalGrid(columns = GridCells.Fixed(3), horizontalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
items(items, key = { it.bookUrl + it.originName }) { item ->
|
||||
GlassCard(onClick = { onSelect(item.coverUrl.orEmpty()) }) {
|
||||
Column(modifier = Modifier.fillMaxWidth().padding(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CoilBookCover(name = item.name, author = item.author, path = item.coverUrl, sourceOrigin = item.origin, modifier = Modifier.fillMaxWidth())
|
||||
AppText(text = item.originName, style = LegadoTheme.typography.bodySmall, maxLines = 2)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.clickable {
|
||||
onSelect(item.coverUrl.orEmpty())
|
||||
}
|
||||
.padding(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||
) {
|
||||
CoilBookCover(
|
||||
name = item.name,
|
||||
author = item.author,
|
||||
path = item.coverUrl,
|
||||
sourceOrigin = item.origin,
|
||||
modifier = Modifier
|
||||
.width(112.dp)
|
||||
.aspectRatio(5f / 7f),
|
||||
)
|
||||
AppText(
|
||||
text = item.originName,
|
||||
style = LegadoTheme.typography.labelSmallEmphasized,
|
||||
maxLines = 2
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user