Clean up chapter item composables a bit
Might help with #9043? (cherry picked from commit bff98ca76830accfe462d011d42040ae6c1876e8)
This commit is contained in:
parent
ce273e3199
commit
b75a8fc146
@ -55,6 +55,9 @@ fun MangaChapterListItem(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onDownloadClick: ((ChapterDownloadAction) -> Unit)?,
|
onDownloadClick: ((ChapterDownloadAction) -> Unit)?,
|
||||||
) {
|
) {
|
||||||
|
val textAlpha = if (read) ReadItemAlpha else 1f
|
||||||
|
val textSubtitleAlpha = if (read) ReadItemAlpha else SecondaryItemAlpha
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.selectedBackground(selected)
|
.selectedBackground(selected)
|
||||||
@ -65,9 +68,6 @@ fun MangaChapterListItem(
|
|||||||
.padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp),
|
.padding(start = 16.dp, top = 12.dp, end = 8.dp, bottom = 12.dp),
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
val textAlpha = remember(read) { if (read) ReadItemAlpha else 1f }
|
|
||||||
val textSubtitleAlpha = remember(read) { if (read) ReadItemAlpha else SecondaryItemAlpha }
|
|
||||||
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
var textHeight by remember { mutableStateOf(0) }
|
var textHeight by remember { mutableStateOf(0) }
|
||||||
if (bookmark) {
|
if (bookmark) {
|
||||||
@ -89,7 +89,9 @@ fun MangaChapterListItem(
|
|||||||
modifier = Modifier.alpha(textAlpha),
|
modifier = Modifier.alpha(textAlpha),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(6.dp))
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
|
|
||||||
Row(modifier = Modifier.alpha(textSubtitleAlpha)) {
|
Row(modifier = Modifier.alpha(textSubtitleAlpha)) {
|
||||||
ProvideTextStyle(
|
ProvideTextStyle(
|
||||||
value = MaterialTheme.typography.bodyMedium.copy(fontSize = 12.sp),
|
value = MaterialTheme.typography.bodyMedium.copy(fontSize = 12.sp),
|
||||||
@ -132,7 +134,6 @@ fun MangaChapterListItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download view
|
|
||||||
if (onDownloadClick != null) {
|
if (onDownloadClick != null) {
|
||||||
ChapterDownloadIndicator(
|
ChapterDownloadIndicator(
|
||||||
enabled = downloadIndicatorEnabled,
|
enabled = downloadIndicatorEnabled,
|
||||||
|
@ -161,6 +161,8 @@ fun UpdatesUiItem(
|
|||||||
downloadProgressProvider: () -> Int,
|
downloadProgressProvider: () -> Int,
|
||||||
) {
|
) {
|
||||||
val haptic = LocalHapticFeedback.current
|
val haptic = LocalHapticFeedback.current
|
||||||
|
val textAlpha = if (update.read) ReadItemAlpha else 1f
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.selectedBackground(selected)
|
.selectedBackground(selected)
|
||||||
@ -182,15 +184,12 @@ fun UpdatesUiItem(
|
|||||||
data = update.coverData,
|
data = update.coverData,
|
||||||
onClick = onClickCover,
|
onClick = onClickCover,
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = MaterialTheme.padding.medium)
|
.padding(horizontal = MaterialTheme.padding.medium)
|
||||||
.weight(1f),
|
.weight(1f),
|
||||||
) {
|
) {
|
||||||
val bookmark = remember(update.bookmark) { update.bookmark }
|
|
||||||
val read = remember(update.read) { update.read }
|
|
||||||
val textAlpha = remember(read) { if (read) ReadItemAlpha else 1f }
|
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = update.mangaTitle,
|
text = update.mangaTitle,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@ -198,9 +197,10 @@ fun UpdatesUiItem(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.alpha(textAlpha),
|
modifier = Modifier.alpha(textAlpha),
|
||||||
)
|
)
|
||||||
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
var textHeight by remember { mutableStateOf(0) }
|
var textHeight by remember { mutableStateOf(0) }
|
||||||
if (bookmark) {
|
if (update.bookmark) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Bookmark,
|
imageVector = Icons.Filled.Bookmark,
|
||||||
contentDescription = stringResource(R.string.action_filter_bookmarked),
|
contentDescription = stringResource(R.string.action_filter_bookmarked),
|
||||||
@ -231,6 +231,7 @@ fun UpdatesUiItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChapterDownloadIndicator(
|
ChapterDownloadIndicator(
|
||||||
enabled = onDownloadChapter != null,
|
enabled = onDownloadChapter != null,
|
||||||
modifier = Modifier.padding(start = 4.dp),
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user