-
Notifications
You must be signed in to change notification settings - Fork 180
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
Add an example of Shared elements that are seekable using SeekableTransitionState #416
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add android:enableOnBackInvokedCallback="true"
to the android manifest? otherwise the predictive back doesn't work (I don't know if we don't break some other snippet though)
When I cancel the back gesture, then it doesn't work again :( broken.mp4 |
…/snippets into predictive-back-seekable
try { | ||
seekableTransitionState.seekTo(backEvent.progress, targetState = Screen.Home) | ||
} catch (e: CancellationException) { | ||
// ignore the cancellation | ||
} | ||
} | ||
// code for completion | ||
seekableTransitionState.animateTo(seekableTransitionState.targetState) | ||
} catch (e: CancellationException) { | ||
// code for cancellation | ||
seekableTransitionState.animateTo(seekableTransitionState.currentState) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it slightly confusing why do I need to suppress the cancellation exceptions here.
Can we explain it a bit more in the comments? 🙏🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments.
Fixed this by changing to snapTo instead of animateTo in the cancellation block, could you try it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, so much clearer with the comments. I tried it on the phone and it's working ❤️
Added an example of seekable transitions, was previously approved by Doris but pull request got outdated. #273