Repository navigation
[3/3] onboarding favorite sport selector #119
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
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
64ed51c
first draft of onboarding animation
amjiao f7bd25d
Complete animation
amjiao 571bcac
Complete onboarding animation
amjiao cdfaf5e
remove onboarding preview screen from commit
amjiao 2e6d25b
Clean up OnboardingScreen.kt
amjiao 70345f9
Merge branch 'main' of https://github.com/cuappdev/score-android into…
amjiao 539833c
Merge branch 'main' into onboarding
amjiao 5a9d900
Onboarding profile picture selection
amjiao 617b178
Onboarding profile picture selection
amjiao 996fcf7
Merge branch 'onboarding2' of https://github.com/cuappdev/score-andro…
amjiao a645f2d
Make screen name more informative
amjiao 1f59b71
first draft onboarding profile screen
amjiao 6ceef4e
Make name more informative
amjiao f69c41e
Rename file
amjiao 0689e24
fix page dot indicator
amjiao fe3103a
first draft onboarding profile screen
amjiao bf01222
Make name more informative
amjiao bb1e5b5
fix page dot indicator
amjiao b291bdf
Merge branch 'onboarding3' of https://github.com/cuappdev/score-andro…
amjiao 122ab35
Fix profile selector defaults
amjiao dc900f2
Change onboarding state representation from int to enum
amjiao ed21b71
Change manual scaling to adaptive
amjiao 49f5e02
Onboarding footer component
amjiao 1597916
Add sport select icons
amjiao 5dd429c
Change SportSelectScreen to not use manual scaling
amjiao 0679464
Use new onboarding footer component
amjiao 9dcfd30
first draft of onboarding animation
amjiao 1c59b90
Complete animation
amjiao 72ae474
Complete onboarding animation
amjiao 9150768
remove onboarding preview screen from commit
amjiao 9d5dbc4
Clean up OnboardingScreen.kt
amjiao e075ff8
fix nav padding per coderabbit comment
amjiao 08ebb0b
make common onboarding screen origin per coderabbit review
amjiao d580f98
Onboarding profile picture selection
amjiao 3ebccad
Make screen name more informative
amjiao 62db4eb
Rename file
amjiao 247fd88
Fix profile selector defaults
amjiao 39a605e
Change onboarding state representation from int to enum
amjiao dda86eb
Change manual scaling to adaptive
amjiao dc3f8a9
first draft onboarding profile screen
amjiao d520726
Make name more informative
amjiao 2e36a6a
fix page dot indicator
amjiao 70bfaba
first draft onboarding profile screen
amjiao 4fa2f26
Make name more informative
amjiao 1e2ea23
fix page dot indicator
amjiao b461368
Onboarding footer component
amjiao 76f0f2f
Add sport select icons
amjiao 4059984
Change SportSelectScreen to not use manual scaling
amjiao 5e961d3
Use new onboarding footer component
amjiao ef4433f
Restore favorite sports onboarding step
amjiao ddd821d
Clean up
amjiao 5e8c78b
Merge branch 'onboarding3' of https://github.com/cuappdev/score-andro…
amjiao 0c4cea2
Clean up
amjiao 65ddd3b
Address pr comments
amjiao eff9a62
Make shared onboarding preference repository
amjiao 24d68df
Merge branch 'onboarding2' of https://github.com/cuappdev/score-andro…
amjiao b58f6bc
Merge branch 'onboarding' into onboarding2
amjiao fc6358c
restore onboarding profile selection
amjiao 0b67045
Merge branch 'onboarding2' of https://github.com/cuappdev/score-andro…
amjiao b715e63
Abstract the gender filter
amjiao 1516091
Update OnboardingFavoriteSportsScreen.kt
amjiao 229e668
Merge branch 'main' of https://github.com/cuappdev/score-android into…
amjiao bdcc436
Refactor EditFavoriteSportsScreen and OnboardingFavoriteSportScreen t…
amjiao 2e479e9
Make OnboardingFooter dumber ui
amjiao bc8cdf4
Extract preferences logic
amjiao 77f132f
Reformatting
amjiao ee159ed
Clean up logic, align sport availability between onboarding and edit …
amjiao de66613
Update OnboardingFooter call argument
amjiao 7f93999
Merge branch 'main' of https://github.com/cuappdev/score-android into…
amjiao 29371d4
Refactor logic out of setContent
amjiao 1c7c5e1
Refactor for mvvm
amjiao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
app/src/main/java/com/cornellappdev/score/components/GenderDivisionFilter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package com.cornellappdev.score.components | ||
|
|
||
| import androidx.compose.foundation.BorderStroke | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxHeight | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.selection.selectable | ||
| import androidx.compose.foundation.selection.selectableGroup | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.semantics.Role | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.cornellappdev.score.model.GenderDivision | ||
| import com.cornellappdev.score.theme.CrimsonPrimary | ||
| import com.cornellappdev.score.theme.GrayLight | ||
| import com.cornellappdev.score.theme.GrayMedium | ||
| import com.cornellappdev.score.theme.Style | ||
| import com.cornellappdev.score.theme.White | ||
|
|
||
| /** Accessible, single-choice filter shared by the Home screen and onboarding. */ | ||
| @Composable | ||
| fun GenderDivisionFilter( | ||
| selectedGender: GenderDivision, | ||
| onGenderSelected: (GenderDivision) -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| val options = listOf( | ||
| GenderDivision.ALL, | ||
| GenderDivision.MALE, | ||
| GenderDivision.FEMALE | ||
| ) | ||
|
|
||
| Row( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .padding(horizontal = 24.dp) | ||
| .height(48.dp) | ||
| .border(BorderStroke(1.dp, GrayLight), CircleShape) | ||
| .padding(5.dp) | ||
| .selectableGroup(), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| options.forEach { gender -> | ||
| val selected = gender == selectedGender | ||
| Box( | ||
| modifier = Modifier | ||
| .weight(1f) | ||
| .fillMaxHeight() | ||
| .background( | ||
| color = if (selected) CrimsonPrimary else Color.Transparent, | ||
| shape = CircleShape | ||
| ) | ||
| .selectable( | ||
| selected = selected, | ||
| role = Role.RadioButton, | ||
| onClick = { onGenderSelected(gender) } | ||
| ), | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| Text( | ||
| text = gender.displayName, | ||
| style = if (selected) Style.bodySemibold else Style.bodyMedium, | ||
| color = if (selected) White else GrayMedium | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| private fun GenderDivisionFilterPreview() { | ||
| ScorePreview { | ||
| var selectedGender by remember { mutableStateOf(GenderDivision.ALL) } | ||
|
|
||
| GenderDivisionFilter( | ||
| selectedGender = selectedGender, | ||
| onGenderSelected = { selectedGender = it } | ||
| ) | ||
| } | ||
| } |
87 changes: 87 additions & 0 deletions
87
app/src/main/java/com/cornellappdev/score/components/OnboardingFooter.kt
|
amjiao marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| package com.cornellappdev.score.components | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.material3.Button | ||
| import androidx.compose.material3.ButtonDefaults | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.cornellappdev.score.theme.CrimsonPrimary | ||
| import com.cornellappdev.score.theme.GrayStroke | ||
| import com.cornellappdev.score.theme.Style | ||
| import com.cornellappdev.score.theme.White | ||
|
|
||
| @Composable | ||
| fun OnboardingFooter( | ||
|
amjiao marked this conversation as resolved.
Resolved
|
||
| buttonText: String, | ||
| onClick: () -> Unit, | ||
| activeStep: Int, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| Column( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .background(White) | ||
| .padding( | ||
| start = 24.dp, | ||
| end = 24.dp, | ||
| top = 24.dp, | ||
| bottom = 60.dp | ||
| ), | ||
| horizontalAlignment = Alignment.CenterHorizontally | ||
| ) { | ||
| Button( | ||
| onClick = onClick, | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .height(48.dp), | ||
| shape = CircleShape, | ||
| colors = ButtonDefaults.buttonColors( | ||
| containerColor = CrimsonPrimary, | ||
| contentColor = White | ||
| ) | ||
| ) { | ||
| Text(buttonText, style = Style.heading3, color = White) | ||
| } | ||
|
|
||
| Spacer(Modifier.height(16.dp)) | ||
| Row( | ||
| horizontalArrangement = Arrangement.spacedBy(4.dp), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| repeat(2) { index -> | ||
| val isActive = index == activeStep | ||
| Box( | ||
| Modifier | ||
| .size(8.dp) | ||
| .background(if (isActive) CrimsonPrimary else GrayStroke, CircleShape) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun OnboardingFooterPreview() { | ||
| ScorePreview { | ||
| OnboardingFooter( | ||
| buttonText = "Next", | ||
| onClick = {}, | ||
| activeStep = 0 | ||
| ) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.