Compare commits
1 Commits
1.3-beta-2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf8a588020 |
@ -18,6 +18,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Build
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
@ -25,6 +26,7 @@ import androidx.compose.material.icons.filled.Done
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.Icon
|
||||
@ -262,10 +264,29 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
)
|
||||
}
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Switch(checked = isActive, onCheckedChange = { isActive = it})
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
Text("Is Active")
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
if (enabledRideProfiles.isEmpty()) {
|
||||
Text("Enabled for all profiles")
|
||||
} else {
|
||||
Text("Enabled for profiles:")
|
||||
|
||||
enabledRideProfiles.forEach { profileName ->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(profileName)
|
||||
FilledTonalButton(onClick = {
|
||||
enabledRideProfiles = enabledRideProfiles.toMutableSet().apply { remove(profileName) }
|
||||
}) {
|
||||
Icon(Icons.Default.Delete, contentDescription = "Delete profile")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FilledTonalButton(modifier = Modifier
|
||||
@ -273,9 +294,15 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
.height(60.dp), onClick = {
|
||||
rideProfileDialogVisible = true
|
||||
}) {
|
||||
Icon(Icons.Default.Build, contentDescription = "Change Ride Profiles", modifier = Modifier.size(20.dp))
|
||||
Icon(Icons.Default.Build, contentDescription = "Change Profiles", modifier = Modifier.size(20.dp))
|
||||
Spacer(modifier = Modifier.width(5.dp))
|
||||
Text("Ride Profiles: ${if (enabledRideProfiles.isEmpty()) "All" else enabledRideProfiles.joinToString(", ")}")
|
||||
Text("Limit to Profile")
|
||||
}
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Switch(checked = isActive, onCheckedChange = { isActive = it})
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
Text("Is Active")
|
||||
}
|
||||
|
||||
FilledTonalButton(modifier = Modifier
|
||||
@ -331,6 +358,7 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -339,28 +367,6 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
if (enabledRideProfiles.isEmpty()) {
|
||||
Text("All profiles enabled")
|
||||
} else {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
enabledRideProfiles.forEach { profileName ->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(profileName)
|
||||
FilledTonalButton(onClick = {
|
||||
enabledRideProfiles = enabledRideProfiles.toMutableSet().apply { remove(profileName) }
|
||||
}) {
|
||||
Icon(Icons.Default.Delete, contentDescription = "Delete profile")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OutlinedTextField(
|
||||
value = newProfileName,
|
||||
@ -373,18 +379,23 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
onClick = {
|
||||
if (newProfileName.isNotBlank()) {
|
||||
enabledRideProfiles = enabledRideProfiles.toMutableSet().apply { add(newProfileName) }
|
||||
newProfileName = "" // Clear the text field
|
||||
newProfileName = ""
|
||||
rideProfileDialogVisible = false
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth().height(60.dp)
|
||||
) {
|
||||
Icon(Icons.Default.Add, contentDescription = "Add Profile")
|
||||
Spacer(modifier = Modifier.width(5.dp))
|
||||
Text("Add Profile")
|
||||
}
|
||||
|
||||
|
||||
FilledTonalButton(
|
||||
onClick = { rideProfileDialogVisible = false },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth().height(60.dp)
|
||||
) {
|
||||
Icon(Icons.Default.Close, contentDescription = "Cancel Editing")
|
||||
Spacer(modifier = Modifier.width(5.dp))
|
||||
Text("Close")
|
||||
}
|
||||
}
|
||||
@ -399,6 +410,7 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||
) {
|
||||
Column(modifier = Modifier
|
||||
.padding(5.dp)
|
||||
@ -443,6 +455,7 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||
) {
|
||||
Column(modifier = Modifier
|
||||
.padding(5.dp)
|
||||
@ -478,6 +491,7 @@ fun DetailScreen(isCreating: Boolean, reminder: Reminder, onSubmit: (updatedRemi
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||
) {
|
||||
Column(modifier = Modifier
|
||||
.padding(5.dp)
|
||||
|
||||
@ -254,4 +254,4 @@ fun MainScreen(reminders: MutableList<Reminder>, onNavigateToReminder: (r: Remin
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user