Restore ListMode fav icon behaviour
This commit is contained in:
1 parent
bb6ed820a7
commit
b924cc5341
2 files changed
+45
-54
No files matched your search
@@ -56,6 +56,7 @@ class ListGalleryHolder(
|
||||
onLongClick = onLongClick,
|
||||
info = galleryInfo,
|
||||
modifier = Modifier.height(height),
|
||||
isInFavScene = !showFavourited,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.compose.material.icons.filled.Favorite
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -27,7 +28,6 @@ import androidx.compose.ui.unit.dp
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo
|
||||
import com.hippo.ehviewer.download.DownloadManager
|
||||
import java.util.Locale
|
||||
|
||||
@Composable
|
||||
fun ListInfoCard(
|
||||
@@ -35,16 +35,14 @@ fun ListInfoCard(
|
||||
onLongClick: () -> Unit,
|
||||
info: GalleryInfo,
|
||||
modifier: Modifier = Modifier,
|
||||
isInFavScene: Boolean = false,
|
||||
) {
|
||||
CrystalCard(
|
||||
modifier = Modifier.padding(6.dp),
|
||||
) {
|
||||
CrystalCard(modifier = Modifier.padding(6.dp)) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.combinedClickable(
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
),
|
||||
modifier = modifier.combinedClickable(
|
||||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
),
|
||||
) {
|
||||
Card {
|
||||
EhAsyncThumb(
|
||||
@@ -53,7 +51,7 @@ fun ListInfoCard(
|
||||
modifier = modifier.aspectRatio(0.6666667F),
|
||||
)
|
||||
}
|
||||
Column(Modifier.padding(8.dp, 4.dp)) {
|
||||
Column(modifier = Modifier.padding(8.dp, 4.dp)) {
|
||||
Text(
|
||||
text = EhUtils.getSuitableTitle(info),
|
||||
maxLines = 2,
|
||||
@@ -62,53 +60,45 @@ fun ListInfoCard(
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
Column {
|
||||
Text(
|
||||
text = info.uploader ?: "(DISOWNED)",
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
GalleryListCardRating(rating = info.rating)
|
||||
val categoryColor = EhUtils.getCategoryColor(info.category)
|
||||
val categoryText = EhUtils.getCategory(info.category).uppercase(Locale.ROOT)
|
||||
Text(
|
||||
text = categoryText,
|
||||
modifier = Modifier
|
||||
.background(Color(categoryColor))
|
||||
.padding(vertical = 2.dp, horizontal = 8.dp),
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
if (DownloadManager.containDownloadInfo(info.gid)) {
|
||||
Icon(
|
||||
Icons.Default.Download,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp),
|
||||
)
|
||||
}
|
||||
if (info.favoriteSlot != -2) {
|
||||
Icon(
|
||||
Icons.Default.Favorite,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp),
|
||||
)
|
||||
}
|
||||
ProvideTextStyle(MaterialTheme.typography.labelLarge) {
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
Column {
|
||||
Text(
|
||||
text = info.simpleLanguage.orEmpty(),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
text = info.uploader ?: "(DISOWNED)",
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
GalleryListCardRating(rating = info.rating)
|
||||
val categoryColor = EhUtils.getCategoryColor(info.category)
|
||||
val categoryText = EhUtils.getCategory(info.category).uppercase()
|
||||
Text(
|
||||
text = categoryText,
|
||||
modifier = Modifier.background(Color(categoryColor)).padding(vertical = 2.dp, horizontal = 8.dp),
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = info.posted.orEmpty(),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
if (DownloadManager.containDownloadInfo(info.gid)) {
|
||||
Icon(
|
||||
Icons.Default.Download,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp),
|
||||
)
|
||||
}
|
||||
if (info.favoriteSlot != -2 && !isInFavScene) {
|
||||
Icon(
|
||||
Icons.Default.Favorite,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp),
|
||||
)
|
||||
}
|
||||
Text(text = info.simpleLanguage.orEmpty())
|
||||
}
|
||||
Text(text = info.posted.orEmpty())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user