mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
fix viewport fill padding and key cover art requests on both refs
This commit is contained in:
@@ -46,7 +46,7 @@ fun CoverArt(
|
||||
}
|
||||
if (ref != null) {
|
||||
AsyncImage(
|
||||
model = remember(ref) { imageRequest(context, ref, crossfade = thumbnailRef != null) },
|
||||
model = remember(ref, thumbnailRef) { imageRequest(context, ref, crossfade = thumbnailRef != null) },
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
||||
@@ -18,15 +18,12 @@ fun rememberViewportFill(state: LazyListState): Dp {
|
||||
derivedStateOf {
|
||||
val info = state.layoutInfo
|
||||
val realCount = info.totalItemsCount - 1
|
||||
if (realCount <= 0) {
|
||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
||||
if (realCount <= 0 || visibleReal.size < realCount) {
|
||||
FILL_EPSILON_PX
|
||||
} else {
|
||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
||||
if (visibleReal.size < realCount) {
|
||||
FILL_EPSILON_PX
|
||||
} else {
|
||||
(info.viewportSize.height - visibleReal.sumOf { it.size }).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||
}
|
||||
val contentBottom = visibleReal.maxOf { it.offset + it.size }
|
||||
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,15 +37,12 @@ fun rememberViewportFill(state: LazyGridState): Dp {
|
||||
derivedStateOf {
|
||||
val info = state.layoutInfo
|
||||
val realCount = info.totalItemsCount - 1
|
||||
if (realCount <= 0) {
|
||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
||||
if (realCount <= 0 || visibleReal.size < realCount) {
|
||||
FILL_EPSILON_PX
|
||||
} else {
|
||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
||||
if (visibleReal.size < realCount) {
|
||||
FILL_EPSILON_PX
|
||||
} else {
|
||||
(info.viewportSize.height - visibleReal.sumOf { it.size.height }).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||
}
|
||||
val contentBottom = visibleReal.maxOf { it.offset.y + it.size.height }
|
||||
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user