Skip to content

Commit 06fc8f6

Browse files
kanelbullesjudd
authored andcommitted
Finish animation ignoring cancellation.
1 parent cbdc1e7 commit 06fc8f6

File tree

1 file changed

+6
-2
lines changed
  • integration/compose/src/main/java/com/bumptech/glide/integration/compose

1 file changed

+6
-2
lines changed

integration/compose/src/main/java/com/bumptech/glide/integration/compose/Transition.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1212
import androidx.compose.ui.graphics.drawscope.clipRect
1313
import androidx.compose.ui.graphics.drawscope.translate
1414
import androidx.compose.ui.graphics.painter.Painter
15+
import kotlinx.coroutines.NonCancellable
16+
import kotlinx.coroutines.withContext
1517

1618
/**
1719
* Transition between a given request's optional placeholder and the resource.
@@ -141,7 +143,9 @@ internal class CrossFadeImpl(
141143
animatable.animateTo(OPAQUE_ALPHA, animationSpec)
142144
invalidate()
143145
} finally {
144-
animatable.snapTo(OPAQUE_ALPHA)
146+
withContext(NonCancellable) {
147+
animatable.snapTo(OPAQUE_ALPHA)
148+
}
145149
invalidate()
146150
}
147151
}
@@ -161,4 +165,4 @@ internal class CrossFadeImpl(
161165
draw(size, animatable.value * alpha, colorFilter)
162166
}
163167
}
164-
}
168+
}

0 commit comments

Comments
 (0)