-
Notifications
You must be signed in to change notification settings - Fork 0
Pagination #88
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
Open
EmilJiang
wants to merge
11
commits into
main
Choose a base branch
from
pagination
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pagination #88
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
054f001
git issue fix
EmilJiang d1e732c
advanced fitler first iteration
EmilJiang bf86fc9
center icon
EmilJiang 2f2017d
google-services.json
EmilJiang 3cc61b7
fix scrollable
EmilJiang 6fef02b
pagination
EmilJiang 1dd1651
Merge branch 'pagination' of https://github.com/cuappdev/score-androi…
EmilJiang 555d04d
test
EmilJiang 6f623d9
second test
EmilJiang acf1fe2
pr comments
EmilJiang d6c2946
Merge branch 'main' into pagination
EmilJiang 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
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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| /build | ||
| /build | ||
| app/google-services.json |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| query PagedGames($limit: Int!, $offset: Int!) { | ||
| games(limit: $limit, offset: $offset) { | ||
| id | ||
| city | ||
| date | ||
| gender | ||
| location | ||
| opponentId | ||
| result | ||
| sport | ||
| state | ||
| time | ||
| scoreBreakdown | ||
| utcDate | ||
| team { | ||
| id | ||
| color | ||
| image | ||
| name | ||
| } | ||
| boxScore { | ||
| team | ||
| period | ||
| time | ||
| description | ||
| scorer | ||
| assist | ||
| scoreBy | ||
| corScore | ||
| oppScore | ||
| } | ||
| } | ||
| } |
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
123 changes: 123 additions & 0 deletions
123
app/src/main/java/com/cornellappdev/score/components/ExpandableSection.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,123 @@ | ||
| package com.cornellappdev.score.components | ||
|
|
||
| import androidx.compose.animation.animateContentSize | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.material3.Icon | ||
| 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.res.painterResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.cornellappdev.score.R | ||
| import com.cornellappdev.score.theme.Style.bodyNormal | ||
| import com.cornellappdev.score.theme.Style.heading2 | ||
|
|
||
| interface DisplayableFilter { | ||
| val displayName: String | ||
| } | ||
|
|
||
| enum class PriceFilter(override val displayName: String) : DisplayableFilter { | ||
| UNTICKETED("Unticketed"), | ||
| UNDER_20("Under $20"), | ||
| UNDER_50("Under $50"), | ||
| OVER_50("Over $50") | ||
| } | ||
|
|
||
| enum class LocationFilter(override val displayName: String) : DisplayableFilter { | ||
| ON_CAMPUS("On Campus"), | ||
| ONE_TO_TWO_HOURS("1-2 Hours"), | ||
| TWO_TO_FOUR_HOURS("2-4 Hours"), | ||
| OVER_FOUR_HOURS("Over 4 Hours") | ||
| } | ||
|
|
||
| enum class DateFilter(override val displayName: String) : DisplayableFilter { | ||
| TODAY("Today"), | ||
| WITHIN_7_DAYS("Within 7 Days"), | ||
| WITHIN_A_MONTH("Within a Month"), | ||
| OVER_A_MONTH("Over a Month") | ||
| } | ||
|
|
||
| @Composable | ||
| fun <T : DisplayableFilter> ExpandableSection( | ||
| title: String, | ||
| options: List<T>, | ||
| selectedOption: T?, | ||
| onOptionSelected: (T?) -> Unit | ||
| ) { | ||
| var expanded by remember { mutableStateOf(false) } | ||
|
|
||
| Column { | ||
| Row( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .clickable { expanded = !expanded }, | ||
| horizontalArrangement = Arrangement.SpaceBetween, | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Text(title, style = heading2) | ||
| Icon( | ||
| painter = painterResource( | ||
| id = if (expanded) R.drawable.ic_round_minus else R.drawable.ic_round_plus | ||
| ), | ||
| contentDescription = if (expanded) "Collapse" else "Expand" | ||
| ) | ||
| } | ||
|
|
||
| // Options | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .animateContentSize() | ||
| ) { | ||
| if (expanded) { | ||
| Column { | ||
| options.forEach { option -> | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .clickable { onOptionSelected(option) } | ||
| .padding(start = 16.dp, top = 4.dp, bottom = 4.dp) | ||
| ) { | ||
| ScoreRadioButton( | ||
| selected = (selectedOption == option), | ||
| onClick = { onOptionSelected(option) }, | ||
| modifier = Modifier | ||
| .size(20.dp) | ||
| .padding(end = 8.dp) | ||
| ) | ||
| Text(option.displayName, style = bodyNormal) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| private fun ExpandableSectionPreview() = ScorePreview { | ||
| var selected by remember { mutableStateOf<PriceFilter?>(null) } | ||
|
|
||
| Column(modifier = Modifier.padding(16.dp)) { | ||
| ExpandableSection( | ||
| title = "Price", | ||
| options = PriceFilter.entries, | ||
| selectedOption = selected, | ||
| onOptionSelected = { selected = it } | ||
| ) | ||
| } | ||
| } | ||
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.