@@ -66,8 +66,8 @@ fun ProModeSetupScreen(viewModel: ProModeSetupViewModel) {
6666
6767 ProModeSetupScreen (
6868 state = state,
69- onStepButtonClick = viewModel::onStepButtonClick ,
70- onAssistantClick = viewModel::onAssistantClick ,
69+ onStepButtonClick = viewModel::onSetupStepButtonClick ,
70+ onAssistantClick = viewModel::onSetupAssistantClick ,
7171 onWatchTutorialClick = { },
7272 onBackClick = viewModel::onBackClick,
7373 )
@@ -128,7 +128,7 @@ fun ProModeSetupScreenContent(
128128 }
129129
130130 is State .Data -> {
131- val stepContent = getStepContent( state.data.step)
131+ val stepContent = state.data.stepContent
132132
133133 // Create animated progress for entrance and updates
134134 val progressAnimatable = remember { Animatable (0f ) }
@@ -331,7 +331,22 @@ private fun AssistantCheckBoxRow(
331331}
332332
333333@Composable
334- private fun getStepContent (step : SystemBridgeSetupStep ): StepContent {
334+ private fun getIconForStep (step : SystemBridgeSetupStep ): ImageVector {
335+ return when (step) {
336+ SystemBridgeSetupStep .ACCESSIBILITY_SERVICE -> Icons .Rounded .Accessibility
337+ SystemBridgeSetupStep .NOTIFICATION_PERMISSION -> Icons .Rounded .Notifications
338+ SystemBridgeSetupStep .DEVELOPER_OPTIONS -> Icons .Rounded .Build
339+ SystemBridgeSetupStep .WIFI_NETWORK -> KeyMapperIcons .SignalWifiNotConnected
340+ SystemBridgeSetupStep .WIRELESS_DEBUGGING -> Icons .Rounded .BugReport
341+ SystemBridgeSetupStep .ADB_PAIRING -> Icons .Rounded .Link
342+ SystemBridgeSetupStep .START_SERVICE -> Icons .Rounded .PlayArrow
343+ SystemBridgeSetupStep .STARTED -> Icons .Rounded .CheckCircleOutline
344+ }
345+ }
346+
347+ @Composable
348+ private fun createPreviewStepContent (step : SystemBridgeSetupStep ): StepContent {
349+ val icon = getIconForStep(step)
335350 return when (step) {
336351 SystemBridgeSetupStep .ACCESSIBILITY_SERVICE -> StepContent (
337352 title = stringResource(
@@ -340,7 +355,7 @@ private fun getStepContent(step: SystemBridgeSetupStep): StepContent {
340355 message = stringResource(
341356 R .string.pro_mode_setup_wizard_enable_accessibility_service_description,
342357 ),
343- icon = Icons . Rounded . Accessibility ,
358+ icon = icon ,
344359 buttonText = stringResource(
345360 R .string.pro_mode_setup_wizard_enable_accessibility_service_button,
346361 ),
@@ -353,7 +368,7 @@ private fun getStepContent(step: SystemBridgeSetupStep): StepContent {
353368 message = stringResource(
354369 R .string.pro_mode_setup_wizard_enable_notification_permission_description,
355370 ),
356- icon = Icons . Rounded . Notifications ,
371+ icon = icon ,
357372 buttonText = stringResource(
358373 R .string.pro_mode_setup_wizard_enable_notification_permission_button,
359374 ),
@@ -364,14 +379,14 @@ private fun getStepContent(step: SystemBridgeSetupStep): StepContent {
364379 message = stringResource(
365380 R .string.pro_mode_setup_wizard_enable_developer_options_description,
366381 ),
367- icon = Icons . Rounded . Build ,
382+ icon = icon ,
368383 buttonText = stringResource(R .string.pro_mode_setup_wizard_go_to_settings_button),
369384 )
370385
371386 SystemBridgeSetupStep .WIFI_NETWORK -> StepContent (
372387 title = stringResource(R .string.pro_mode_setup_wizard_connect_wifi_title),
373388 message = stringResource(R .string.pro_mode_setup_wizard_connect_wifi_description),
374- icon = KeyMapperIcons . SignalWifiNotConnected ,
389+ icon = icon ,
375390 buttonText = stringResource(R .string.pro_mode_setup_wizard_go_to_settings_button),
376391 )
377392
@@ -380,7 +395,7 @@ private fun getStepContent(step: SystemBridgeSetupStep): StepContent {
380395 message = stringResource(
381396 R .string.pro_mode_setup_wizard_enable_wireless_debugging_description,
382397 ),
383- icon = Icons . Rounded . BugReport ,
398+ icon = icon ,
384399 buttonText = stringResource(R .string.pro_mode_setup_wizard_go_to_settings_button),
385400 )
386401
@@ -389,43 +404,38 @@ private fun getStepContent(step: SystemBridgeSetupStep): StepContent {
389404 message = stringResource(
390405 R .string.pro_mode_setup_wizard_pair_wireless_debugging_description,
391406 ),
392- icon = Icons . Rounded . Link ,
407+ icon = icon ,
393408 buttonText = stringResource(R .string.pro_mode_setup_wizard_go_to_settings_button),
394409 )
395410
396411 SystemBridgeSetupStep .START_SERVICE -> StepContent (
397412 title = stringResource(R .string.pro_mode_setup_wizard_start_service_title),
398413 message = stringResource(R .string.pro_mode_setup_wizard_start_service_description),
399- icon = Icons . Rounded . PlayArrow ,
414+ icon = icon ,
400415 buttonText = stringResource(R .string.pro_mode_root_detected_button_start_service),
401416 )
402417
403418 SystemBridgeSetupStep .STARTED -> StepContent (
404419 title = stringResource(R .string.pro_mode_setup_wizard_complete_title),
405420 message = stringResource(R .string.pro_mode_setup_wizard_complete_text),
406- icon = Icons . Rounded . CheckCircleOutline ,
421+ icon = icon ,
407422 buttonText = stringResource(R .string.pro_mode_setup_wizard_complete_button),
408423 )
409424 }
410425}
411426
412- private data class StepContent (
413- val title : String ,
414- val message : String ,
415- val icon : ImageVector ,
416- val buttonText : String ,
417- )
418-
419427@Preview(name = " Accessibility Service Step" )
420428@Composable
421429private fun ProModeSetupScreenAccessibilityServicePreview () {
422430 KeyMapperTheme {
431+ val step = SystemBridgeSetupStep .ACCESSIBILITY_SERVICE
423432 ProModeSetupScreen (
424433 state = State .Data (
425434 ProModeSetupState (
426435 stepNumber = 1 ,
427436 stepCount = 6 ,
428- step = SystemBridgeSetupStep .ACCESSIBILITY_SERVICE ,
437+ step = step,
438+ stepContent = createPreviewStepContent(step),
429439 isSetupAssistantChecked = false ,
430440 isSetupAssistantButtonEnabled = false ,
431441 ),
@@ -438,12 +448,14 @@ private fun ProModeSetupScreenAccessibilityServicePreview() {
438448@Composable
439449private fun ProModeSetupScreenNotificationPermissionPreview () {
440450 KeyMapperTheme {
451+ val step = SystemBridgeSetupStep .NOTIFICATION_PERMISSION
441452 ProModeSetupScreen (
442453 state = State .Data (
443454 ProModeSetupState (
444455 stepNumber = 2 ,
445456 stepCount = 6 ,
446- step = SystemBridgeSetupStep .NOTIFICATION_PERMISSION ,
457+ step = step,
458+ stepContent = createPreviewStepContent(step),
447459 isSetupAssistantChecked = false ,
448460 isSetupAssistantButtonEnabled = true ,
449461 ),
@@ -456,12 +468,14 @@ private fun ProModeSetupScreenNotificationPermissionPreview() {
456468@Composable
457469private fun ProModeSetupScreenDeveloperOptionsPreview () {
458470 KeyMapperTheme {
471+ val step = SystemBridgeSetupStep .DEVELOPER_OPTIONS
459472 ProModeSetupScreen (
460473 state = State .Data (
461474 ProModeSetupState (
462475 stepNumber = 2 ,
463476 stepCount = 6 ,
464- step = SystemBridgeSetupStep .DEVELOPER_OPTIONS ,
477+ step = step,
478+ stepContent = createPreviewStepContent(step),
465479 isSetupAssistantChecked = false ,
466480 isSetupAssistantButtonEnabled = true ,
467481 ),
@@ -474,12 +488,14 @@ private fun ProModeSetupScreenDeveloperOptionsPreview() {
474488@Composable
475489private fun ProModeSetupScreenWifiNetworkPreview () {
476490 KeyMapperTheme {
491+ val step = SystemBridgeSetupStep .WIFI_NETWORK
477492 ProModeSetupScreen (
478493 state = State .Data (
479494 ProModeSetupState (
480495 stepNumber = 3 ,
481496 stepCount = 6 ,
482- step = SystemBridgeSetupStep .WIFI_NETWORK ,
497+ step = step,
498+ stepContent = createPreviewStepContent(step),
483499 isSetupAssistantChecked = false ,
484500 isSetupAssistantButtonEnabled = true ,
485501 ),
@@ -492,12 +508,14 @@ private fun ProModeSetupScreenWifiNetworkPreview() {
492508@Composable
493509private fun ProModeSetupScreenWirelessDebuggingPreview () {
494510 KeyMapperTheme {
511+ val step = SystemBridgeSetupStep .WIRELESS_DEBUGGING
495512 ProModeSetupScreen (
496513 state = State .Data (
497514 ProModeSetupState (
498515 stepNumber = 4 ,
499516 stepCount = 6 ,
500- step = SystemBridgeSetupStep .WIRELESS_DEBUGGING ,
517+ step = step,
518+ stepContent = createPreviewStepContent(step),
501519 isSetupAssistantChecked = false ,
502520 isSetupAssistantButtonEnabled = true ,
503521 ),
@@ -510,12 +528,14 @@ private fun ProModeSetupScreenWirelessDebuggingPreview() {
510528@Composable
511529private fun ProModeSetupScreenAdbPairingPreview () {
512530 KeyMapperTheme {
531+ val step = SystemBridgeSetupStep .ADB_PAIRING
513532 ProModeSetupScreen (
514533 state = State .Data (
515534 ProModeSetupState (
516535 stepNumber = 5 ,
517536 stepCount = 6 ,
518- step = SystemBridgeSetupStep .ADB_PAIRING ,
537+ step = step,
538+ stepContent = createPreviewStepContent(step),
519539 isSetupAssistantChecked = true ,
520540 isSetupAssistantButtonEnabled = true ,
521541 ),
@@ -528,12 +548,14 @@ private fun ProModeSetupScreenAdbPairingPreview() {
528548@Composable
529549private fun ProModeSetupScreenStartServicePreview () {
530550 KeyMapperTheme {
551+ val step = SystemBridgeSetupStep .START_SERVICE
531552 ProModeSetupScreen (
532553 state = State .Data (
533554 ProModeSetupState (
534555 stepNumber = 6 ,
535556 stepCount = 6 ,
536- step = SystemBridgeSetupStep .START_SERVICE ,
557+ step = step,
558+ stepContent = createPreviewStepContent(step),
537559 isSetupAssistantChecked = true ,
538560 isSetupAssistantButtonEnabled = true ,
539561 ),
@@ -546,12 +568,14 @@ private fun ProModeSetupScreenStartServicePreview() {
546568@Composable
547569private fun ProModeSetupScreenStartedPreview () {
548570 KeyMapperTheme {
571+ val step = SystemBridgeSetupStep .STARTED
549572 ProModeSetupScreen (
550573 state = State .Data (
551574 ProModeSetupState (
552575 stepNumber = 8 ,
553576 stepCount = 8 ,
554- step = SystemBridgeSetupStep .STARTED ,
577+ step = step,
578+ stepContent = createPreviewStepContent(step),
555579 isSetupAssistantChecked = true ,
556580 isSetupAssistantButtonEnabled = true ,
557581 ),
0 commit comments