Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions app/src/main/java/com/endroid/latch/ui/LatchApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import com.endroid.latch.BuildConfig
Expand Down Expand Up @@ -142,11 +145,12 @@ fun LatchApp(onThemeChanged: () -> Unit = {}) {
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text("No rules yet", style = MaterialTheme.typography.titleMedium)
Text("No rules yet", style = MaterialTheme.typography.titleLarge)
Spacer(Modifier.height(8.dp))
Text(
"Create a rule or import a recipe. Automation stays on-device — no account, no cloud.",
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
)
Spacer(Modifier.height(16.dp))
Button(onClick = { screen = Screen.Edit(null) }) { Text("Create rule") }
Expand Down Expand Up @@ -309,15 +313,17 @@ private fun RuleCard(
modifier = Modifier.fillMaxWidth(),
) {
Row(Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f)) {
Text(rule.name, style = MaterialTheme.typography.titleMedium)
Column(Modifier.weight(1f).alpha(if (rule.enabled) 1f else 0.6f)) {
Text(rule.name, style = MaterialTheme.typography.titleMedium, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(rule.triggerSummary(), style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant)
color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
if (rule.actions.isNotEmpty()) {
Text(
rule.actions.joinToString(" → ") { it.summary() },
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.primary,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
}
}
Expand All @@ -328,7 +334,7 @@ private fun RuleCard(
Icon(Icons.Default.Add, contentDescription = "Duplicate rule")
}
IconButton(onClick = onDelete) {
Icon(Icons.Default.Delete, contentDescription = "Delete")
Icon(Icons.Default.Delete, contentDescription = "Delete rule", tint = MaterialTheme.colorScheme.error)
}
Switch(
checked = rule.enabled,
Expand Down Expand Up @@ -951,9 +957,9 @@ private fun SettingsScreen(

@Composable
private fun SettingSwitch(title: String, subtitle: String, checked: Boolean, onChange: (Boolean) -> Unit) {
Row(verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f)) {
Text(title)
Row(Modifier.padding(vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f).padding(end = 12.dp)) {
Text(title, style = MaterialTheme.typography.bodyLarge)
Text(subtitle, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant)
}
Expand Down
Loading