Skip to content

Commit 77eaadb

Browse files
authored
android: fix missing imports (#486)
android: make clipboard values clickable and focusable also, use Column isntead of LazyColumn since the Tailnet lock view is a short list and doesn't require lazy rendering Fixes tailscale/corp#21737 Signed-off-by: kari-ts <[email protected]> Signed-off-by: kari-ts <[email protected]>
1 parent a9ff204 commit 77eaadb

File tree

1 file changed

+42
-45
lines changed

1 file changed

+42
-45
lines changed

android/src/main/java/com/tailscale/ipn/ui/view/TailnetLockSetupView.kt

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
package com.tailscale.ipn.ui.view
55

6+
import androidx.compose.foundation.focusable
7+
import androidx.compose.foundation.layout.Column
8+
import androidx.compose.foundation.layout.fillMaxSize
69
import androidx.compose.foundation.layout.padding
7-
import androidx.compose.foundation.lazy.LazyColumn
8-
import androidx.compose.foundation.lazy.items
10+
import androidx.compose.foundation.rememberScrollState
911
import androidx.compose.foundation.text.ClickableText
12+
import androidx.compose.foundation.verticalScroll
1013
import androidx.compose.material3.Icon
1114
import androidx.compose.material3.ListItem
1215
import androidx.compose.material3.MaterialTheme
@@ -42,53 +45,47 @@ fun TailnetLockSetupView(
4245
backToSettings: BackNavigation,
4346
model: TailnetLockSetupViewModel = viewModel(factory = TailnetLockSetupViewModelFactory())
4447
) {
45-
val statusItems by model.statusItems.collectAsState()
46-
val nodeKey by model.nodeKey.collectAsState()
47-
val tailnetLockKey by model.tailnetLockKey.collectAsState()
48-
val tailnetLockTlPubKey = tailnetLockKey.replace("nlpub", "tlpub")
48+
val statusItems by model.statusItems.collectAsState()
49+
val nodeKey by model.nodeKey.collectAsState()
50+
val tailnetLockKey by model.tailnetLockKey.collectAsState()
51+
val tailnetLockTlPubKey = tailnetLockKey.replace("nlpub", "tlpub")
4952

50-
Scaffold(topBar = { Header(R.string.tailnet_lock, onBack = backToSettings) }) { innerPadding ->
51-
LoadingIndicator.Wrap {
52-
Column(
53-
modifier = Modifier
54-
.padding(innerPadding)
55-
.focusable()
56-
.verticalScroll(rememberScrollState())
57-
.fillMaxSize()
58-
) {
59-
ExplainerView()
53+
Scaffold(topBar = { Header(R.string.tailnet_lock, onBack = backToSettings) }) { innerPadding ->
54+
LoadingIndicator.Wrap {
55+
Column(
56+
modifier =
57+
Modifier.padding(innerPadding)
58+
.focusable()
59+
.verticalScroll(rememberScrollState())
60+
.fillMaxSize()) {
61+
ExplainerView()
6062

61-
statusItems.forEach { statusItem ->
62-
Lists.ItemDivider()
63+
statusItems.forEach { statusItem ->
64+
Lists.ItemDivider()
6365

64-
ListItem(
65-
leadingContent = {
66-
Icon(
67-
painter = painterResource(id = statusItem.icon),
68-
contentDescription = null,
69-
tint = MaterialTheme.colorScheme.onSurfaceVariant
70-
)
71-
},
72-
headlineContent = { Text(stringResource(statusItem.title)) }
73-
)
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-
)
82-
83-
// Tailnet lock key
84-
Lists.SectionDivider()
85-
ClipboardValueView(
86-
value = tailnetLockTlPubKey,
87-
title = stringResource(R.string.tailnet_lock_key),
88-
subtitle = stringResource(R.string.tailnet_lock_key_explainer)
89-
)
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)) })
9074
}
91-
}
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+
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+
}
9289
}
9390
}
9491

0 commit comments

Comments
 (0)