diff --git a/app/src/main/java/com/geeksville/mesh/ui/Main.kt b/app/src/main/java/com/geeksville/mesh/ui/Main.kt index f5a6dcb6c..21ad5dcef 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/Main.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/Main.kt @@ -36,6 +36,7 @@ import androidx.compose.material.icons.twotone.People import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -357,7 +358,7 @@ enum class MainMenuAction(@StringRes val stringRes: Int) { ABOUT(R.string.about), } -@OptIn(ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class) @Suppress("LongMethod") @Composable private fun MainAppBar( @@ -381,10 +382,7 @@ private fun MainAppBar( TopAppBar( title = { val title = when { - currentDestination == null -> stringResource(id = R.string.app_name) - - currentDestination.hasRoute() -> stringResource(id = R.string.app_name) + - " ($onlineNodeCount/$totalNodeCount)" + currentDestination == null || isTopLevelRoute -> stringResource(id = R.string.app_name) currentDestination.hasRoute() -> stringResource(id = R.string.debug_panel) @@ -403,6 +401,17 @@ private fun MainAppBar( style = MaterialTheme.typography.titleLarge, ) }, + subtitle = { + if (currentDestination?.hasRoute() == true) { + Text( + text = stringResource( + R.string.node_count_template, + onlineNodeCount, + totalNodeCount + ), + ) + } + }, modifier = modifier, navigationIcon = if (canNavigateBack && !isTopLevelRoute) { { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8fef33c12..fa7875796 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -694,4 +694,5 @@ Exports public and private keys to a file. Please store somewhere securely. Modules unlocked Remote + (%1$d online / %2$d total)