From 9c4a3191d61963632353d64ba9b85e1145a99a0c Mon Sep 17 00:00:00 2001 From: jeran Date: Fri, 6 May 2022 19:09:13 -0700 Subject: [PATCH] Fix outline cache in placeholder In the original implementation of the placeholder modifier a `lastOutline` ref was used to cache the `Outline` returned by the `drawPlaceholder` method. An update was made that removed the assignment of the outline to the ref in this commit: https://github.com/google/accompanist/commit/350f4b99fe9c04a074c9e39e25cf0eb7786ef2d7 This change restores the ref assignment to make the outline cache function correctly. --- .../java/com/google/accompanist/placeholder/Placeholder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/placeholder/src/main/java/com/google/accompanist/placeholder/Placeholder.kt b/placeholder/src/main/java/com/google/accompanist/placeholder/Placeholder.kt index eb57746d2..23f0ee142 100644 --- a/placeholder/src/main/java/com/google/accompanist/placeholder/Placeholder.kt +++ b/placeholder/src/main/java/com/google/accompanist/placeholder/Placeholder.kt @@ -178,7 +178,7 @@ fun Modifier.placeholder( // the alpha applied paint.alpha = placeholderAlpha withLayer(paint) { - drawPlaceholder( + lastOutline.value = drawPlaceholder( shape = shape, color = color, highlight = highlight, @@ -190,7 +190,7 @@ fun Modifier.placeholder( } } else if (placeholderAlpha >= 0.99f) { // If the placeholder alpha is > 99%, draw it with no alpha - drawPlaceholder( + lastOutline.value = drawPlaceholder( shape = shape, color = color, highlight = highlight,