Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish animation ignoring cancellation. #5279

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.graphics.drawscope.translate
import androidx.compose.ui.graphics.painter.Painter
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.withContext

/**
* Transition between a given request's optional placeholder and the resource.
Expand Down Expand Up @@ -141,7 +143,9 @@ internal class CrossFadeImpl(
animatable.animateTo(OPAQUE_ALPHA, animationSpec)
invalidate()
} finally {
animatable.snapTo(OPAQUE_ALPHA)
withContext(NonCancellable) {
animatable.snapTo(OPAQUE_ALPHA)
}
invalidate()
}
}
Expand All @@ -161,4 +165,4 @@ internal class CrossFadeImpl(
draw(size, animatable.value * alpha, colorFilter)
}
}
}
}
Loading