3
3
4
4
package com.tailscale.ipn.ui.view
5
5
6
+ import androidx.compose.foundation.LocalIndication
7
+ import androidx.compose.foundation.clickable
6
8
import androidx.compose.foundation.focusable
7
- import androidx.compose.foundation.layout.Column
9
+ import androidx.compose.foundation.interaction.MutableInteractionSource
8
10
import androidx.compose.foundation.layout.fillMaxSize
9
11
import androidx.compose.foundation.layout.padding
10
- import androidx.compose.foundation.rememberScrollState
12
+ import androidx.compose.foundation.lazy.LazyColumn
13
+ import androidx.compose.foundation.lazy.items
11
14
import androidx.compose.foundation.text.ClickableText
12
- import androidx.compose.foundation.verticalScroll
13
15
import androidx.compose.material3.Icon
14
16
import androidx.compose.material3.ListItem
15
17
import androidx.compose.material3.MaterialTheme
@@ -18,7 +20,9 @@ import androidx.compose.material3.Text
18
20
import androidx.compose.runtime.Composable
19
21
import androidx.compose.runtime.collectAsState
20
22
import androidx.compose.runtime.getValue
23
+ import androidx.compose.runtime.remember
21
24
import androidx.compose.ui.Modifier
25
+ import androidx.compose.ui.focus.onFocusChanged
22
26
import androidx.compose.ui.platform.LocalUriHandler
23
27
import androidx.compose.ui.res.painterResource
24
28
import androidx.compose.ui.res.stringResource
@@ -52,40 +56,44 @@ fun TailnetLockSetupView(
52
56
53
57
Scaffold (topBar = { Header (R .string.tailnet_lock, onBack = backToSettings) }) { innerPadding ->
54
58
LoadingIndicator .Wrap {
55
- Column (
56
- modifier =
57
- Modifier .padding(innerPadding)
58
- .focusable()
59
- .verticalScroll(rememberScrollState())
60
- .fillMaxSize()) {
61
- ExplainerView ()
59
+ LazyColumn (modifier = Modifier .padding(innerPadding).fillMaxSize()) {
60
+ item { ExplainerView () }
62
61
63
- statusItems.forEach { statusItem ->
64
- Lists .ItemDivider ()
62
+ items(statusItems) { statusItem ->
63
+ val interactionSource = remember { MutableInteractionSource () }
64
+ ListItem (
65
+ modifier =
66
+ Modifier .focusable(
67
+ interactionSource = interactionSource)
68
+ .clickable(
69
+ interactionSource = interactionSource,
70
+ indication = LocalIndication .current
71
+ ) {},
72
+ leadingContent = {
73
+ Icon (
74
+ painter = painterResource(id = statusItem.icon),
75
+ contentDescription = null ,
76
+ tint = MaterialTheme .colorScheme.onSurfaceVariant)
77
+ },
78
+ headlineContent = { Text (stringResource(statusItem.title)) })
79
+ }
65
80
66
- ListItem (
67
- leadingContent = {
68
- Icon (
69
- painter = painterResource(id = statusItem.icon),
70
- contentDescription = null ,
71
- tint = MaterialTheme .colorScheme.onSurfaceVariant)
72
- },
73
- headlineContent = { Text (stringResource(statusItem.title)) })
74
- }
75
- // Node key
76
- Lists .SectionDivider ()
77
- ClipboardValueView (
78
- value = nodeKey,
79
- title = stringResource(R .string.node_key),
80
- subtitle = stringResource(R .string.node_key_explainer))
81
+ item {
82
+ // Node key section
83
+ Lists .SectionDivider ()
84
+ ClipboardValueView (
85
+ value = nodeKey,
86
+ title = stringResource(R .string.node_key),
87
+ subtitle = stringResource(R .string.node_key_explainer))
81
88
82
- // Tailnet lock key
83
- Lists .SectionDivider ()
84
- ClipboardValueView (
85
- value = tailnetLockTlPubKey,
86
- title = stringResource(R .string.tailnet_lock_key),
87
- subtitle = stringResource(R .string.tailnet_lock_key_explainer))
88
- }
89
+ // Tailnet lock key section
90
+ Lists .SectionDivider ()
91
+ ClipboardValueView (
92
+ value = tailnetLockTlPubKey,
93
+ title = stringResource(R .string.tailnet_lock_key),
94
+ subtitle = stringResource(R .string.tailnet_lock_key_explainer))
95
+ }
96
+ }
89
97
}
90
98
}
91
99
}
0 commit comments