Skip to content

Commit

Permalink
feat: add checkboxes to the downloaded apps page
Browse files Browse the repository at this point in the history
  • Loading branch information
Axelen123 committed Oct 20, 2023
1 parent 64ec73d commit e70c10a
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.Checkbox
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand Down Expand Up @@ -66,12 +67,20 @@ fun DownloadsSettingsScreen(

GroupHeader(stringResource(R.string.downloaded_apps))

downloadedApps.forEach {
downloadedApps.forEach { app ->
val selected = app in viewModel.selection

ListItem(
modifier = Modifier.clickable { viewModel.toggleItem(it) },
headlineContent = { Text(it.packageName) },
supportingContent = { Text(it.version) },
tonalElevation = if (viewModel.selection.contains(it)) 8.dp else 0.dp
modifier = Modifier.clickable { viewModel.toggleItem(app) },
headlineContent = { Text(app.packageName) },
leadingContent = (@Composable {
Checkbox(
checked = selected,
onCheckedChange = { viewModel.toggleItem(app) }
)
}).takeIf { viewModel.selection.isNotEmpty() },
supportingContent = { Text(app.version) },
tonalElevation = if (selected) 8.dp else 0.dp
)
}
}
Expand Down

0 comments on commit e70c10a

Please sign in to comment.