mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-15 20:54:27 +01:00
Made content central
This commit is contained in:
@@ -166,11 +166,17 @@ private fun SessionClosed(
|
||||
title = stringResource(R.string.channel_sounding),
|
||||
)
|
||||
}
|
||||
Text(
|
||||
stringResource(R.string.ranging_session_stopped),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.ranging_session_stopped),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
}
|
||||
Button(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
@@ -206,14 +212,21 @@ private fun SessionError(
|
||||
title = stringResource(R.string.channel_sounding),
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(sessionData.reason.toUiString()),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(sessionData.reason.toUiString()),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (sessionData.reason != SessionClosedReason.NOT_SUPPORTED ||
|
||||
sessionData.reason != SessionClosedReason.RANGING_NOT_AVAILABLE) {
|
||||
sessionData.reason != SessionClosedReason.RANGING_NOT_AVAILABLE
|
||||
) {
|
||||
Button(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
onClick = { onClickEvent(ChannelSoundingEvent.RestartRangingSession) },
|
||||
@@ -224,38 +237,6 @@ private fun SessionError(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DistanceDashboard(measurement: Double) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.ranging_distance_m, measurement.toFloat()),
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
style = MaterialTheme.typography.displayLarge
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.current_measurement),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun DDistanceDashboard_Preview() {
|
||||
NordicTheme {
|
||||
DistanceDashboard(2.5)
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.BAKLAVA)
|
||||
@Composable
|
||||
private fun RangingContent(
|
||||
@@ -288,6 +269,38 @@ private fun RangingContent(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DistanceDashboard(measurement: Double) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.ranging_distance_m, measurement.toFloat()),
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
style = MaterialTheme.typography.displayLarge
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.current_measurement),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun DDistanceDashboard_Preview() {
|
||||
NordicTheme {
|
||||
DistanceDashboard(2.5)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun DetailsCard(
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<string name="cs_missing_permissions">Missing permissions.</string>
|
||||
<string name="cs_ranging_not_available">Ranging service not available.</string>
|
||||
<string name="cs_security_not_available">Channel Sounding with required security level is not supported. </string>
|
||||
<string name="cs_error_unknown">Oops! Session just ghosted harder than your last Tinder date. Try reconnecting…</string>
|
||||
<string name="cs_error_unknown">Oops! \nThat session disappeared faster than your last Tinder match. Try reconnecting…</string>
|
||||
<string name="cs_local_request">Session terminated by local request.</string>
|
||||
<string name="cs_remote_request">Session terminated by remote peer.</string>
|
||||
<string name="cs_peer_terminated">Peer terminated the session.</string>
|
||||
|
||||
Reference in New Issue
Block a user