mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
fix seed job leak and viewport fill top padding
This commit is contained in:
@@ -23,7 +23,8 @@ fun rememberViewportFill(state: LazyListState): Dp {
|
|||||||
FILL_EPSILON_PX
|
FILL_EPSILON_PX
|
||||||
} else {
|
} else {
|
||||||
val contentBottom = visibleReal.maxOf { it.offset + it.size }
|
val contentBottom = visibleReal.maxOf { it.offset + it.size }
|
||||||
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
val padding = info.beforeContentPadding + info.afterContentPadding
|
||||||
|
(info.viewportSize.height - padding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,8 @@ fun rememberViewportFill(state: LazyGridState): Dp {
|
|||||||
FILL_EPSILON_PX
|
FILL_EPSILON_PX
|
||||||
} else {
|
} else {
|
||||||
val contentBottom = visibleReal.maxOf { it.offset.y + it.size.height }
|
val contentBottom = visibleReal.maxOf { it.offset.y + it.size.height }
|
||||||
(info.viewportSize.height - info.afterContentPadding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
val padding = info.beforeContentPadding + info.afterContentPadding
|
||||||
|
(info.viewportSize.height - padding - contentBottom).coerceAtLeast(0) + FILL_EPSILON_PX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,8 @@ object ArtworkSeedCache {
|
|||||||
): Pair<Int, Int?>? {
|
): Pair<Int, Int?>? {
|
||||||
cache.get(ref.cacheKey)?.let { return it }
|
cache.get(ref.cacheKey)?.let { return it }
|
||||||
val job = jobs.computeIfAbsent(ref.cacheKey) { scope.async { resolve(context, ref) } }
|
val job = jobs.computeIfAbsent(ref.cacheKey) { scope.async { resolve(context, ref) } }
|
||||||
val seeds = job.await()
|
job.invokeOnCompletion { jobs.remove(ref.cacheKey, job) }
|
||||||
jobs.remove(ref.cacheKey, job)
|
return job.await()
|
||||||
return seeds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun prefetch(
|
fun prefetch(
|
||||||
|
|||||||
Reference in New Issue
Block a user