@@ -5,135 +5,159 @@ import com.cornellappdev.score.R
55
66enum class Sport (
77 val displayName : String ,
8+ val gender : GenderDivision ,
89 @DrawableRes val emptyIcon : Int ,
910 @DrawableRes val filledIcon : Int
1011) {
1112 BASEBALL (
1213 displayName = " Baseball" ,
14+ gender = GenderDivision .MALE ,
1315 emptyIcon = R .drawable.ic_baseball,
14- filledIcon = R .drawable.ic_baseball_filled,
16+ filledIcon = R .drawable.ic_baseball_filled
1517 ),
1618 BASKETBALL (
1719 displayName = " Basketball" ,
20+ gender = GenderDivision .ALL ,
1821 emptyIcon = R .drawable.ic_basketball,
1922 filledIcon = R .drawable.ic_basketball_filled
2023 ),
2124 CROSS_COUNTRY (
2225 displayName = " Cross Country" ,
26+ gender = GenderDivision .ALL ,
2327 emptyIcon = R .drawable.ic_cross_country,
2428 filledIcon = R .drawable.ic_cross_country_filled
2529 ),
26-
27- // TODO: Fill in rest
2830 EQUESTRIAN (
2931 displayName = " Equestrian" ,
32+ gender = GenderDivision .FEMALE ,
3033 emptyIcon = R .drawable.ic_equestrian,
3134 filledIcon = R .drawable.ic_equestrian_filled
3235 ),
3336 FENCING (
3437 displayName = " Fencing" ,
38+ gender = GenderDivision .ALL ,
3539 emptyIcon = R .drawable.ic_fencing,
3640 filledIcon = R .drawable.ic_fencing_filled
3741 ),
3842 FIELD_HOCKEY (
3943 displayName = " Field Hockey" ,
44+ gender = GenderDivision .FEMALE ,
4045 emptyIcon = R .drawable.ic_field_hockey,
4146 filledIcon = R .drawable.ic_field_hockey_filled
4247 ),
4348 GYMNASTICS (
4449 displayName = " Gymnastics" ,
50+ gender = GenderDivision .FEMALE ,
4551 emptyIcon = R .drawable.ic_gymnastics,
4652 filledIcon = R .drawable.ic_gymnastics_filled
4753 ),
4854 FOOTBALL (
4955 displayName = " Football" ,
56+ gender = GenderDivision .MALE ,
5057 emptyIcon = R .drawable.ic_football,
5158 filledIcon = R .drawable.ic_football_filled
5259 ),
5360 GOLF (
5461 displayName = " Golf" ,
62+ gender = GenderDivision .MALE ,
5563 emptyIcon = R .drawable.ic_golf,
5664 filledIcon = R .drawable.ic_golf_filled
5765 ),
5866 ICE_HOCKEY (
5967 displayName = " Ice Hockey" ,
68+ gender = GenderDivision .ALL ,
6069 emptyIcon = R .drawable.ic_ice_hockey,
6170 filledIcon = R .drawable.ic_ice_hockey_filled
6271 ),
63- LACROSSE (
64- displayName = " Lacrosse" ,
65- emptyIcon = R .drawable.ic_squash,
66- filledIcon = R .drawable.ic_squash_filled
67- ),
6872
6973 // TODO: awaiting polo icon from design
7074// POLO(
7175// displayName = "Polo",
76+ // gender = GenderDivision.ALL,
7277// emptyIcon = R.drawable.ic_polo,
7378// filledIcon = R.drawable.ic_polo_filled
7479// ),
75- // ROWING( //Probably not a thing
76- // displayName = "Rowing",
77- // emptyIcon = R.drawable.ic_rowing,
78- // filledIcon = R.drawable.ic_rowing_filled
79- // ),
80+ ROWING (
81+ displayName = " Rowing" ,
82+ gender = GenderDivision .FEMALE ,
83+ emptyIcon = R .drawable.ic_rowing_lightweight,
84+ filledIcon = R .drawable.ic_rowing_lightweight_filled
85+ ),
86+ LACROSSE (
87+ displayName = " Lacrosse" ,
88+ gender = GenderDivision .ALL ,
89+ emptyIcon = R .drawable.ic_squash,
90+ filledIcon = R .drawable.ic_squash_filled
91+ ),
8092 ROWING_HEAVYWEIGHT (
8193 displayName = " Heavyweight Rowing" ,
94+ gender = GenderDivision .MALE ,
8295 emptyIcon = R .drawable.ic_rowing_heavyweight,
8396 filledIcon = R .drawable.ic_rowing_heavyweight_filled
8497 ),
8598 ROWING_LIGHTWEIGHT (
8699 displayName = " Lightweight Rowing" ,
100+ gender = GenderDivision .MALE ,
87101 emptyIcon = R .drawable.ic_rowing_lightweight,
88102 filledIcon = R .drawable.ic_rowing_lightweight_filled
89103 ),
90104 SAILING (
91105 displayName = " Sailing" ,
106+ gender = GenderDivision .ALL ,
92107 emptyIcon = R .drawable.ic_sailing,
93108 filledIcon = R .drawable.ic_sailing_filled
94109 ),
95110 SOCCER (
96111 displayName = " Soccer" ,
112+ gender = GenderDivision .ALL ,
97113 emptyIcon = R .drawable.ic_soccer,
98114 filledIcon = R .drawable.ic_soccer_filled
99115 ),
100116 SOFTBALL (
101117 displayName = " Softball" ,
118+ gender = GenderDivision .FEMALE ,
102119 emptyIcon = R .drawable.ic_softball,
103120 filledIcon = R .drawable.ic_softball_filled
104121 ),
105122 SPRINT_FOOTBALL (
106123 displayName = " Sprint Football" ,
124+ gender = GenderDivision .MALE ,
107125 emptyIcon = R .drawable.ic_sprint_football,
108126 filledIcon = R .drawable.ic_sprint_football_filled
109127 ),
110128 SQUASH (
111129 displayName = " Squash" ,
130+ gender = GenderDivision .ALL ,
112131 emptyIcon = R .drawable.ic_squash,
113132 filledIcon = R .drawable.ic_squash_filled
114133 ),
115134 SWIM_DIVE (
116135 displayName = " Swim Dive" ,
136+ gender = GenderDivision .ALL ,
117137 emptyIcon = R .drawable.ic_swim_dive,
118138 filledIcon = R .drawable.ic_swim_dive_filled
119139 ),
120140 TENNIS (
121141 displayName = " Tennis" ,
142+ gender = GenderDivision .ALL ,
122143 emptyIcon = R .drawable.ic_tennis,
123144 filledIcon = R .drawable.ic_tennis_filled
124145 ),
125146 TRACK_FIELD (
126147 displayName = " Track and Field" ,
148+ gender = GenderDivision .ALL ,
127149 emptyIcon = R .drawable.ic_track_field,
128150 filledIcon = R .drawable.ic_track_field_filled
129151 ),
130152 VOLLEYBALL (
131153 displayName = " Volleyball" ,
154+ gender = GenderDivision .FEMALE ,
132155 emptyIcon = R .drawable.ic_volleyball,
133156 filledIcon = R .drawable.ic_volleyball_filled
134157 ),
135158 WRESTLING (
136159 displayName = " Wrestling" ,
160+ gender = GenderDivision .MALE ,
137161 emptyIcon = R .drawable.ic_wrestling,
138162 filledIcon = R .drawable.ic_wrestling_filled
139163 );
@@ -143,8 +167,15 @@ enum class Sport(
143167 return entries.find { it.displayName.equals(name, ignoreCase = true ) }
144168 }
145169
146- fun getSportSelectionList (): List <SportSelection > {
147- return listOf (SportSelection .All ) + Sport .entries.map { SportSelection .SportSelect (it) }
170+ fun getSportSelectionList (selectedGender : GenderDivision ? ): List <SportSelection > {
171+ val filteredSports = when (selectedGender) {
172+ GenderDivision .MALE -> Sport .entries.filter { it.gender == GenderDivision .MALE || it.gender == GenderDivision .ALL }
173+ GenderDivision .FEMALE -> Sport .entries.filter { it.gender == GenderDivision .FEMALE || it.gender == GenderDivision .ALL }
174+ GenderDivision .ALL ,
175+ null -> Sport .entries
176+ }
177+
178+ return listOf (SportSelection .All ) + filteredSports.map { SportSelection .SportSelect (it) }
148179 }
149180 }
150181}
0 commit comments