From 6d7a67aff2c73bcbed9809783e3e81ae0c58a507 Mon Sep 17 00:00:00 2001 From: Erik Eelde Date: Sat, 30 Sep 2023 16:02:49 +0200 Subject: [PATCH] Tidy up --- modules/booleanconfiguration/build.gradle.kts | 1 + .../booleanconfiguration/BooleanValueView.kt | 47 +++++- .../se/eelde/toggles/composetheme/AppState.kt | 41 ----- modules/enumconfiguration/build.gradle.kts | 1 + .../enumconfiguration/EnumValueView.kt | 44 ++++++ .../java/se/eelde/toggles/help/HelpView.kt | 36 ++++- modules/help/src/main/res/values/strings.xml | 4 + modules/integerconfiguration/build.gradle.kts | 3 +- .../integerconfiguration/IntegerValueView.kt | 47 +++++- modules/stringconfiguration/build.gradle.kts | 1 + .../stringconfiguration/StringValueView.kt | 47 +++++- .../java/se/eelde/toggles/MainActivity.kt | 144 +----------------- .../java/com/example/toggles/MainActivity.kt | 2 - 13 files changed, 229 insertions(+), 189 deletions(-) delete mode 100644 modules/compose-theme/src/main/java/se/eelde/toggles/composetheme/AppState.kt create mode 100644 modules/help/src/main/res/values/strings.xml diff --git a/modules/booleanconfiguration/build.gradle.kts b/modules/booleanconfiguration/build.gradle.kts index d9d37f39..c7dcd7cc 100644 --- a/modules/booleanconfiguration/build.gradle.kts +++ b/modules/booleanconfiguration/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.navigation.navigation.compose) implementation(libs.androidx.hilt.hilt.navigation.compose) + implementation(libs.androidx.lifecycle.lifecycle.runtime.compose) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.material3) debugImplementation(libs.androidx.compose.ui.ui.tooling) diff --git a/modules/booleanconfiguration/src/main/java/se/eelde/toggles/booleanconfiguration/BooleanValueView.kt b/modules/booleanconfiguration/src/main/java/se/eelde/toggles/booleanconfiguration/BooleanValueView.kt index 369635a4..d2bf80dc 100644 --- a/modules/booleanconfiguration/src/main/java/se/eelde/toggles/booleanconfiguration/BooleanValueView.kt +++ b/modules/booleanconfiguration/src/main/java/se/eelde/toggles/booleanconfiguration/BooleanValueView.kt @@ -5,21 +5,64 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Button +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Switch import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment.Companion.End import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch - +@OptIn(ExperimentalMaterial3Api::class) @Composable -@Suppress("LongParameterList") fun BooleanValueView( + modifier: Modifier = Modifier, + viewModel: FragmentBooleanValueViewModel = hiltViewModel(), + back: () -> Unit, +) { + val viewState by viewModel.state.collectAsStateWithLifecycle() + Scaffold( + topBar = { + TopAppBar( + title = { Text("") }, + navigationIcon = + { + IconButton(onClick = { back() }) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = null + ) + } + } + ) + }, + ) { paddingValues -> + BooleanValueView( + uiState = viewState, + popBackStack = { back() }, + revert = { viewModel.revertClick() }, + save = { viewModel.saveClick() }, + setBooleanValue = { viewModel.checkedChanged(it) }, + modifier = modifier.padding(paddingValues), + ) + } +} +@Composable +@Suppress("LongParameterList") +internal fun BooleanValueView( uiState: ViewState, popBackStack: () -> Unit, setBooleanValue: (Boolean) -> Unit, diff --git a/modules/compose-theme/src/main/java/se/eelde/toggles/composetheme/AppState.kt b/modules/compose-theme/src/main/java/se/eelde/toggles/composetheme/AppState.kt deleted file mode 100644 index 261835b7..00000000 --- a/modules/compose-theme/src/main/java/se/eelde/toggles/composetheme/AppState.kt +++ /dev/null @@ -1,41 +0,0 @@ -package se.eelde.toggles.composetheme - -import androidx.compose.foundation.layout.RowScope -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember -import androidx.navigation.NavDestination -import androidx.navigation.NavHostController -import androidx.navigation.compose.currentBackStackEntryAsState -import androidx.navigation.compose.rememberNavController - -@Composable -fun rememberAppState( - navController: NavHostController = rememberNavController(), -): AppState { - return remember(navController) { - AppState(navController) - } -} - -data class AppBarState( - val title: String = "", - val actions: (@Composable RowScope.() -> Unit)? = null -) - -class AppState constructor( - private val navController: NavHostController, -) { - val currentDestination: NavDestination? - @Composable get() = navController - .currentBackStackEntryAsState().value?.destination - - val isRootDestination: Boolean - @Composable get() = when (currentDestination?.route) { - "applications" -> true - "help" -> true - "oss" -> true - else -> false - } - fun navigateUp() = navController.navigateUp() -} diff --git a/modules/enumconfiguration/build.gradle.kts b/modules/enumconfiguration/build.gradle.kts index d9d37f39..c7dcd7cc 100644 --- a/modules/enumconfiguration/build.gradle.kts +++ b/modules/enumconfiguration/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.navigation.navigation.compose) implementation(libs.androidx.hilt.hilt.navigation.compose) + implementation(libs.androidx.lifecycle.lifecycle.runtime.compose) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.material3) debugImplementation(libs.androidx.compose.ui.ui.tooling) diff --git a/modules/enumconfiguration/src/main/java/se/eelde/toggles/enumconfiguration/EnumValueView.kt b/modules/enumconfiguration/src/main/java/se/eelde/toggles/enumconfiguration/EnumValueView.kt index 1e9ec425..30300dad 100644 --- a/modules/enumconfiguration/src/main/java/se/eelde/toggles/enumconfiguration/EnumValueView.kt +++ b/modules/enumconfiguration/src/main/java/se/eelde/toggles/enumconfiguration/EnumValueView.kt @@ -7,19 +7,63 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Button +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch +@OptIn(ExperimentalMaterial3Api::class) @Composable fun EnumValueView( + modifier: Modifier = Modifier, + viewModel: FragmentEnumValueViewModel = hiltViewModel(), + back: () -> Unit, +) { + val viewState by viewModel.state.collectAsStateWithLifecycle() + Scaffold( + topBar = { + TopAppBar( + title = { Text("") }, + navigationIcon = + { + IconButton(onClick = { back() }) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = null + ) + } + } + ) + }, + ) { paddingValues -> + EnumValueView( + state = viewState, + setEnumValue = { viewModel.saveClick(it) }, + revert = { viewModel.revertClick() }, + popBackStack = { back() }, + modifier = modifier.padding(paddingValues) + ) + } +} + +@Composable +internal fun EnumValueView( state: ViewState, setEnumValue: suspend (String) -> Unit, revert: suspend () -> Unit, diff --git a/modules/help/src/main/java/se/eelde/toggles/help/HelpView.kt b/modules/help/src/main/java/se/eelde/toggles/help/HelpView.kt index 728774f8..7d54679a 100644 --- a/modules/help/src/main/java/se/eelde/toggles/help/HelpView.kt +++ b/modules/help/src/main/java/se/eelde/toggles/help/HelpView.kt @@ -2,14 +2,44 @@ package se.eelde.toggles.help import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Scaffold import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource +@OptIn(ExperimentalMaterial3Api::class) @Composable -fun HelpView(modifier: Modifier = Modifier) { - Box(modifier.fillMaxSize()) { - Text(text = "Implementation", color = Color.White) +fun HelpView(modifier: Modifier = Modifier, back: () -> Unit) { + Scaffold( + topBar = { + TopAppBar( + title = { Text(stringResource(id = R.string.help)) }, + navigationIcon = + { + IconButton(onClick = { back() }) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = null + ) + } + } + ) + }, + ) { paddingValues -> + Box( + modifier + .fillMaxSize() + .padding(paddingValues)) { + Text(text = "Implementation", color = Color.White) + } } } diff --git a/modules/help/src/main/res/values/strings.xml b/modules/help/src/main/res/values/strings.xml new file mode 100644 index 00000000..190d4ef5 --- /dev/null +++ b/modules/help/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Help + \ No newline at end of file diff --git a/modules/integerconfiguration/build.gradle.kts b/modules/integerconfiguration/build.gradle.kts index d9d37f39..0ed1d402 100644 --- a/modules/integerconfiguration/build.gradle.kts +++ b/modules/integerconfiguration/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } android { - namespace = "se.eelde.toggles.booleanconfiguration" + namespace = "se.eelde.toggles.integerconfiguration" buildFeatures { compose = true } @@ -23,6 +23,7 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.navigation.navigation.compose) implementation(libs.androidx.hilt.hilt.navigation.compose) + implementation(libs.androidx.lifecycle.lifecycle.runtime.compose) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.material3) debugImplementation(libs.androidx.compose.ui.ui.tooling) diff --git a/modules/integerconfiguration/src/main/java/se/eelde/toggles/integerconfiguration/IntegerValueView.kt b/modules/integerconfiguration/src/main/java/se/eelde/toggles/integerconfiguration/IntegerValueView.kt index e8b41737..055947bc 100644 --- a/modules/integerconfiguration/src/main/java/se/eelde/toggles/integerconfiguration/IntegerValueView.kt +++ b/modules/integerconfiguration/src/main/java/se/eelde/toggles/integerconfiguration/IntegerValueView.kt @@ -6,17 +6,27 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Button +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch @Preview @@ -31,9 +41,44 @@ fun IntegerValueViewPreview() { ) } +@OptIn(ExperimentalMaterial3Api::class) @Composable -@Suppress("LongParameterList") fun IntegerValueView( + modifier: Modifier = Modifier, + viewModel: FragmentIntegerValueViewModel = hiltViewModel(), + back: () -> Unit, +) { + val viewState by viewModel.state.collectAsStateWithLifecycle() + Scaffold( + topBar = { + TopAppBar( + title = { Text("") }, + navigationIcon = + { + IconButton(onClick = { back() }) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = null + ) + } + } + ) + }, + ) { paddingValues -> + IntegerValueView( + uiState = viewState, + popBackStack = { back() }, + revert = { viewModel.revertClick() }, + save = { viewModel.saveClick() }, + setIntegerValue = { viewModel.setIntegerValue(it) }, + modifier = Modifier.padding(paddingValues), + ) + } +} + +@Composable +@Suppress("LongParameterList") +internal fun IntegerValueView( uiState: ViewState, popBackStack: () -> Unit, revert: suspend () -> Unit, diff --git a/modules/stringconfiguration/build.gradle.kts b/modules/stringconfiguration/build.gradle.kts index d9d37f39..c7dcd7cc 100644 --- a/modules/stringconfiguration/build.gradle.kts +++ b/modules/stringconfiguration/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.navigation.navigation.compose) implementation(libs.androidx.hilt.hilt.navigation.compose) + implementation(libs.androidx.lifecycle.lifecycle.runtime.compose) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.material3) debugImplementation(libs.androidx.compose.ui.ui.tooling) diff --git a/modules/stringconfiguration/src/main/java/se/eelde/toggles/stringconfiguration/StringValueView.kt b/modules/stringconfiguration/src/main/java/se/eelde/toggles/stringconfiguration/StringValueView.kt index 70460281..79bb5b27 100644 --- a/modules/stringconfiguration/src/main/java/se/eelde/toggles/stringconfiguration/StringValueView.kt +++ b/modules/stringconfiguration/src/main/java/se/eelde/toggles/stringconfiguration/StringValueView.kt @@ -5,16 +5,26 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Button +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch import se.eelde.toggles.composetheme.TogglesTheme @@ -32,9 +42,44 @@ fun StringValueViewPreview() { } } +@OptIn(ExperimentalMaterial3Api::class) @Composable -@Suppress("LongParameterList") fun StringValueView( + modifier: Modifier = Modifier, + viewModel: FragmentStringValueViewModel = hiltViewModel(), + back: () -> Unit, +) { + val viewState by viewModel.state.collectAsStateWithLifecycle() + Scaffold( + topBar = { + TopAppBar( + title = { Text("") }, + navigationIcon = + { + IconButton(onClick = { back() }) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = null + ) + } + } + ) + }, + ) { paddingValues -> + StringValueView( + state = viewState, + popBackStack = { back() }, + revert = { viewModel.revertClick() }, + save = { viewModel.saveClick() }, + setStringValue = { viewModel.setStringValue(it) }, + modifier = modifier.padding(paddingValues), + ) + } +} + +@Composable +@Suppress("LongParameterList") +internal fun StringValueView( state: ViewState, setStringValue: (String) -> Unit, save: suspend () -> Unit, diff --git a/toggles-app/src/main/java/se/eelde/toggles/MainActivity.kt b/toggles-app/src/main/java/se/eelde/toggles/MainActivity.kt index f6058a77..fd7215aa 100644 --- a/toggles-app/src/main/java/se/eelde/toggles/MainActivity.kt +++ b/toggles-app/src/main/java/se/eelde/toggles/MainActivity.kt @@ -1,7 +1,6 @@ package se.eelde.toggles import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.padding @@ -15,8 +14,6 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavHostController import androidx.navigation.NavType import androidx.navigation.compose.NavHost @@ -26,16 +23,12 @@ import androidx.navigation.navArgument import dagger.hilt.android.AndroidEntryPoint import se.eelde.toggles.applications.applicationNavigations import se.eelde.toggles.booleanconfiguration.BooleanValueView -import se.eelde.toggles.booleanconfiguration.FragmentBooleanValueViewModel import se.eelde.toggles.composetheme.TogglesTheme -import se.eelde.toggles.composetheme.rememberAppState import se.eelde.toggles.configurations.configurationsNavigations import se.eelde.toggles.enumconfiguration.EnumValueView -import se.eelde.toggles.enumconfiguration.FragmentEnumValueViewModel -import se.eelde.toggles.integerconfiguration.FragmentIntegerValueViewModel +import se.eelde.toggles.help.HelpView import se.eelde.toggles.integerconfiguration.IntegerValueView import se.eelde.toggles.oss.OssView -import se.eelde.toggles.stringconfiguration.FragmentStringValueViewModel import se.eelde.toggles.stringconfiguration.StringValueView @OptIn(ExperimentalMaterial3Api::class) @@ -79,34 +72,7 @@ fun Navigation( navArgument("scopeId") { type = NavType.LongType } ) ) { - val viewModel: FragmentBooleanValueViewModel = hiltViewModel() - val state = viewModel.state.collectAsStateWithLifecycle().value - - Scaffold( - topBar = { - TopAppBar( - title = { Text("") }, - navigationIcon = - { - IconButton(onClick = { navController.popBackStack() }) { - Icon( - imageVector = Icons.Filled.ArrowBack, - contentDescription = null - ) - } - } - ) - }, - ) { paddingValues -> - BooleanValueView( - uiState = state, - popBackStack = { navController.popBackStack() }, - revert = { viewModel.revertClick() }, - save = { viewModel.saveClick() }, - setBooleanValue = { viewModel.checkedChanged(it) }, - modifier = Modifier.padding(paddingValues), - ) - } + BooleanValueView { navController.popBackStack() } } composable( "configuration/{configurationId}/{scopeId}/integer", @@ -115,34 +81,7 @@ fun Navigation( navArgument("scopeId") { type = NavType.LongType } ) ) { - val viewModel: FragmentIntegerValueViewModel = hiltViewModel() - val state = viewModel.state.collectAsStateWithLifecycle().value - - Scaffold( - topBar = { - TopAppBar( - title = { Text("") }, - navigationIcon = - { - IconButton(onClick = { navController.popBackStack() }) { - Icon( - imageVector = Icons.Filled.ArrowBack, - contentDescription = null - ) - } - } - ) - }, - ) { paddingValues -> - IntegerValueView( - uiState = state, - popBackStack = { navController.popBackStack() }, - revert = { viewModel.revertClick() }, - save = { viewModel.saveClick() }, - setIntegerValue = { viewModel.setIntegerValue(it) }, - modifier = Modifier.padding(paddingValues), - ) - } + IntegerValueView { navController.popBackStack() } } composable( "configuration/{configurationId}/{scopeId}/string", @@ -151,34 +90,7 @@ fun Navigation( navArgument("scopeId") { type = NavType.LongType } ) ) { - val viewModel: FragmentStringValueViewModel = hiltViewModel() - val state = viewModel.state.collectAsStateWithLifecycle().value - - Scaffold( - topBar = { - TopAppBar( - title = { Text("") }, - navigationIcon = - { - IconButton(onClick = { navController.popBackStack() }) { - Icon( - imageVector = Icons.Filled.ArrowBack, - contentDescription = null - ) - } - } - ) - }, - ) { paddingValues -> - StringValueView( - state = state, - popBackStack = { navController.popBackStack() }, - revert = { viewModel.revertClick() }, - save = { viewModel.saveClick() }, - setStringValue = { viewModel.setStringValue(it) }, - modifier = Modifier.padding(paddingValues), - ) - } + StringValueView { navController.popBackStack() } } composable( "configuration/{configurationId}/{scopeId}/enum", @@ -187,32 +99,7 @@ fun Navigation( navArgument("scopeId") { type = NavType.LongType } ) ) { - val viewModel: FragmentEnumValueViewModel = hiltViewModel() - val state = viewModel.state.collectAsStateWithLifecycle().value - Scaffold( - topBar = { - TopAppBar( - title = { Text("") }, - navigationIcon = - { - IconButton(onClick = { navController.popBackStack() }) { - Icon( - imageVector = Icons.Filled.ArrowBack, - contentDescription = null - ) - } - } - ) - }, - ) { paddingValues -> - EnumValueView( - state = state, - popBackStack = { navController.popBackStack() }, - revert = { viewModel.revertClick() }, - setEnumValue = { viewModel.saveClick(it) }, - modifier = Modifier.padding(paddingValues), - ) - } + EnumValueView { navController.popBackStack() } } composable( "oss", @@ -239,24 +126,7 @@ fun Navigation( composable( "help", ) { - Scaffold( - topBar = { - TopAppBar( - title = { Text("") }, - navigationIcon = - { - IconButton(onClick = { navController.popBackStack() }) { - Icon( - imageVector = Icons.Filled.ArrowBack, - contentDescription = null - ) - } - } - ) - }, - ) { paddingValues -> - se.eelde.toggles.help.HelpView(modifier = Modifier.padding(paddingValues)) - } + HelpView { navController.popBackStack() } } } } @@ -270,8 +140,6 @@ class MainActivity : ComponentActivity() { setContent { TogglesTheme { val navController: NavHostController = rememberNavController() - val appState = rememberAppState(navController) - Log.e("appState", "current destination: ${appState.currentDestination}") Navigation(navController = navController) } diff --git a/toggles-sample/src/main/java/com/example/toggles/MainActivity.kt b/toggles-sample/src/main/java/com/example/toggles/MainActivity.kt index 584d03b1..5e10107e 100644 --- a/toggles-sample/src/main/java/com/example/toggles/MainActivity.kt +++ b/toggles-sample/src/main/java/com/example/toggles/MainActivity.kt @@ -38,8 +38,6 @@ class MainActivity : ComponentActivity() { setContent { TogglesTheme { val navController: NavHostController = rememberNavController() - val appState = rememberAppState(navController) - Log.e("appState", "current destination: ${appState.currentDestination}") Navigation(navController = navController) }