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

[JetSurvey] Use AnimatedContent to slide in and out changes between questions #842

Merged
merged 6 commits into from
Jun 20, 2022

Conversation

riggaroo
Copy link
Collaborator

@riggaroo riggaroo commented Jun 12, 2022

Added two usages of AnimatedContent into JetSurvey.

  1. Switching between Question Content
Before After
Survey_Questions_No_animation_Demo_Mode End_Questions_optimized
  1. Switching from questions to results
Before After
End_Congrats_Before_DemoMode End_Congrats_Final_Demo_Mode

Animate the changes between different question screens, as well as the end result screen.

@riggaroo riggaroo requested a review from a team as a code owner June 12, 2022 16:55
@riggaroo riggaroo requested review from kul3r4 and IanGClifton and removed request for kul3r4 June 12, 2022 16:55
@riggaroo riggaroo self-assigned this Jun 12, 2022
Copy link
Contributor

@IanGClifton IanGClifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thank you! I had just one super minor comment

Copy link
Contributor

@simona-anomis simona-anomis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -56,20 +64,34 @@ class SurveyFragment : Fragment() {
)
setContent {
JetsurveyTheme {
viewModel.uiState.observeAsState().value?.let { surveyState ->
when (surveyState) {
val state = viewModel.uiState.observeAsState().value ?: return@JetsurveyTheme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the ?: return@JetsurveyTheme change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed a non-nullable state, and I generally prefer early returns instead of wrapping content in lets 😄 https://betterprogramming.pub/are-early-returns-any-good-eed4b4d03866

@riggaroo riggaroo merged commit 3d0b54f into main Jun 20, 2022
@riggaroo riggaroo deleted the riggaroo/jetsurvey-animated-content branch June 20, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants