Skip to content

Commit eac3d03

Browse files
committed
Show field name for uncompleted matches and improve UI for navigation elements
1 parent 07e53ed commit eac3d03

File tree

7 files changed

+145
-155
lines changed

7 files changed

+145
-155
lines changed

app/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/build
1+
/build
2+
/release

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/EventDivisionMatchesView.kt

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ import androidx.compose.ui.Modifier
3333
import androidx.compose.ui.graphics.Color
3434
import androidx.compose.ui.text.font.FontWeight
3535
import androidx.compose.ui.text.style.TextAlign
36+
import androidx.compose.ui.text.style.TextOverflow
3637
import androidx.compose.ui.unit.dp
3738
import androidx.compose.ui.unit.sp
3839
import androidx.lifecycle.ViewModel
3940
import androidx.lifecycle.viewmodel.compose.viewModel
4041
import androidx.navigation.NavController
4142
import com.ramcosta.composedestinations.annotation.Destination
42-
import com.sunkensplashstudios.VRCRoboScout.ui.theme.*
43+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.allianceBlue
44+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.allianceRed
45+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.onTopContainer
46+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.topContainer
4347
import kotlinx.coroutines.CoroutineScope
4448
import kotlinx.coroutines.Dispatchers
4549
import kotlinx.coroutines.launch
@@ -108,23 +112,36 @@ fun MatchesView(matchList: List<Match>) {
108112
}
109113
}
110114
Spacer(modifier = Modifier.width(20.dp))
111-
Text(
112-
match.redScore.toString(),
113-
fontSize = 18.sp,
114-
fontWeight = FontWeight.Bold,
115-
color = allianceRed,
116-
textAlign = TextAlign.Start,
117-
modifier = Modifier.width(50.dp)
118-
)
119-
Spacer(modifier = Modifier.weight(1f))
120-
Text(
121-
match.blueScore.toString(),
122-
fontSize = 18.sp,
123-
fontWeight = FontWeight.Bold,
124-
color = allianceBlue,
125-
textAlign = TextAlign.End,
126-
modifier = Modifier.width(50.dp)
127-
)
115+
if (match.completed()) {
116+
Text(
117+
match.redScore.toString(),
118+
fontSize = 18.sp,
119+
fontWeight = FontWeight.Bold,
120+
color = allianceRed,
121+
textAlign = TextAlign.Start,
122+
modifier = Modifier.width(50.dp)
123+
)
124+
Spacer(modifier = Modifier.weight(1f))
125+
Text(
126+
match.blueScore.toString(),
127+
fontSize = 18.sp,
128+
fontWeight = FontWeight.Bold,
129+
color = allianceBlue,
130+
textAlign = TextAlign.End,
131+
modifier = Modifier.width(50.dp)
132+
)
133+
}
134+
else {
135+
Spacer(modifier = Modifier.weight(1f))
136+
Text(
137+
match.field ?: "",
138+
fontSize = 14.sp,
139+
overflow = TextOverflow.Ellipsis,
140+
color = Color.Gray,
141+
textAlign = TextAlign.Center
142+
)
143+
Spacer(modifier = Modifier.weight(1f))
144+
}
128145
Spacer(modifier = Modifier.width(20.dp))
129146
Column(
130147
horizontalAlignment = Alignment.CenterHorizontally,

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/EventDivisionRankingsView.kt

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ import androidx.compose.ui.text.font.FontWeight
3838
import androidx.compose.ui.text.style.TextOverflow
3939
import androidx.compose.ui.unit.dp
4040
import androidx.compose.ui.unit.sp
41-
import androidx.lifecycle.SavedStateHandle
4241
import androidx.lifecycle.ViewModel
4342
import androidx.lifecycle.viewmodel.compose.viewModel
4443
import androidx.navigation.NavController
4544
import com.ramcosta.composedestinations.annotation.Destination
4645
import com.ramcosta.composedestinations.navigation.navigate
4746
import com.sunkensplashstudios.VRCRoboScout.destinations.EventTeamMatchesViewDestination
48-
import com.sunkensplashstudios.VRCRoboScout.ui.theme.*
49-
47+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.onTopContainer
48+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.topContainer
5049
import kotlinx.coroutines.CoroutineScope
5150
import kotlinx.coroutines.Dispatchers
5251
import kotlinx.coroutines.launch
@@ -58,21 +57,6 @@ class EventDivisionRankingsViewModel: ViewModel() {
5857
var division by mutableStateOf(Division())
5958
var rankings by mutableStateOf(listOf<TeamRanking>())
6059
var teamPerformanceRatings by mutableStateOf(mapOf<Int, TeamPerformanceRatings>())
61-
/*var event: Event
62-
get() = state.get<Event>("event") ?: Event()
63-
set(value) = state.set("event", value)
64-
65-
var division: Division
66-
get() = state.get<Division>("division") ?: Division()
67-
set(value) = state.set("division", value)
68-
69-
var rankings: List<TeamRanking>
70-
get() = state.get<List<TeamRanking>>("rankings") ?: listOf()
71-
set(value) = state.set("rankings", value)
72-
73-
var teamPerformanceRatings: Map<Int, TeamPerformanceRatings>
74-
get() = state.get<Map<Int, TeamPerformanceRatings>>("teamPerformanceRatings") ?: mapOf()
75-
set(value) = state.set("teamPerformanceRatings", value)*/
7660
}
7761

7862
@OptIn(ExperimentalMaterial3Api::class)
@@ -117,9 +101,11 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
117101
Icon(
118102
Icons.AutoMirrored.Filled.ArrowBackIos,
119103
contentDescription = "Back",
120-
modifier = Modifier.padding(10.dp).clickable {
121-
navController.navigateUp()
122-
},
104+
modifier = Modifier
105+
.padding(10.dp)
106+
.clickable {
107+
navController.navigateUp()
108+
},
123109
tint = MaterialTheme.colorScheme.onTopContainer
124110
)
125111
}
@@ -169,12 +155,19 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
169155
.fillMaxWidth()
170156
.clickable {
171157
navController.navigate(
172-
EventTeamMatchesViewDestination(event, eventDivisionRankingsViewModel.event.getTeam(ranking.team.id) ?: Team())
158+
EventTeamMatchesViewDestination(
159+
event,
160+
eventDivisionRankingsViewModel.event.getTeam(
161+
ranking.team.id
162+
) ?: Team()
163+
)
173164
)
174165
},
175166
verticalAlignment = Alignment.CenterVertically
176167
) {
177-
Column {
168+
Column(
169+
modifier = Modifier.weight(1.0f)
170+
) {
178171
Row {
179172
Text(
180173
ranking.team.name,
@@ -203,10 +196,9 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
203196
}
204197
Column {
205198
Row(
206-
modifier = Modifier.fillMaxWidth(),
207199
horizontalArrangement = Arrangement.SpaceEvenly
208200
) {
209-
Spacer(modifier = Modifier.weight(1.0f))
201+
Spacer(modifier = Modifier.weight(0.5f))
210202
Column(
211203
verticalArrangement = Arrangement.spacedBy((-10).dp)
212204
) {
@@ -226,7 +218,7 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
226218
color = Color.Gray
227219
)
228220
}
229-
Spacer(modifier = Modifier.weight(1.0f))
221+
Spacer(modifier = Modifier.weight(0.5f))
230222
Column(
231223
verticalArrangement = Arrangement.spacedBy((-10).dp)
232224
) {
@@ -246,7 +238,7 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
246238
color = Color.Gray
247239
)
248240
}
249-
Spacer(modifier = Modifier.weight(1.0f))
241+
Spacer(modifier = Modifier.weight(0.5f))
250242
Column(
251243
verticalArrangement = Arrangement.spacedBy((-10).dp)
252244
) {
@@ -266,24 +258,17 @@ fun EventDivisionRankingsView(event: Event, division: Division, eventDivisionRan
266258
color = Color.Gray
267259
)
268260
}
269-
Spacer(modifier = Modifier.weight(1.0f))
270-
Icon(
271-
Icons.AutoMirrored.Filled.ArrowForwardIos,
272-
modifier = Modifier.size(15.dp),
273-
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
274-
contentDescription = "Show Match List"
275-
)
276261
}
277262
}
278-
Spacer(modifier = Modifier.weight(1.0f))
279-
Icon(
280-
Icons.AutoMirrored.Filled.ArrowForwardIos,
281-
modifier = Modifier.size(15.dp),
282-
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
283-
contentDescription = "Show ${eventDivisionRankingsViewModel.event.getTeam(ranking.team.id)?.number} Match List"
284-
)
285263
}
286264
}
265+
Spacer(modifier = Modifier.padding(horizontal = 10.dp))
266+
Icon(
267+
Icons.AutoMirrored.Filled.ArrowForwardIos,
268+
modifier = Modifier.size(15.dp),
269+
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
270+
contentDescription = "Show ${eventDivisionRankingsViewModel.event.getTeam(ranking.team.id)?.number} Match List"
271+
)
287272
}
288273
HorizontalDivider(
289274
thickness = 0.5.dp,

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/FavoritesView.kt

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import androidx.compose.ui.Modifier
3333
import androidx.compose.ui.graphics.Color
3434
import androidx.compose.ui.platform.LocalContext
3535
import androidx.compose.ui.text.font.FontWeight
36-
import androidx.compose.ui.text.style.TextOverflow
3736
import androidx.compose.ui.unit.dp
3837
import androidx.compose.ui.unit.sp
3938
import androidx.lifecycle.ViewModel
@@ -44,8 +43,10 @@ import com.ramcosta.composedestinations.navigation.navigate
4443
import com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination
4544
import com.sunkensplashstudios.VRCRoboScout.destinations.LookupViewDestination
4645
import com.sunkensplashstudios.VRCRoboScout.destinations.TeamEventsViewDestination
47-
import com.sunkensplashstudios.VRCRoboScout.ui.theme.*
48-
46+
import com.sunkensplashstudios.VRCRoboScout.helperviews.EventRow
47+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.button
48+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.onTopContainer
49+
import com.sunkensplashstudios.VRCRoboScout.ui.theme.topContainer
4950
import kotlinx.coroutines.CoroutineScope
5051
import kotlinx.coroutines.Dispatchers
5152
import kotlinx.coroutines.launch
@@ -251,35 +252,7 @@ fun FavoritesView(favoritesViewModel: FavoritesViewModel = viewModels["favorites
251252
Row(
252253
verticalAlignment = Alignment.CenterVertically
253254
) {
254-
Column(
255-
verticalArrangement = Arrangement.SpaceBetween,
256-
modifier = Modifier
257-
.padding(5.dp)
258-
.clickable {
259-
navController.navigate(
260-
EventViewDestination(event)
261-
)
262-
}
263-
) {
264-
Row {
265-
Text(
266-
event.name,
267-
maxLines = 1,
268-
overflow = TextOverflow.Ellipsis
269-
)
270-
}
271-
Row {
272-
Text(
273-
event.location.toString(),
274-
fontSize = 13.sp
275-
)
276-
Spacer(modifier = Modifier.weight(1.0f))
277-
Text(
278-
RoboScoutAPI.formatDate(event.startDate),
279-
fontSize = 13.sp
280-
)
281-
}
282-
}
255+
EventRow(navController, event)
283256
}
284257
Spacer(modifier = Modifier.weight(1.0f))
285258
Icon(

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/LookupView.kt

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
5555
import androidx.compose.ui.text.font.FontWeight
5656
import androidx.compose.ui.text.input.ImeAction
5757
import androidx.compose.ui.text.style.TextAlign
58-
import androidx.compose.ui.text.style.TextOverflow
5958
import androidx.compose.ui.unit.dp
6059
import androidx.compose.ui.unit.sp
6160
import androidx.lifecycle.ViewModel
6261
import androidx.navigation.NavController
6362
import com.ramcosta.composedestinations.annotation.Destination
6463
import com.ramcosta.composedestinations.navigation.navigate
65-
import com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination
6664
import com.sunkensplashstudios.VRCRoboScout.destinations.TeamEventsViewDestination
65+
import com.sunkensplashstudios.VRCRoboScout.helperviews.EventRow
6766
import com.sunkensplashstudios.VRCRoboScout.helperviews.SegmentText
6867
import com.sunkensplashstudios.VRCRoboScout.helperviews.SegmentedControl
6968
import com.sunkensplashstudios.VRCRoboScout.ui.theme.button
@@ -707,33 +706,7 @@ fun EventLookup(lookupViewModel: LookupViewModel, navController: NavController)
707706
Row(
708707
verticalAlignment = Alignment.CenterVertically
709708
) {
710-
Column(
711-
verticalArrangement = Arrangement.SpaceBetween,
712-
modifier = Modifier
713-
.padding(5.dp)
714-
.clickable {
715-
navController.navigate(EventViewDestination(event))
716-
}
717-
) {
718-
Row {
719-
Text(
720-
event.name,
721-
maxLines = 1,
722-
overflow = TextOverflow.Ellipsis
723-
)
724-
}
725-
Row {
726-
Text(
727-
event.location.toString(),
728-
fontSize = 13.sp
729-
)
730-
Spacer(modifier = Modifier.weight(1.0f))
731-
Text(
732-
RoboScoutAPI.formatDate(event.startDate),
733-
fontSize = 13.sp
734-
)
735-
}
736-
}
709+
EventRow(navController, event)
737710
}
738711
if (lookupViewModel.events.value.indexOf(event) != lookupViewModel.events.value.size - 1) {
739712
HorizontalDivider(
@@ -771,7 +744,8 @@ fun EventLookup(lookupViewModel: LookupViewModel, navController: NavController)
771744
Text(
772745
"${lookupViewModel.page.value}",
773746
modifier = Modifier.padding(horizontal = 20.dp),
774-
fontSize = 25.sp
747+
fontSize = 25.sp,
748+
textAlign = TextAlign.Center
775749
)
776750
IconButton(
777751
enabled = lookupViewModel.events.value.size == 20,

0 commit comments

Comments
 (0)