Skip to content

Commit bf5a142

Browse files
committed
fix: resolve Kotlin compile errors in action history and UI icons
1 parent f6a8936 commit bf5a142

File tree

4 files changed

+60
-31
lines changed

4 files changed

+60
-31
lines changed

app/src/main/java/com/appcontrolx/data/ActionHistoryStore.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.datastore.core.DataStore
55
import androidx.datastore.preferences.core.Preferences
66
import androidx.datastore.preferences.core.edit
77
import androidx.datastore.preferences.core.emptyPreferences
8-
import androidx.datastore.preferences.core.remove
98
import androidx.datastore.preferences.core.stringPreferencesKey
109
import androidx.datastore.preferences.preferencesDataStore
1110
import com.appcontrolx.model.ActionHistoryItem

app/src/main/java/com/appcontrolx/ui/screens/activitylauncher/ActivityLauncherScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fun ActivityLauncherScreen(
100100
selected = selectedFilter == "all",
101101
onClick = { viewModel.setFilter("all") },
102102
label = { Text("All") },
103-
leadingIcon = { Icon(Icons.Default.Package, contentDescription = null, modifier = Modifier.size(16.dp)) }
103+
leadingIcon = { Icon(Icons.Default.Apps, contentDescription = null, modifier = Modifier.size(16.dp)) }
104104
)
105105
FilterChip(
106106
selected = selectedFilter == "user",
@@ -226,7 +226,7 @@ private fun AppActivityCard(
226226
)
227227
} else {
228228
Box(contentAlignment = Alignment.Center) {
229-
Icon(Icons.Default.Package, contentDescription = null)
229+
Icon(Icons.Default.Apps, contentDescription = null)
230230
}
231231
}
232232
}

app/src/main/java/com/appcontrolx/ui/screens/apps/AppListScreen.kt

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fun AppListScreen(
143143
horizontalAlignment = Alignment.CenterHorizontally
144144
) {
145145
Icon(
146-
Icons.Default.Package,
146+
Icons.Default.Apps,
147147
contentDescription = null,
148148
modifier = Modifier.size(64.dp),
149149
tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.3f)
@@ -261,7 +261,7 @@ private fun FilterTabs(
261261
selected = selectedFilter == "all",
262262
onClick = { onFilterChange("all") },
263263
label = { Text("All") },
264-
leadingIcon = { Icon(Icons.Default.Package, contentDescription = null, modifier = Modifier.size(16.dp)) },
264+
leadingIcon = { Icon(Icons.Default.Apps, contentDescription = null, modifier = Modifier.size(16.dp)) },
265265
trailingIcon = { Text(counts.all.toString(), style = MaterialTheme.typography.labelSmall) }
266266
)
267267
FilterChip(
@@ -275,7 +275,7 @@ private fun FilterTabs(
275275
selected = selectedFilter == "system",
276276
onClick = { onFilterChange("system") },
277277
label = { Text("System") },
278-
leadingIcon = { Icon(Icons.Default.Package, contentDescription = null, modifier = Modifier.size(16.dp)) },
278+
leadingIcon = { Icon(Icons.Default.Apps, contentDescription = null, modifier = Modifier.size(16.dp)) },
279279
trailingIcon = { Text(counts.system.toString(), style = MaterialTheme.typography.labelSmall) }
280280
)
281281
FilterChip(
@@ -391,30 +391,60 @@ private fun ActionButton(
391391
icon: androidx.compose.ui.graphics.vector.ImageVector,
392392
label: String,
393393
color: Color,
394-
onClick: () -> Unit
394+
onClick: () -> Unit,
395+
enabled: Boolean = true
395396
) {
396-
Surface(
397-
modifier = modifier,
398-
shape = RoundedCornerShape(12.dp),
399-
color = color.copy(alpha = 0.1f),
400-
onClick = onClick
401-
) {
402-
Row(
403-
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
404-
verticalAlignment = Alignment.CenterVertically,
405-
horizontalArrangement = Arrangement.spacedBy(8.dp)
397+
val contentColor = if (enabled) color else color.copy(alpha = 0.5f)
398+
val containerColor = if (enabled) color.copy(alpha = 0.1f) else color.copy(alpha = 0.05f)
399+
400+
if (enabled) {
401+
Surface(
402+
modifier = modifier,
403+
shape = RoundedCornerShape(12.dp),
404+
color = containerColor,
405+
onClick = onClick
406406
) {
407-
Icon(
408-
icon,
409-
contentDescription = null,
410-
tint = color,
411-
modifier = Modifier.size(18.dp)
412-
)
413-
Text(
414-
label,
415-
style = MaterialTheme.typography.labelMedium,
416-
color = color
417-
)
407+
Row(
408+
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
409+
verticalAlignment = Alignment.CenterVertically,
410+
horizontalArrangement = Arrangement.spacedBy(8.dp)
411+
) {
412+
Icon(
413+
icon,
414+
contentDescription = null,
415+
tint = contentColor,
416+
modifier = Modifier.size(18.dp)
417+
)
418+
Text(
419+
label,
420+
style = MaterialTheme.typography.labelMedium,
421+
color = contentColor
422+
)
423+
}
424+
}
425+
} else {
426+
Surface(
427+
modifier = modifier,
428+
shape = RoundedCornerShape(12.dp),
429+
color = containerColor
430+
) {
431+
Row(
432+
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
433+
verticalAlignment = Alignment.CenterVertically,
434+
horizontalArrangement = Arrangement.spacedBy(8.dp)
435+
) {
436+
Icon(
437+
icon,
438+
contentDescription = null,
439+
tint = contentColor,
440+
modifier = Modifier.size(18.dp)
441+
)
442+
Text(
443+
label,
444+
style = MaterialTheme.typography.labelMedium,
445+
color = contentColor
446+
)
447+
}
418448
}
419449
}
420450
}
@@ -502,7 +532,7 @@ private fun AppItem(
502532
contentAlignment = Alignment.Center
503533
) {
504534
Icon(
505-
Icons.Default.Package,
535+
Icons.Default.Apps,
506536
contentDescription = null,
507537
tint = MaterialTheme.colorScheme.onSurfaceVariant
508538
)
@@ -637,7 +667,7 @@ private fun AppDetailSheet(
637667
)
638668
} else {
639669
Box(contentAlignment = Alignment.Center) {
640-
Icon(Icons.Default.Package, contentDescription = null, modifier = Modifier.size(32.dp))
670+
Icon(Icons.Default.Apps, contentDescription = null, modifier = Modifier.size(32.dp))
641671
}
642672
}
643673
}

app/src/main/java/com/appcontrolx/ui/screens/tools/ToolsScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fun ToolsScreen(
105105
) {
106106
QuickActionCard(
107107
modifier = Modifier.weight(1f),
108-
icon = Icons.Default.Package,
108+
icon = Icons.Default.Apps,
109109
title = "App Manager",
110110
subtitle = "Freeze, stop, uninstall",
111111
color = MaterialTheme.colorScheme.primary,

0 commit comments

Comments
 (0)