Skip to content

Commit 236fb08

Browse files
author
Jvr
authored
Update Icons.kt
1 parent 9e443c2 commit 236fb08

File tree

1 file changed

+36
-25
lines changed
  • app/src/main/kotlin/com/apkupdater/ui/component

1 file changed

+36
-25
lines changed

app/src/main/kotlin/com/apkupdater/ui/component/Icons.kt

+36-25
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,24 @@ fun ExcludeIcon(
3232
@DrawableRes icon: Int = if (exclude) excludeIcon else includeIcon,
3333
@StringRes string: Int = if (exclude) includeString else excludeString,
3434
@StringRes contentDescription: Int = if (exclude) excludeString else includeString,
35-
) = PlainTooltipBox(
36-
tooltip = {
37-
androidx.compose.material3.Text(stringResource(string))
38-
},
39-
content = {
40-
Icon(
41-
painterResource(icon),
42-
stringResource(contentDescription),
43-
modifier = Modifier.tooltipTrigger()
44-
)
45-
}
46-
)
35+
) {
36+
val tooltipState = rememberTooltipState()
37+
val scope = rememberCoroutineScope()
38+
39+
PlainTooltipBox(
40+
tooltip = {
41+
androidx.compose.material3.Text(stringResource(string))
42+
},
43+
state = tooltipState,
44+
content = {
45+
Icon(
46+
painterResource(icon),
47+
stringResource(contentDescription),
48+
modifier = Modifier.tooltipTrigger(onClick = { scope.launch { tooltipState.show() } })
49+
)
50+
}
51+
)
52+
}
4753

4854
@Composable
4955
fun ExcludeSystemIcon(exclude: Boolean) = ExcludeIcon(
@@ -118,16 +124,21 @@ fun BoxScope.InstallProgressIcon(
118124
fun RefreshIcon(
119125
text: String,
120126
modifier: Modifier = Modifier
121-
) = PlainTooltipBox(
122-
tooltip = {
123-
androidx.compose.material3.Text(text)
124-
},
125-
tooltipState = rememberPlainTooltipState(),
126-
content = {
127-
Icon(
128-
painter = painterResource(id = R.drawable.ic_refresh),
129-
contentDescription = text,
130-
modifier = Modifier.tooltipTrigger().then(modifier)
131-
)
132-
}
133-
)
127+
) {
128+
val tooltipState = rememberTooltipState()
129+
val scope = rememberCoroutineScope()
130+
131+
PlainTooltipBox(
132+
tooltip = {
133+
androidx.compose.material3.Text(text)
134+
},
135+
state = tooltipState,
136+
content = {
137+
Icon(
138+
painter = painterResource(id = R.drawable.ic_refresh),
139+
contentDescription = text,
140+
modifier = Modifier.tooltipTrigger(onClick = { scope.launch { tooltipState.show() } }).then(modifier)
141+
)
142+
}
143+
)
144+
}

0 commit comments

Comments
 (0)