From ac9a9803d1672d8834f2c54901921a98c132dce5 Mon Sep 17 00:00:00 2001 From: Yuri Schimke Date: Wed, 20 Dec 2023 14:26:45 +0000 Subject: [PATCH] Cleanup --- .../composeadvanced/presentation/WearApp.kt | 54 ++++++++++++------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/ComposeAdvanced/app/src/main/java/com/example/android/wearable/composeadvanced/presentation/WearApp.kt b/ComposeAdvanced/app/src/main/java/com/example/android/wearable/composeadvanced/presentation/WearApp.kt index cc19443cc..c46805f5e 100644 --- a/ComposeAdvanced/app/src/main/java/com/example/android/wearable/composeadvanced/presentation/WearApp.kt +++ b/ComposeAdvanced/app/src/main/java/com/example/android/wearable/composeadvanced/presentation/WearApp.kt @@ -88,17 +88,18 @@ fun WearApp( SwipeDismissableNavHost( modifier = modifier, navController = swipeDismissableNavController, - startDestination = Screen.Landing.route, + startDestination = Screen.Landing.route - ) { + ) { // Main Window composable( - route = Screen.Landing.route, + route = Screen.Landing.route ) { val columnState = rememberColumnState() ScreenScaffold(scrollState = columnState) { - LandingScreen(columnState = columnState, + LandingScreen( + columnState = columnState, onClickWatchList = { swipeDismissableNavController.navigate(Screen.WatchList.route) }, @@ -106,17 +107,19 @@ fun WearApp( onClickProceedingTimeText = { showProceedingTextBeforeTime = !showProceedingTextBeforeTime }, - onNavigate = { swipeDismissableNavController.navigate(it) }) + onNavigate = { swipeDismissableNavController.navigate(it) } + ) } } composable( - route = Screen.UserInputComponents.route, + route = Screen.UserInputComponents.route ) { val columnState = rememberColumnState() ScreenScaffold(scrollState = columnState) { - UserInputComponentsScreen(columnState = columnState, + UserInputComponentsScreen( + columnState = columnState, value = displayValueForUserInput, dateTime = dateTimeForUserInput, onClickStepper = { @@ -133,7 +136,8 @@ fun WearApp( }, onClickDemo24hTimePicker = { swipeDismissableNavController.navigate(Screen.Time24hPicker.route) - }) + } + ) } } @@ -176,17 +180,22 @@ fun WearApp( } } - composable(route = Screen.WatchDetail.route + "/{$WATCH_ID_NAV_ARGUMENT}", - arguments = listOf(navArgument(WATCH_ID_NAV_ARGUMENT) { - type = NavType.IntType - })) { + composable( + route = Screen.WatchDetail.route + "/{$WATCH_ID_NAV_ARGUMENT}", + arguments = listOf( + navArgument(WATCH_ID_NAV_ARGUMENT) { + type = NavType.IntType + } + ) + ) { val watchId: Int = it.arguments!!.getInt(WATCH_ID_NAV_ARGUMENT) val columnState = rememberScrollState() ScreenScaffold(scrollState = columnState) { WatchDetailScreen( - watchId = watchId, scrollState = columnState + watchId = watchId, + scrollState = columnState ) } } @@ -196,7 +205,8 @@ fun WearApp( onDateConfirm = { swipeDismissableNavController.popBackStack() dateTimeForUserInput = it.atTime(dateTimeForUserInput.toLocalTime()) - }, date = dateTimeForUserInput.toLocalDate() + }, + date = dateTimeForUserInput.toLocalDate() ) } @@ -205,7 +215,8 @@ fun WearApp( onTimeConfirm = { swipeDismissableNavController.popBackStack() dateTimeForUserInput = it.atDate(dateTimeForUserInput.toLocalDate()) - }, time = dateTimeForUserInput.toLocalTime() + }, + time = dateTimeForUserInput.toLocalTime() ) } @@ -214,7 +225,8 @@ fun WearApp( onTimeConfirm = { swipeDismissableNavController.popBackStack() dateTimeForUserInput = it.atDate(dateTimeForUserInput.toLocalDate()) - }, time = dateTimeForUserInput.toLocalTime() + }, + time = dateTimeForUserInput.toLocalTime() ) } @@ -228,8 +240,10 @@ fun WearApp( val columnState = rememberColumnState() ScreenScaffold(scrollState = columnState) { - ProgressIndicatorsScreen(columnState = columnState, - onNavigate = { swipeDismissableNavController.navigate(it) }) + ProgressIndicatorsScreen( + columnState = columnState, + onNavigate = { swipeDismissableNavController.navigate(it) } + ) } } @@ -268,7 +282,9 @@ fun WearApp( @Composable internal fun menuNameAndCallback( - onNavigate: (String) -> Unit, menuNameResource: Int, screen: Screen + onNavigate: (String) -> Unit, + menuNameResource: Int, + screen: Screen ) = MenuItem(stringResource(menuNameResource)) { onNavigate(screen.route) } data class MenuItem(val name: String, val clickHander: () -> Unit)