Skip to content

Commit

Permalink
Update Icons.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Jvr authored Feb 10, 2024
1 parent 9e443c2 commit 236fb08
Showing 1 changed file with 36 additions and 25 deletions.
61 changes: 36 additions & 25 deletions app/src/main/kotlin/com/apkupdater/ui/component/Icons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,24 @@ fun ExcludeIcon(
@DrawableRes icon: Int = if (exclude) excludeIcon else includeIcon,
@StringRes string: Int = if (exclude) includeString else excludeString,
@StringRes contentDescription: Int = if (exclude) excludeString else includeString,
) = PlainTooltipBox(
tooltip = {
androidx.compose.material3.Text(stringResource(string))
},
content = {
Icon(
painterResource(icon),
stringResource(contentDescription),
modifier = Modifier.tooltipTrigger()
)
}
)
) {
val tooltipState = rememberTooltipState()
val scope = rememberCoroutineScope()

PlainTooltipBox(
tooltip = {
androidx.compose.material3.Text(stringResource(string))
},
state = tooltipState,
content = {
Icon(
painterResource(icon),
stringResource(contentDescription),
modifier = Modifier.tooltipTrigger(onClick = { scope.launch { tooltipState.show() } })
)
}
)
}

@Composable
fun ExcludeSystemIcon(exclude: Boolean) = ExcludeIcon(
Expand Down Expand Up @@ -118,16 +124,21 @@ fun BoxScope.InstallProgressIcon(
fun RefreshIcon(
text: String,
modifier: Modifier = Modifier
) = PlainTooltipBox(
tooltip = {
androidx.compose.material3.Text(text)
},
tooltipState = rememberPlainTooltipState(),
content = {
Icon(
painter = painterResource(id = R.drawable.ic_refresh),
contentDescription = text,
modifier = Modifier.tooltipTrigger().then(modifier)
)
}
)
) {
val tooltipState = rememberTooltipState()
val scope = rememberCoroutineScope()

PlainTooltipBox(
tooltip = {
androidx.compose.material3.Text(text)
},
state = tooltipState,
content = {
Icon(
painter = painterResource(id = R.drawable.ic_refresh),
contentDescription = text,
modifier = Modifier.tooltipTrigger(onClick = { scope.launch { tooltipState.show() } }).then(modifier)
)
}
)
}

0 comments on commit 236fb08

Please sign in to comment.