mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +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) {
|
if (ref != null) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = remember(ref) { imageRequest(context, ref, crossfade = thumbnailRef != null) },
|
model = remember(ref, thumbnailRef) { imageRequest(context, ref, crossfade = thumbnailRef != null) },
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
|||||||
@@ -18,15 +18,12 @@ fun rememberViewportFill(state: LazyListState): Dp {
|
|||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
val info = state.layoutInfo
|
val info = state.layoutInfo
|
||||||
val realCount = info.totalItemsCount - 1
|
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
|
FILL_EPSILON_PX
|
||||||
} else {
|
} else {
|
||||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
val contentBottom = visibleReal.maxOf { it.offset + it.size }
|
||||||
if (visibleReal.size < realCount) {
|
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||||
FILL_EPSILON_PX
|
|
||||||
} else {
|
|
||||||
(info.viewportSize.height - visibleReal.sumOf { it.size }).coerceAtLeast(0) + FILL_EPSILON_PX
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,15 +37,12 @@ fun rememberViewportFill(state: LazyGridState): Dp {
|
|||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
val info = state.layoutInfo
|
val info = state.layoutInfo
|
||||||
val realCount = info.totalItemsCount - 1
|
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
|
FILL_EPSILON_PX
|
||||||
} else {
|
} else {
|
||||||
val visibleReal = info.visibleItemsInfo.filter { it.index < realCount }
|
val contentBottom = visibleReal.maxOf { it.offset.y + it.size.height }
|
||||||
if (visibleReal.size < realCount) {
|
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||||
FILL_EPSILON_PX
|
|
||||||
} else {
|
|
||||||
(info.viewportSize.height - visibleReal.sumOf { it.size.height }).coerceAtLeast(0) + FILL_EPSILON_PX
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user