diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/components/MainSearchBar.kt b/app/src/main/java/org/scottishtecharmy/soundscape/components/MainSearchBar.kt
index da7b9610..b707ff2d 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/components/MainSearchBar.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/components/MainSearchBar.kt
@@ -22,7 +22,6 @@ import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
@OptIn(ExperimentalMaterial3Api::class)
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/HomeScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/HomeScreen.kt
index 70342dad..1e255860 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/HomeScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/HomeScreen.kt
@@ -15,8 +15,6 @@ import org.scottishtecharmy.soundscape.screens.home.home.Home
import org.scottishtecharmy.soundscape.screens.home.locationDetails.LocationDescription
import org.scottishtecharmy.soundscape.screens.home.locationDetails.LocationDetailsScreen
import org.scottishtecharmy.soundscape.screens.home.settings.Settings
-import org.scottishtecharmy.soundscape.screens.markers_routes.navigation.MarkersAndRoutesNavGraph
-import org.scottishtecharmy.soundscape.screens.markers_routes.navigation.ScreensForMarkersAndRoutes
import org.scottishtecharmy.soundscape.screens.markers_routes.screens.MarkersAndRoutesScreen
import org.scottishtecharmy.soundscape.screens.markers_routes.screens.addroute.AddRouteScreen
import org.scottishtecharmy.soundscape.viewmodels.HomeViewModel
@@ -119,14 +117,6 @@ fun HomeScreen(
val selectedTab = backStackEntry.arguments?.getString("tab")
MarkersAndRoutesScreen(mainNavController = navController, selectedTab = selectedTab)
}
-
- // Nested graph: Routes and Markers
- composable(ScreensForMarkersAndRoutes.Markers.route) {
- MarkersAndRoutesNavGraph(
- navController = navController,
- startDestination = "Markers",
- )
- }
}
// AddRouteScreen, accessible within the MarkersAndRoutesScreen
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/Home.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/Home.kt
index cfb3e08f..7d5143b5 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/Home.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/Home.kt
@@ -29,7 +29,10 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
@@ -123,7 +126,7 @@ fun Home(
onNavigate = onNavigate,
searchBar = {
MainSearchBar(
- searchText = "Hello Dave",
+ searchText = "",
isSearching = false,
itemList = emptyList(),
onSearchTextChange = { },
@@ -153,7 +156,10 @@ fun HomeTopAppBar(
containerColor = MaterialTheme.colorScheme.background,
titleContentColor = Color.White,
),
- title = { Text(stringResource(R.string.app_name)) },
+ title = { Text(
+ text = stringResource(R.string.app_name),
+ modifier = Modifier.semantics { heading() }
+ ) },
navigationIcon = {
IconButton(
onClick = {
@@ -181,7 +187,17 @@ fun HomeTopAppBar(
},
) {
if (streetPreviewEnabled) {
- Icon(Icons.Rounded.Preview, contentDescription = "Street Preview enabled")
+ Icon(
+ Icons.Rounded.Preview,
+ tint = MaterialTheme.colorScheme.primary,
+ contentDescription = stringResource(R.string.street_preview_enabled)
+ )
+ } else {
+ Icon(
+ painterResource(R.drawable.preview_off),
+ tint = MaterialTheme.colorScheme.secondary,
+ contentDescription = stringResource(R.string.street_preview_disabled)
+ )
}
}
IconToggleButton(
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/HomeBottomAppBar.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/HomeBottomAppBar.kt
index 9e5540d4..7b8c128b 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/HomeBottomAppBar.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/home/HomeBottomAppBar.kt
@@ -122,7 +122,7 @@ private fun HomeBottomAppBarButton(
},
shape = RectangleShape,
modifier = modifier,
- contentPadding = PaddingValues(0.dp)
+ contentPadding = PaddingValues(4.dp)
) {
Column(
verticalArrangement = Arrangement.Top,
@@ -143,8 +143,9 @@ private fun HomeBottomAppBarButton(
Text(
text = text,
textAlign = TextAlign.Center,
- style = MaterialTheme.typography.labelMedium
+ style = MaterialTheme.typography.labelMedium,
)
+
}
}
}
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/settings/Settings.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/settings/Settings.kt
index b6cdfb79..d0204492 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/settings/Settings.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/home/settings/Settings.kt
@@ -6,7 +6,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import me.zhanghai.compose.preference.ProvidePreferenceLocals
import me.zhanghai.compose.preference.listPreference
@@ -53,20 +56,13 @@ fun Settings(
Text(
text = stringResource(R.string.menu_manage_callouts),
color = MaterialTheme.colorScheme.onPrimary,
+ modifier = Modifier.semantics { heading() },
)
}
switchPreference(
key = MainActivity.ALLOW_CALLOUTS_KEY,
defaultValue = MainActivity.ALLOW_CALLOUTS_DEFAULT,
title = { Text(text = stringResource(R.string.callouts_allow_callouts)) },
- summary = {
- Text(
- text = if (it) stringResource(R.string.callouts_callouts_on) else stringResource(
- R.string.callouts_callouts_off
- ),
- color = MaterialTheme.colorScheme.onPrimary
- )
- }
)
switchPreference(
key = MainActivity.PLACES_AND_LANDMARKS_KEY,
@@ -93,7 +89,8 @@ fun Settings(
Text(
text = "Manage Audio Engine",
color = MaterialTheme.colorScheme.onPrimary,
- )
+ modifier = Modifier.semantics { heading() },
+ )
}
listPreference(
key = MainActivity.BEACON_TYPE_KEY,
@@ -124,7 +121,8 @@ fun Settings(
Text(
text = "Debug settings",
color = MaterialTheme.colorScheme.onPrimary,
- )
+ modifier = Modifier.semantics { heading() },
+ )
}
switchPreference(
key = MainActivity.MAP_DEBUG_KEY,
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/CustomAppBar.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/CustomAppBar.kt
index 05fc3ca6..f7c6a317 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/CustomAppBar.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/CustomAppBar.kt
@@ -1,10 +1,5 @@
package org.scottishtecharmy.soundscape.screens.markers_routes.components
-import androidx.compose.animation.AnimatedVisibility
-import androidx.compose.animation.expandHorizontally
-import androidx.compose.animation.fadeIn
-import androidx.compose.animation.fadeOut
-import androidx.compose.animation.shrinkHorizontally
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.IntrinsicSize
@@ -13,10 +8,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Add
-import androidx.compose.material3.Icon
-import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -24,6 +15,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@@ -34,8 +27,6 @@ import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
@Composable
fun CustomAppBar(title : String,
onNavigateUp: () -> Unit,
- onAddClicked: (() -> Unit)? = null,
- showAddIcon: Boolean = false,
navigationButtonTitle: String = stringResource(R.string.ui_back_button_title),
) {
Surface(
@@ -62,27 +53,9 @@ fun CustomAppBar(title : String,
) {
Text(
text = title,
+ modifier = Modifier.semantics { heading() }
)
}
-
-
- AnimatedVisibility(
- visible = showAddIcon,
- enter = fadeIn() + expandHorizontally(),
- exit = fadeOut() + shrinkHorizontally(),
- modifier = Modifier.fillMaxHeight()
- ) {
- IconButton(
- onClick = {
- onAddClicked?.invoke()
- }
- ){
- Icon(
- Icons.Default.Add,
- contentDescription = stringResource(R.string.general_alert_add),
- )
- }
- }
}
}
}
@@ -95,9 +68,7 @@ fun CustomAppBarPreview() {
CustomAppBar(
"Test app bar with long title",
navigationButtonTitle = "Back",
- showAddIcon = false,
onNavigateUp = {},
- onAddClicked = {}
)
}
}
@@ -110,9 +81,7 @@ fun CustomAppBarWithActionButtonPreview() {
CustomAppBar(
"Test app bar",
navigationButtonTitle = "Back",
- showAddIcon = true,
onNavigateUp = {},
- onAddClicked = {}
)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesAppBar.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesAppBar.kt
index 81d380bf..3732d7a9 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesAppBar.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesAppBar.kt
@@ -7,19 +7,15 @@ import androidx.compose.ui.tooling.preview.Preview
import org.scottishtecharmy.soundscape.R
import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
-@OptIn(ExperimentalMaterial3Api::class)
@Composable
-fun MarkersAndRoutesAppBar(showAddIcon: Boolean,
- onNavigateUp: () -> Unit,
- onNavigateToDestination: () -> Unit
+fun MarkersAndRoutesAppBar(
+ onNavigateUp: () -> Unit,
) {
CustomAppBar(
title = stringResource(R.string.search_view_markers),
navigationButtonTitle = stringResource(R.string.ui_back_button_title),
onNavigateUp = onNavigateUp,
- showAddIcon = showAddIcon,
- onAddClicked = onNavigateToDestination,
)
}
@@ -28,10 +24,7 @@ fun MarkersAndRoutesAppBar(showAddIcon: Boolean,
fun MarkersAndRoutesAppBarPreview() {
SoundscapeTheme {
MarkersAndRoutesAppBar(
- showAddIcon = true,
onNavigateUp = {},
- onNavigateToDestination = {}
-
)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesBottomNavBar.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesBottomNavBar.kt
index 2dd55caf..566d8d88 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesBottomNavBar.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/MarkersAndRoutesBottomNavBar.kt
@@ -1,7 +1,8 @@
package org.scottishtecharmy.soundscape.screens.markers_routes.components
-import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
@@ -23,7 +24,7 @@ val items = listOf(
)
@Composable
-fun BottomNavigationBar(navController: NavController,
+fun MarkersAndRoutesTabs(navController: NavController,
) {
val currentRoute = navController.currentBackStackEntryAsState().value?.destination?.route
@@ -47,23 +48,19 @@ fun BottomNavigationBar(navController: NavController,
Text(item.title, style = MaterialTheme.typography.bodyLarge)
},
icon = {
- Image(
- painter = painterResource(
- id = if (isSelected) {
- item.selectedIconResId!!
- } else {
- item.unselectedIconResId!!
- }
- ),
- contentDescription = null, // No need of contentDescription as text is below
- )
+ item.iconResId?.let {
+ Icon(painter = painterResource(it),
+ contentDescription = null, // No need of contentDescription as text is below,
+ modifier = Modifier.size(64.dp)
+ )
+ }
+
},
colors = NavigationBarItemDefaults.colors(
selectedIconColor = MaterialTheme.colorScheme.onPrimary,
- unselectedIconColor = MaterialTheme.colorScheme.onSurfaceVariant,
+ unselectedIconColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.7f),
selectedTextColor = MaterialTheme.colorScheme.onPrimary,
- unselectedTextColor = MaterialTheme.colorScheme.onSurfaceVariant,
- indicatorColor = MaterialTheme.colorScheme.surfaceDim
+ unselectedTextColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.7f),
)
)
}
@@ -75,7 +72,7 @@ fun BottomNavigationBar(navController: NavController,
fun BottomNavigationBarPreview() {
val navController = rememberNavController()
MaterialTheme {
- BottomNavigationBar(navController = navController,
+ MarkersAndRoutesTabs(navController = navController,
)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/TextFieldWithLabel.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/TextFieldWithLabel.kt
new file mode 100644
index 00000000..97072283
--- /dev/null
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/components/TextFieldWithLabel.kt
@@ -0,0 +1,81 @@
+package org.scottishtecharmy.soundscape.screens.markers_routes.components
+
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
+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.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
+
+@Composable
+fun TextFieldWithLabel(
+ value: String,
+ onValueChange: (String) -> Unit,
+ label: String,
+ modifier: Modifier = Modifier,
+ textStyle: TextStyle = MaterialTheme.typography.bodyMedium,
+ shape: Shape = RoundedCornerShape(5.dp),
+ focusedBgColor: Color = MaterialTheme.colorScheme.onPrimary, // Default colour of white for TextField
+ unfocusedBgColor: Color = MaterialTheme.colorScheme.onPrimary, // Default colour of white for TextField
+ focusedTextColor: Color = MaterialTheme.colorScheme.onSecondary, // Default color of black
+ unfocusedTextColor: Color = MaterialTheme.colorScheme.onSurfaceVariant, // Default color of grey
+ isSingleLine: Boolean = true // Optional single-line behavior
+) {
+ TextField(
+ value = value,
+ onValueChange = onValueChange,
+ textStyle = textStyle,
+ shape = shape,
+ singleLine = isSingleLine,
+ label = {
+ Text(
+ text = label,
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ },
+ colors = TextFieldDefaults.colors(
+ focusedContainerColor = focusedBgColor,
+ unfocusedContainerColor = unfocusedBgColor,
+ focusedTextColor = focusedTextColor,
+ unfocusedTextColor = unfocusedTextColor
+ ),
+ modifier = modifier
+ )
+}
+
+@Preview(showBackground = true)
+@Composable
+fun TextFieldWithLabelPreview() {
+ var textValue by remember { mutableStateOf("Dave") }
+ SoundscapeTheme {
+ TextFieldWithLabel(
+ label = "Name",
+ value = textValue,
+ onValueChange = { textValue = it },
+ textStyle = TextStyle(fontSize = 18.sp),
+ shape = RoundedCornerShape(5.dp),
+ focusedBgColor = MaterialTheme.colorScheme.onPrimary,
+ unfocusedBgColor = MaterialTheme.colorScheme.onPrimary,
+ focusedTextColor = MaterialTheme.colorScheme.onSecondary,
+ unfocusedTextColor = MaterialTheme.colorScheme.onSurfaceVariant,
+ isSingleLine = true
+ )
+ }
+
+}
+
+
+
+
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/MarkersAndRoutesNavGraph.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/MarkersAndRoutesNavGraph.kt
index 939d404a..be641748 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/MarkersAndRoutesNavGraph.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/MarkersAndRoutesNavGraph.kt
@@ -12,6 +12,7 @@ import org.scottishtecharmy.soundscape.screens.markers_routes.screens.addroute.A
@Composable
fun MarkersAndRoutesNavGraph(
navController: NavHostController,
+ onNavigateToAddRoute: () -> Unit,
startDestination: String) {
NavHost(
navController = navController,
@@ -21,7 +22,10 @@ fun MarkersAndRoutesNavGraph(
MarkersScreen(navController = navController)
}
composable(ScreensForMarkersAndRoutes.Routes.route) {
- RoutesScreen(navController = navController)
+ RoutesScreen(
+ navController = navController,
+ onNavigateToAddRoute = onNavigateToAddRoute
+ )
}
// AddRouteScreen, accessible within the MarkersAndRoutesScreen
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/ScreensForMarkersAndRoutes.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/ScreensForMarkersAndRoutes.kt
index 24099d9f..8173e0a9 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/ScreensForMarkersAndRoutes.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/navigation/ScreensForMarkersAndRoutes.kt
@@ -5,19 +5,18 @@ import org.scottishtecharmy.soundscape.R
sealed class ScreensForMarkersAndRoutes(
val route: String,
val title: String,
- val selectedIconResId: Int? = null, // Optional with default value
- val unselectedIconResId: Int? = null // Optional with default value
+ val iconResId: Int? = null,
) {
object Home : ScreensForMarkersAndRoutes("home", "Home")
object Markers : ScreensForMarkersAndRoutes(
route = "markers",
title = "Markers",
- selectedIconResId = R.drawable.marker_selected,
- unselectedIconResId = R.drawable.marker_unselected)
+ iconResId = R.drawable.ic_markers,
+ )
object Routes : ScreensForMarkersAndRoutes(
route = "routes",
title = "Routes",
- selectedIconResId = R.drawable.routes_selected,
- unselectedIconResId = R.drawable.routes_unselected)
+ iconResId = R.drawable.ic_routes,
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersAndRoutesScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersAndRoutesScreen.kt
index 6b52b917..d4c87638 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersAndRoutesScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersAndRoutesScreen.kt
@@ -1,6 +1,7 @@
package org.scottishtecharmy.soundscape.screens.markers_routes.screens
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
@@ -10,14 +11,17 @@ import androidx.navigation.NavController
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import org.scottishtecharmy.soundscape.screens.home.HomeRoutes
-import org.scottishtecharmy.soundscape.screens.markers_routes.components.BottomNavigationBar
+import org.scottishtecharmy.soundscape.screens.markers_routes.components.MarkersAndRoutesTabs
import org.scottishtecharmy.soundscape.screens.markers_routes.components.MarkersAndRoutesAppBar
import org.scottishtecharmy.soundscape.screens.markers_routes.navigation.MarkersAndRoutesNavGraph
import org.scottishtecharmy.soundscape.screens.markers_routes.navigation.ScreensForMarkersAndRoutes
import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
@Composable
-fun MarkersAndRoutesScreen(mainNavController: NavController, selectedTab: String?) {
+fun MarkersAndRoutesScreen(
+ mainNavController: NavController,
+ selectedTab: String?
+) {
// Nested navController for the tab navigation inside MarkersAndRoutes
val nestedNavController = rememberNavController()
@@ -27,24 +31,22 @@ fun MarkersAndRoutesScreen(mainNavController: NavController, selectedTab: String
Scaffold(
topBar = {
- MarkersAndRoutesAppBar(
- showAddIcon = showAddIcon,
- onNavigateUp = {
- mainNavController.navigateUp()
- },
- onNavigateToDestination = {
- mainNavController.navigate(HomeRoutes.AddRoute.route)
- },
- )
- },
- bottomBar = {
- BottomNavigationBar(navController = nestedNavController)
- }
+ Column {
+ MarkersAndRoutesAppBar(
+ onNavigateUp = {
+ mainNavController.navigateUp()
+ },
+ )
+ MarkersAndRoutesTabs(navController = nestedNavController)
+ }},
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
// MarkersAndRoutesNavGraph is now responsible for handling navigation
MarkersAndRoutesNavGraph(
navController = nestedNavController,
+ onNavigateToAddRoute = {
+ mainNavController.navigate(HomeRoutes.AddRoute.route)
+ },
startDestination = selectedTab ?: ScreensForMarkersAndRoutes.Markers.route
)
}
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersScreen.kt
index 71ca4f50..835c7574 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/MarkersScreen.kt
@@ -1,6 +1,5 @@
package org.scottishtecharmy.soundscape.screens.markers_routes.screens
-import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -9,6 +8,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -35,11 +35,12 @@ fun MarkersScreen(navController: NavController) {
verticalArrangement = Arrangement.Center
) {
Box(modifier = Modifier.padding(top = 40.dp)) {
- Image(
+ Icon(
painter = painterResource(
- id = R.drawable.marker_selected
+ id = R.drawable.ic_markers
),
- contentDescription = "marker icon",
+ tint = MaterialTheme.colorScheme.onBackground,
+ contentDescription = null,
modifier = Modifier.size(60.dp)
)
}
@@ -47,6 +48,7 @@ fun MarkersScreen(navController: NavController) {
Text(
stringResource(R.string.markers_no_markers_title),
style = MaterialTheme.typography.titleLarge,
+ color = MaterialTheme.colorScheme.onBackground,
textAlign = TextAlign.Center,
fontWeight = FontWeight.Bold,
)
@@ -55,6 +57,7 @@ fun MarkersScreen(navController: NavController) {
Text(
stringResource(R.string.markers_no_markers_hint_1),
style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onBackground,
textAlign = TextAlign.Center,
fontWeight = FontWeight.Bold,
)
@@ -63,6 +66,7 @@ fun MarkersScreen(navController: NavController) {
Text(
stringResource(R.string.markers_no_markers_hint_2),
style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onBackground,
textAlign = TextAlign.Center,
fontWeight = FontWeight.Bold,
)
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/RoutesScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/RoutesScreen.kt
index e832f366..70f26317 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/RoutesScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/RoutesScreen.kt
@@ -1,7 +1,5 @@
package org.scottishtecharmy.soundscape.screens.markers_routes.marker_route_screens
-import androidx.compose.foundation.Image
-import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
@@ -9,6 +7,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.rounded.AddCircleOutline
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -16,7 +18,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@@ -27,45 +29,66 @@ import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
@Composable
-fun RoutesScreen(navController: NavController) {
+fun RoutesScreen(
+ navController: NavController,
+ onNavigateToAddRoute: () -> Unit,
+) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.Center
) {
- Box(modifier = Modifier.padding(top = 40.dp)) {
- Image(
- painter = painterResource(
- id = R.drawable.routes_selected
- ),
- contentDescription = "marker icon",
- modifier = Modifier.size(80.dp)
- )
- }
- Box(modifier = Modifier.padding(top = 10.dp)) {
- Text(
- stringResource(R.string.routes_no_routes_title),
- style = MaterialTheme.typography.titleLarge,
- textAlign = TextAlign.Center,
- fontWeight = FontWeight.Bold,
- )
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ modifier = Modifier.semantics(mergeDescendants = true) {}
+ ) {
+ Box(modifier = Modifier.padding(top = 40.dp)) {
+ Icon(
+ painter = painterResource(
+ id = R.drawable.ic_routes
+ ),
+ tint = MaterialTheme.colorScheme.onPrimary,
+ contentDescription = null,
+ modifier = Modifier.size(80.dp)
+ )
+ }
+ Box(modifier = Modifier.padding(top = 10.dp)) {
+ Text(
+ stringResource(R.string.routes_no_routes_title),
+ style = MaterialTheme.typography.titleLarge,
+ color = MaterialTheme.colorScheme.onBackground,
+ textAlign = TextAlign.Center,
+ )
+ }
+ Box(modifier = Modifier.padding(top = 10.dp)) {
+ Text(
+ stringResource(R.string.routes_no_routes_hint_1),
+ color = MaterialTheme.colorScheme.onBackground,
+ style = MaterialTheme.typography.bodyMedium,
+ textAlign = TextAlign.Center,
+ )
+ }
+ Box(modifier = Modifier.padding(top = 10.dp, bottom = 40.dp)) {
+ Text(
+ stringResource(R.string.routes_no_routes_hint_2),
+ color = MaterialTheme.colorScheme.onBackground,
+ style = MaterialTheme.typography.bodyMedium,
+ textAlign = TextAlign.Center,
+ )
+ }
}
- Box(modifier = Modifier.padding(top = 10.dp)) {
- Text(
- stringResource(R.string.routes_no_routes_hint_1),
- style = MaterialTheme.typography.bodyMedium,
- textAlign = TextAlign.Center,
- fontWeight = FontWeight.Bold,
- )
- }
- Box(modifier = Modifier.padding(top = 10.dp, bottom = 40.dp)) {
- Text(
- stringResource(R.string.routes_no_routes_hint_2),
- style = MaterialTheme.typography.bodyMedium,
- textAlign = TextAlign.Center,
- fontWeight = FontWeight.Bold,
+ IconButton(
+ onClick = {
+ onNavigateToAddRoute.invoke()
+ },
+ modifier = Modifier.size(90.dp)
+ ){
+ Icon(
+ Icons.Rounded.AddCircleOutline,
+ tint = MaterialTheme.colorScheme.onBackground,
+ contentDescription = stringResource(R.string.general_alert_add),
+ modifier = Modifier.size(80.dp)
)
}
}
@@ -75,6 +98,9 @@ fun RoutesScreen(navController: NavController) {
@Composable
fun RoutesScreenPreview() {
SoundscapeTheme {
- RoutesScreen(navController = rememberNavController())
+ RoutesScreen(
+ navController = rememberNavController(),
+ onNavigateToAddRoute = {}
+ )
}
}
\ No newline at end of file
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/addroute/AddRouteScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/addroute/AddRouteScreen.kt
index 012dfa30..f706cc18 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/addroute/AddRouteScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/markers_routes/screens/addroute/AddRouteScreen.kt
@@ -31,7 +31,7 @@ import org.scottishtecharmy.soundscape.R
import org.scottishtecharmy.soundscape.screens.home.HomeRoutes
import org.scottishtecharmy.soundscape.screens.markers_routes.components.CustomAppBar
import org.scottishtecharmy.soundscape.screens.markers_routes.components.CustomButton
-import org.scottishtecharmy.soundscape.screens.markers_routes.components.CustomTextField
+import org.scottishtecharmy.soundscape.screens.markers_routes.components.TextFieldWithLabel
import org.scottishtecharmy.soundscape.ui.theme.SoundscapeTheme
@Composable
@@ -77,26 +77,16 @@ fun AddRouteScreen(
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.fillMaxWidth().padding(top = 15.dp),
)
- Text(
- modifier = Modifier.padding(top = 20.dp, bottom = 5.dp),
- text = stringResource(R.string.markers_sort_button_sort_by_name),
- style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.surfaceBright
- )
- CustomTextField(
- modifier = Modifier.fillMaxWidth(),
+ TextFieldWithLabel(
+ modifier = Modifier.fillMaxWidth().padding(top = 20.dp, bottom = 5.dp),
value = uiState.name,
+ label = stringResource(R.string.markers_sort_button_sort_by_name),
onValueChange = { newText -> viewModel.onNameChange(newText) },
)
- Text(
- modifier = Modifier.padding(top = 20.dp, bottom = 5.dp),
- text = stringResource(R.string.route_detail_edit_description),
- style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.surfaceBright
- )
- CustomTextField(
- modifier = Modifier.fillMaxWidth(),
+ TextFieldWithLabel(
+ modifier = Modifier.fillMaxWidth().padding(top = 20.dp, bottom = 5.dp),
value = uiState.description,
+ label = stringResource(R.string.route_detail_edit_description),
onValueChange = { newText -> viewModel.onDescriptionChange(newText) },
)
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/OnboardingNavGraph.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/OnboardingNavGraph.kt
index cfbec83c..c91be6f1 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/OnboardingNavGraph.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/OnboardingNavGraph.kt
@@ -41,7 +41,9 @@ fun SetUpOnboardingNavGraph(
AudioBeaconsScreen(onNavigate = { navController.navigate(OnboardingScreens.Terms.route) })
}
composable(OnboardingScreens.Terms.route) {
- TermsScreen(onNavigate = { navController.navigate(OnboardingScreens.Finish.route) })
+ TermsScreen(onNavigate = {
+ navController.navigate(OnboardingScreens.Finish.route)
+ })
}
composable(OnboardingScreens.Finish.route) {
FinishScreen(
diff --git a/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/terms/TermsScreen.kt b/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/terms/TermsScreen.kt
index affcac08..773946c9 100644
--- a/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/terms/TermsScreen.kt
+++ b/app/src/main/java/org/scottishtecharmy/soundscape/screens/onboarding/terms/TermsScreen.kt
@@ -1,7 +1,6 @@
package org.scottishtecharmy.soundscape.screens.onboarding.terms
import androidx.compose.foundation.background
-import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -110,7 +109,6 @@ fun TermsScreen(
)
)
Text(
- modifier = Modifier.clickable { checkedState.value = !checkedState.value },
text = stringResource(R.string.terms_of_use_accept_checkbox_acc_label),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onPrimary
diff --git a/app/src/main/res/drawable/ic_markers.xml b/app/src/main/res/drawable/ic_markers.xml
new file mode 100644
index 00000000..1bee3c41
--- /dev/null
+++ b/app/src/main/res/drawable/ic_markers.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_routes.xml b/app/src/main/res/drawable/ic_routes.xml
new file mode 100644
index 00000000..531b3965
--- /dev/null
+++ b/app/src/main/res/drawable/ic_routes.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/marker_selected.png b/app/src/main/res/drawable/marker_selected.png
deleted file mode 100644
index 913b0ea3..00000000
Binary files a/app/src/main/res/drawable/marker_selected.png and /dev/null differ
diff --git a/app/src/main/res/drawable/marker_unselected.png b/app/src/main/res/drawable/marker_unselected.png
deleted file mode 100644
index ea1684e0..00000000
Binary files a/app/src/main/res/drawable/marker_unselected.png and /dev/null differ
diff --git a/app/src/main/res/drawable/preview_off.xml b/app/src/main/res/drawable/preview_off.xml
new file mode 100644
index 00000000..0f0931df
--- /dev/null
+++ b/app/src/main/res/drawable/preview_off.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/routes_selected.png b/app/src/main/res/drawable/routes_selected.png
deleted file mode 100644
index dde60b48..00000000
Binary files a/app/src/main/res/drawable/routes_selected.png and /dev/null differ
diff --git a/app/src/main/res/drawable/routes_unselected.png b/app/src/main/res/drawable/routes_unselected.png
deleted file mode 100644
index 699b1d87..00000000
Binary files a/app/src/main/res/drawable/routes_unselected.png and /dev/null differ
diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml
index dbc109e7..be7fe623 100644
--- a/app/src/main/res/values-da/strings.xml
+++ b/app/src/main/res/values-da/strings.xml
@@ -184,5 +184,7 @@
Busstoppested
%1$s meter
Ingen sprog valgt
+ Gadevisning aktiveret
+ Gadevisning deaktiveret
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index b5a73179..a7f43840 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -183,5 +183,7 @@
Bushaltestelle
%1$s Meter
Keine Sprache ausgewählt
+ Straßenansicht aktiviert
+ Straßenansicht deaktiviert
\ No newline at end of file
diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml
index c76e7a4c..7c370aa8 100644
--- a/app/src/main/res/values-el/strings.xml
+++ b/app/src/main/res/values-el/strings.xml
@@ -184,5 +184,8 @@
Στάση
%1$s μέτρα
Δεν επιλέχθηκε γλώσσα
+ Η προεπισκόπηση δρόμου ενεργοποιήθηκε
+ Η προεπισκόπηση δρόμου απενεργοποιήθηκε
+
\ No newline at end of file
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index f47edbdb..fbf59223 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -183,5 +183,7 @@
Parada de autobús
%1$s metros
Ningún idioma seleccionado
+ Vista previa de la calle activada
+ Vista previa de la calle desactivada
\ No newline at end of file
diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml
index 4817b18b..b02be2a0 100644
--- a/app/src/main/res/values-fi/strings.xml
+++ b/app/src/main/res/values-fi/strings.xml
@@ -184,5 +184,7 @@
Linja-autopysäkki
%1$s metriä
Ei kieltä valittu
+ Kadun esikatselu käytössä
+ Kadun esikatselu pois käytöstä
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index bfe1b41f..bedff742 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -183,5 +183,7 @@
Arrêt de bus
%1$s mètres
Aucune langue sélectionnée
+ Aperçu de la rue activé
+ Aperçu de la rue désactivé
\ No newline at end of file
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index ea942a4b..ff1221f9 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -182,5 +182,7 @@
Fermata dell\'autobus
%1$s metri
Nessuna lingua selezionata
+ Anteprima strada attivata
+ Anteprima strada disattivata
\ No newline at end of file
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index ba8e9e32..942186eb 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -184,5 +184,7 @@
バス停
%1$s メートル
言語が選択されていません
+ ストリートプレビューが有効になっています
+ ストリートプレビューが無効になっています
\ No newline at end of file
diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml
index 019b3465..cf77b008 100644
--- a/app/src/main/res/values-nb/strings.xml
+++ b/app/src/main/res/values-nb/strings.xml
@@ -183,5 +183,8 @@
Busstopp
%1$s meter
Ingen språk valgt
+ Gateforhåndsvisning aktivert
+ Gateforhåndsvisning deaktivert
+
\ No newline at end of file
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index cf7969f9..41c07a29 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -184,5 +184,8 @@
Bushalte
%1$s meter
Geen taal geselecteerd
+ Straatvoorvertoning ingeschakeld
+ Straatvoorvertoning uitgeschakeld
+
\ No newline at end of file
diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml
index 3979c4dd..177ec8c0 100644
--- a/app/src/main/res/values-pt/strings.xml
+++ b/app/src/main/res/values-pt/strings.xml
@@ -184,5 +184,8 @@
Ponto de Ônibus
%1$s metros
Nenhum idioma selecionado
+ Visualização de rua ativada
+ Visualização de rua desativada
+
\ No newline at end of file
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
index ef034008..d43775ae 100644
--- a/app/src/main/res/values-sv/strings.xml
+++ b/app/src/main/res/values-sv/strings.xml
@@ -183,5 +183,7 @@
Busshållplats
%1$s meter
Inget språk valt
+ Gatuvy förhandsgranskning aktiverad
+ Gatuvy förhandsgranskning inaktiverad
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1d06bc85..ca072b5e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -53,13 +53,13 @@
Markers & Routes
Hear My Surroundings
- My\nLocation
+ My Location
What\'s My Location?
- Around\nMe
+ Around Me
What\'s Around Me?
- Ahead\nof Me
+ Ahead of Me
What\'s Ahead of Me?
- Nearby\nMarkers
+ Nearby Markers
Hear Markers Nearby
Yes
@@ -193,6 +193,8 @@
Soundscape uses notifications to let you know if it is currently working. Soundscape will work without this permission.
Background Location Permission
To allow Soundscape to work in the background, the app needs access to background location services.
+ Street Preview enabled
+ Street Preview disabled
\ No newline at end of file